/* Stock Price Update Button Styles */
.btn-update-prices {
    background: linear-gradient(145deg, #0d6efd, #0a58ca);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-update-prices:hover, .btn-update-prices:focus {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    background: linear-gradient(145deg, #0b5ed7, #0a53be);
    color: #fff;
}

.btn-update-prices:disabled, .btn-update-prices.disabled {
    background: #495057;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    opacity: 0.65;
}

.btn-update-prices .fa-sync-alt {
    margin-right: 8px;
    animation: fa-spin 2s linear infinite;
}

.btn-update-prices:hover .fa-sync-alt {
    animation-play-state: paused;
}

/* General Page Styles */

/* Ranking Guide Card Styles - Financial Theme */
.ranking-guide-card {
    background: #1D2A3A; /* Dark Navy Blue */
    border-radius: 15px;
    padding: 2.5rem;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid #D4AF37; /* Gold border */
}

.ranking-guide-card .card-title {
    color: #FFFFFF;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Accordion Custom Styles - Financial Theme */
.accordion-item {
    background-color: transparent;
    border: none;
    border-bottom: 1px solid #3c4d61;
    border-radius: 0 !important;
    margin-bottom: 0.5rem;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    border-radius: 0 !important;
}

.accordion-button {
    background-color: transparent;
    color: #EAEAEA;
    font-weight: 600;
    border-radius: 0 !important;
    box-shadow: none;
    padding: 1.25rem 1.5rem;
    transition: background-color 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background-color: #D4AF37; /* Gold */
    color: #1D2A3A; /* Dark Navy Blue for text */
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.4); /* Gold focus ring */
}

.accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(2);
}

.accordion-button:not(.collapsed)::after {
    filter: none;
}

.accordion-button .fas {
    color: #D4AF37; /* Gold */
    transition: color 0.3s ease;
    margin-right: 1rem;
}

.accordion-button:not(.collapsed) .fas {
    color: #1D2A3A; /* Dark Navy Blue */
}

.accordion-body {
    background-color: #162230; /* Slightly darker navy */
    color: #bdc3c7;
    padding: 1.5rem;
}

.accordion-body strong {
    color: #FFFFFF;
}

.accordion-body a {
    color: #D4AF37; /* Gold */
    text-decoration: none;
    font-weight: 600;
}

.accordion-body a:hover {
    color: #FFF;
    text-decoration: underline;
}

.accordion-body .alert-success {
    background-color: rgba(212, 175, 55, 0.1);
    border-color: #D4AF37;
    color: #EAEAEA;
}

.ranking-title {
    font-family: 'Arial Black', Gadget, sans-serif; /* Example font, adjust to match image */
    font-size: 5rem; /* Adjust to match image */
    color: #0A2342; /* Adjust to match image, might be darker or a specific color */
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.4rem;
    padding: 1rem 1rem 0;
    margin-bottom: 0;
}

/* Live Clock Styles - Calm & Professional */
#live-clock-container {
    font-family: 'Orbitron', 'Roboto Mono', monospace;
    margin: 2rem auto;
    text-align: center;
    padding: 10px 0;
}

#live-indicator-wrapper {
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
}

#live-indicator {
    color: #FF4136; /* Bright red for LIVE */
    font-weight: bold;
    font-size: 1rem; /* Smaller font for 'LIVE' */
    letter-spacing: 2px;
    animation: blink-urgent 1s infinite;
}

#time-display-wrapper {
    color: #A9BCD0; /* Calm, light blue-gray */
    font-size: 2.2rem; /* Larger font for date and time */
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 0 0 5px rgba(169, 188, 208, 0.3); /* Subtle glow */
}

#current-date {
    margin-right: 20px;
    font-size: 2rem;
    color: black;
}

#current-time {
    margin-right: 20px;
    font-size: 2rem;
    color: black;
}

@keyframes blink-urgent {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 10px #FF4136;
    }
    50% {
        opacity: 0.4;
        text-shadow: none;
    }
}

/* Modern Card Styles */
.ranking-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 25px;
    margin: 15px auto;
    width: 95%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: all 0.2s ease;
}

.ranking-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Team ranking card - same design as individual ranking but with darker background */
.group-ranking-card {
    /* Make team card identical to base/individual card */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 25px;
    margin: 15px auto;
    width: 95%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: all 0.2s ease;
}

.group-ranking-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Team ranking: make text white while keeping unified design */
.group-ranking-card .rank-name,
.group-ranking-card .rank-details,
.group-ranking-card .rank-assets,
.group-ranking-card .rank-position {
    color: #ffffff;
}

/* Team ranking table structure - same as individual */
.group-ranking-card .ranking-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
}

.group-ranking-card .ranking-item {
    /* Match base .ranking-item spacing */
    display: flex;
    align-items: center;
    padding: 18px 25px !important;
    margin: 8px 0 !important;
    gap: 30px; /* ensure space between name and asset */
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    position: relative;
}

.group-ranking-card .ranking-item.hovered {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Team ranking top 3 effects - only for actual rank 1,2,3 */
.group-ranking-card .ranking-item[data-rank="1"] {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 215, 0, 0.03));
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.group-ranking-card .ranking-item[data-rank="2"] {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.08), rgba(192, 192, 192, 0.03));
    border: 1px solid rgba(192, 192, 192, 0.2);
}

.group-ranking-card .ranking-item[data-rank="3"] {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.08), rgba(205, 127, 50, 0.03));
    border: 1px solid rgba(205, 127, 50, 0.2);
}

/* Team ranking special rank positions - same as individual */
/* Inherit base top-3 .rank-position styles */

/* Crown removed from team ranking to avoid duplication */

/* Inherit base .rank-info for identical layout */

/* Custom Tooltip Styles */
.profit-tooltip {
    position: relative;
    cursor: pointer;
    text-decoration: underline dotted;
    text-decoration-color: #D4AF37;
}

.profit-tooltip:hover::before {
    content: attr(data-profit);
    position: absolute;
    top: -30px;
    left: 0;
    background-color: #D4AF37;
    color: #000;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
}

.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Ranking Table Container */
.ranking-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
}

/* Rank Info Container */
.rank-info {
    flex: 1;
    min-width: 0;
    margin-left: 15px;
}

.rank-details {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 2px;
}

/* No Data State */
.no-data {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

/* Enhanced Tooltip for Ranking Items */
.ranking-item[data-profit]:hover::after {
    content: attr(data-profit);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    animation: tooltip-appear 0.3s ease-out;
}

@keyframes tooltip-appear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 30px; /* ensure space between name and asset */
    padding: 18px 25px;
    margin: 8px 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    position: relative;
}

.ranking-item.hovered {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Top 3 Special Effects - only for actual rank 1,2,3 */
.ranking-item[data-rank="1"] {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 215, 0, 0.03));
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.ranking-item[data-rank="2"] {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.08), rgba(192, 192, 192, 0.03));
    border: 1px solid rgba(192, 192, 192, 0.2);
}

.ranking-item[data-rank="3"] {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.08), rgba(205, 127, 50, 0.03));
    border: 1px solid rgba(205, 127, 50, 0.2);
}

.rank-position {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4a5568;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-right: 15px;
    transition: all 0.2s ease;
}

/* Special rank position styles - only for actual rank 1,2,3 */
.ranking-item[data-rank="1"] .rank-position {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a202c;
    font-weight: 800;
}

.ranking-item[data-rank="2"] .rank-position {
    background: linear-gradient(135deg, #c0c0c0, #e5e5e5);
    color: #1a202c;
    font-weight: 800;
}

.ranking-item[data-rank="3"] .rank-position {
    background: linear-gradient(135deg, #cd7f32, #daa520);
    color: #fff;
    font-weight: 800;
}

.rank-change {
    width: 30px;
    font-size: 1.2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.rank-change .up {
    color: #48BB78;
    animation: bounce-up 0.6s ease-out;
}

.rank-change .down {
    color: #F56565;
    animation: bounce-down 0.6s ease-out;
}

@keyframes bounce-up {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

@keyframes bounce-down {
    0% { transform: translateY(0); }
    50% { transform: translateY(5px); }
    100% { transform: translateY(0); }
}

.rank-name {
    flex-grow: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    padding-left: 0;
}

.rank-assets {
    font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    margin-left: auto; /* push to the right */
    flex: 0 0 auto;    /* prevent shrinking */
}

/* Additional Interactive Animations */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translate3d(0,0,0); }
    40%, 43% { transform: translate3d(0,-8px,0); }
    70% { transform: translate3d(0,-4px,0); }
    90% { transform: translate3d(0,-2px,0); }
}

/* Simplified Crown for #1 (class-based) — only on active slide */
.individual-ranking-card .individual-swiper .swiper-slide-active .ranking-item.first-place::after {
    content: '👑';
    position: absolute;
    top: -8px;
    right: 12px;
    font-size: 1.2rem;
    z-index: 10;
}

/* Responsive Animations */
@media (prefers-reduced-motion: reduce) {
    .individual-ranking-card .individual-swiper .swiper-slide-active .ranking-item.first-place::after {
        display: none;
    }
}

.rank-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    margin-left: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rank-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.rank-badge:hover::before {
    left: 100%;
}

/* Rank Badge Variants */
.rank-badge.gold {
    background: linear-gradient(135deg, #FFD700, #F6C453);
    color: #1f2937;
    box-shadow: 0 4px 14px rgba(246, 196, 83, 0.35);
}

.rank-badge.silver {
    background: linear-gradient(135deg, #C0C0C0, #E5E7EB);
    color: #1f2937;
    box-shadow: 0 4px 14px rgba(192, 192, 192, 0.3);
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #CD7F32, #D3A07A);
    color: #1f2937;
    box-shadow: 0 4px 14px rgba(205, 127, 50, 0.3);
}

.rank-badge.gold {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a202c;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.6);
}

.rank-badge.silver {
    background: linear-gradient(135deg, #c0c0c0, #e5e5e5);
    color: #1a202c;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.4);
    border: 1px solid rgba(192, 192, 192, 0.6);
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #cd7f32, #daa520);
    color: #fff;
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.4);
    border: 1px solid rgba(205, 127, 50, 0.6);
}

@keyframes pulse-glow {
    from {
        box-shadow: 0 0 5px rgba(160, 174, 192, 0.1);
    }
    to {
        box-shadow: 0 0 15px rgba(160, 174, 192, 0.3);
    }
}

/* Group (School) Ranking Card */
.group-ranking-card {
    background-color: #0A2342; /* Dark blue from image */
    color: #FFFFFF;
}

.group-ranking-card .ranking-subtitle {
    background-color: transparent; /* White button as in image */
    color: #a7a7a7; /* Dark blue text for button */
}

.group-ranking-card .list-group-item {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.2); /* Lighter border for dark bg */
    color: #FFFFFF;
    font-size: 1rem;
    padding: 0.75rem 0; /* Adjust padding */
    transition: background-color 0.3s ease, transform 0.2s ease; /* Added transform transition */
}

.group-ranking-card .asset-value {
    font-weight: bold;
    color: #E0E0E0; /* Slightly lighter for emphasis */
}

/* Individual Ranking Card */
.individual-ranking-card {
    background-color: #E9E9F0; /* Light gray from image */
    color: #333333;
}

.individual-ranking-card .ranking-subtitle {
    background-color: transparent; /* Dark blue button */
    color: #0A2342; /* White text for button */
}

.individual-ranking-card .list-group-item {
    background-color: transparent;
    border-color: rgba(0, 0, 0, 0.1); /* Darker border for light bg */
    color: #333333;
    font-size: 1rem;
    padding: 0.75rem 0; /* Adjust padding */
    transition: background-color 0.3s ease, transform 0.2s ease; /* Added transform transition */
}

.individual-ranking-card .asset-value {
    font-weight: bold;
    color: #111111; /* Darker for emphasis */
}

.ranking-list .list-group-item:last-child {
    border-bottom: none;
}

/* Pagination Styles to match image */
.pagination .page-item .page-link {
    background-color: #0A0A2A; /* Dark blue background for page numbers */
    color: #FFFFFF; /* White text */
    border: 1px solid #0A0A2A; /* Border color same as background */
    margin: 0 3px; /* Spacing between page numbers */
    border-radius: 5px; /* Rounded corners */
    min-width: 40px;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background-color: #FFFFFF; /* White background for active page */
    color: #0A0A2A; /* Dark blue text for active page */
    border-color: #0A0A2A; /* Dark blue border */
}

.pagination .page-item.disabled .page-link {
    background-color: #303050; /* Slightly lighter dark blue for disabled */
    color: #AAAAAA;
    border-color: #303050;
}

.pagination .page-item .page-link:hover {
    background-color: #1A1A3A; /* Slightly lighter dark blue on hover */
    border-color: #1A1A3A;
}

.pagination .page-item.active .page-link:hover {
    background-color: #F0F0F0;
    color: #0A0A2A;
}

/* Optional: Profile picture in ranking */
.rank-profile-pic {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

/* Responsive adjustments if needed */

/* Swiper Styles */
.swiper {
    width: 100%;
    height: auto; /* Let content define height */
    padding-bottom: 50px; /* Increased space for larger pagination dots and nav buttons */
    position: relative; /* Needed for absolute positioning of nav buttons */
    overflow: hidden; /* Added for coverflow */
}

.swiper-slide {
    text-align: center; /* Keep if individual items need centering, but ul will take width */
    font-size: 1rem; /* Match list item font size */
    background: transparent; /* Slides themselves are transparent */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align items to the top of the slide */

    /* --- Definitive Fix for Swiper Layout --- */
    width: 100%;
    height: auto;
    flex-shrink: 0;
    /* -------------------------------------- */

}

.swiper-slide .list-group {
    width: 70%; /* Make ul take full width of slide */
    margin-top: 0; /* Remove any default top margin if present */
}

/* Swiper Navigation Buttons */
.swiper-button-next,
.swiper-button-prev {
    position: absolute;
    top: 50%;
    transform: translateY(-50%); /* Vertically center */
    width: 30px; /* Adjust size */
    height: 30px; /* Adjust size */
    margin-top: -25px; /* Adjust to align with content, considering padding-bottom of swiper */
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Circular buttons */
    transition: background-color 0.3s ease, color 0.3s ease;
}

.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 16px; /* Adjust arrow size */
    font-weight: bold;
}

/* Group Ranking Swiper Nav Buttons */
.group-ranking-card .swiper-button-next,
.group-ranking-card .swiper-button-prev {
    background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white */
    color: #0A0A2A; /* Dark blue arrow */
}
.group-ranking-card .swiper-button-next:hover,
.group-ranking-card .swiper-button-prev:hover {
    background-color: #FFFFFF; /* Solid white on hover */
}

/* Individual Ranking Swiper Nav Buttons */
.individual-ranking-card .swiper-button-next,
.individual-ranking-card .swiper-button-prev {
    background-color: rgba(10, 10, 42, 0.7); /* Semi-transparent dark blue */
    color: #FFFFFF; /* White arrow */
}
.individual-ranking-card .swiper-button-next:hover,
.individual-ranking-card .swiper-button-prev:hover {
    background-color: #0A0A2A; /* Solid dark blue on hover */
}

.swiper-button-prev {
    left: 10px;
}
.swiper-button-next {
    right: 10px;
}

/* Swiper Pagination Dots */
.swiper-pagination {
    position: absolute;
    bottom: 10px !important; /* Ensure it's at the bottom of the swiper container */
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 5; /* Added z-index */
}

.swiper-pagination-bullet {
    width: 10px; /* Size of dots */
    height: 10px; /* Size of dots */
    margin: 0 5px; /* Spacing between dots */
    opacity: 0.5;
    border-radius: 50%;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

/* Group Ranking Swiper Pagination */
.group-ranking-card .swiper-pagination-bullet {
    background-color: #FFFFFF; /* White dots */
}
.group-ranking-card .swiper-pagination-bullet-active {
    opacity: 1;
    background-color: #FFFFFF; /* Active dot also white, but full opacity */
}

/* Individual Ranking Swiper Pagination */
.individual-ranking-card .swiper-pagination-bullet {
    background-color: #0A0A2A; /* Dark blue dots */
}
.individual-ranking-card .swiper-pagination-bullet-active {
    opacity: 1;
    background-color: #0A0A2A; /* Active dot also dark blue, full opacity */
}

/* Enhanced Hover Effects for List Items */
.ranking-list .list-group-item:hover {
    transform: translateX(5px); /* Slight shift on hover */
}

/* Group Ranking Hover */
.group-ranking-card .list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Slightly lighter on hover */
}

/* Individual Ranking Hover */
.individual-ranking-card .list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.05); /* Slightly darker on hover */
}


/* Top 3 Rank Styling */
.ranking-list .list-group-item.rank-1,
.ranking-list .list-group-item.rank-2,
.ranking-list .list-group-item.rank-3 {
    font-weight: bold; /* Make text bolder */
}

/* Specific colors for top ranks - can be more elaborate */
/* Group Ranking Top 3 */
.group-ranking-card .list-group-item.rank-1 { background-color: rgba(255, 215, 0, 0.2); /* Gold-ish tint */ }
.group-ranking-card .list-group-item.rank-2 { background-color: rgba(192, 192, 192, 0.2); /* Silver-ish tint */ }
.group-ranking-card .list-group-item.rank-3 { background-color: rgba(205, 127, 50, 0.2); /* Bronze-ish tint */ }

/* Individual Ranking Top 3 */
.individual-ranking-card .list-group-item.rank-1 { background-color: rgba(255, 215, 0, 0.3); }
.individual-ranking-card .list-group-item.rank-2 { background-color: rgba(170, 170, 170, 0.3); } /* Darker silver for light bg */
.individual-ranking-card .list-group-item.rank-3 { background-color: rgba(188, 108, 37, 0.3); } /* Darker bronze for light bg */

/* Optional: Add a small badge for top ranks */
.ranking-list .list-group-item .rank-badge {
    display: inline-block;
    padding: 0.2em 0.4em;
    font-size: 0.75em;
    font-weight: bold;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25rem;
    margin-left: 5px;
}
.group-ranking-card .list-group-item.rank-1 .rank-badge { background-color: #ffd700; color: #333; } /* Gold */
.group-ranking-card .list-group-item.rank-2 .rank-badge { background-color: #c0c0c0; color: #333; } /* Silver */
.group-ranking-card .list-group-item.rank-3 .rank-badge { background-color: #cd7f32; } /* Bronze */

.individual-ranking-card .list-group-item.rank-1 .rank-badge { background-color: #e6c300; } /* Darker Gold */
.individual-ranking-card .list-group-item.rank-2 .rank-badge { background-color: #a9a9a9; } /* Darker Silver */
.individual-ranking-card .list-group-item.rank-3 .rank-badge { background-color: #b87328; } /* Darker Bronze */

/* Remove old pagination styles if they conflict or are no longer needed */
/* The .pagination styles might be okay to keep if used elsewhere, but for rank.html they are replaced by Swiper's */

/* Explanation Card Styles - More Formal/Financial */
.explanation-card {
    background-color: #ffffff; /* White background */
    border: 1px solid #e0e0e0; /* Lighter, more subtle border */
    border-radius: 0.25rem; /* Slightly less rounded corners */
    color: #495057; /* Softer text color */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Subtle shadow for depth */
}

.explanation-card .card-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; /* Standard professional font */
    color: #343a40; /* Dark gray, less stark than black */
    font-size: 1.5rem; /* Slightly smaller title */
    font-weight: 600; /* Semi-bold for clarity */
    border-bottom: 1px solid #f0f0f0; /* Subtle separator for title */
    padding-bottom: 0.75rem;
}

.explanation-card ul {
    padding-left: 0; /* Remove default ul padding */
}

.explanation-card ul li {
    font-size: 0.9rem; /* Slightly smaller text for a denser, more formal look */
    line-height: 1.7;
    color: #555; /* Medium gray text */
    padding: 0.3rem 0; /* Add some vertical spacing between items */
}

.explanation-card ul li strong {
    color: #333; /* Slightly darker for emphasis */
    font-weight: 600;
}

.explanation-card .rank-formula {
    background-color: #f7f7f9; /* Very light gray for code block */
    padding: 0.3em 0.5em;
    border-radius: 0.2rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; /* Common monospace stack */
    color: #505050; /* Darker gray for code text, less vibrant */
    font-size: 0.85em;
    border: 1px solid #e8e8e8; /* Subtle border for the code block */
}


/* Enhanced Mobile Responsive Design */
@media (max-width: 767px) {
    .ranking-card, .group-ranking-card {
        margin-bottom: 20px;
        padding: 20px 16px;
        width: 94%;
        border-radius: 12px;
    }
    
    .ranking-title {
        font-size: 2rem;
        margin-bottom: 12px;
    }
    
    .ranking-subtitle {
        font-size: 0.95rem;
        margin-bottom: 16px;
    }
    
    .ranking-item {
        padding: 5px 6px;
        margin: 3px 0;
        border-radius: 10px;
        flex-wrap: nowrap;
        gap: 4px;
    }
    
    .rank-position {
        width: 20px;
        height: 20px;
        font-size: 0.62rem;
        margin-right: 5px;
    }
    
    .rank-name {
        font-size: 0.80rem;
        line-height: 1.1;
        margin-bottom: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .rank-details {
        font-size: 0.56rem;
        line-height: 1.06;
        margin-top: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .rank-assets {
        font-size: 0.72rem;
        padding: 3px 5px;
        margin-top: 0;
        width: auto;
        text-align: right;
        white-space: nowrap;
        margin-left: auto;
        flex: 0 0 auto;
    }

    /* Smaller badges on mobile */
    .rank-badge {
        font-size: 0.46rem;
        padding: 3px 5px;
        letter-spacing: 0.18px;
    }
    
    .rank-info {
        margin-left: 3px;
        flex: 1 1 auto;
        min-width: 0;
    }
    
    /* Team ranking smaller than individual on mobile */
    .group-ranking-card .ranking-item {
        padding: 4px 5px;
        gap: 3px;
    }
    .group-ranking-card .rank-position {
        width: 16px;
        height: 16px;
        font-size: 0.52rem;
        margin-right: 5px;
    }
    .group-ranking-card .rank-name {
        font-size: 0.72rem;
        line-height: 1.08;
    }
    .group-ranking-card .rank-details {
        font-size: 0.50rem;
        line-height: 1.04;
    }
    .group-ranking-card .rank-assets {
        font-size: 0.64rem;
        padding: 3px 4px;
    }
    .group-ranking-card .rank-badge {
        font-size: 0.46rem;
        padding: 2px 4px;
    }
    
    /* Mobile crown adjustment - only for individual ranking (active slide only) */
    .individual-ranking-card .individual-swiper .swiper-slide-active .ranking-item.first-place::after {
        font-size: 1rem;
        top: -6px;
        right: 8px;
        pointer-events: none; /* avoid hover conflicts */
    }
    
    /* Mobile tooltip adjustments */
    .ranking-item[data-profit]:hover::after {
        font-size: 11px;
        padding: 6px 10px;
        top: -35px;
    }
}

@media (max-width: 480px) {
    .ranking-card, .group-ranking-card {
        padding: 14px;
        margin: 10px auto;
        width: 92%;
    }
    
    .ranking-title {
        font-size: 1.45rem;
    }
    
    .ranking-subtitle {
        font-size: 1rem;
    }
    
    .ranking-item {
        padding: 4px 5px;
        flex-direction: row;     /* keep row layout */
        align-items: center;
        flex-wrap: nowrap;       /* no wrapping */
        gap: 4px;                /* tighter gap */
    }
    
    .rank-position {
        width: 17px;
        height: 17px;
        font-size: 0.54rem;
        margin-right: 5px;
        margin-bottom: 0;
        align-self: center;
    }
    
    .rank-info {
        margin-left: 3px;
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }
    
    .rank-name {
        font-size: 0.70rem;
        line-height: 1.06;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .rank-details {
        font-size: 0.50rem;
        line-height: 1.04;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .rank-assets {
        font-size: 0.72rem;
        padding: 3px 5px;
        font-size: 0.66rem;
        padding: 3px 4px;
        margin-top: 0;
        margin-left: auto;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .rank-badge {
        font-size: 0.52rem;
        padding: 3px 7px;
    }

    /* Team ranking even smaller on very small screens */
    .group-ranking-card .ranking-item { padding: 3px 4px; gap: 3px; }
    .group-ranking-card .rank-position { width: 15px; height: 15px; font-size: 0.50rem; margin-right: 4px; }
    .group-ranking-card .rank-name { font-size: 0.66rem; line-height: 1.04; }
    .group-ranking-card .rank-details { font-size: 0.46rem; line-height: 1.02; }
    .group-ranking-card .rank-assets { font-size: 0.60rem; padding: 2px 3px; }
    .group-ranking-card .rank-badge { font-size: 0.40rem; padding: 1px 3px; letter-spacing: 0.16px; }
    .group-ranking-card .rank-info { margin-left: 3px; }
}
