body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

.scroll-top-button {
    background: rgba(255,255,255,0.5); /* semi-transparent white */
    color: #222; /* dark text for contrast */
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    margin: 15px auto;
    cursor: pointer;
    display: none; /* Hidden by default */
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: all 0.2s ease-in-out;
}

.scroll-top-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    background: rgba(255,255,255,0.85); /* slightly less transparent on hover */
}

.scroll-top-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.header {
    text-align: center;
    background: linear-gradient(135deg, #bd0000 0%, #7f0000 100%);
    color: white;
    padding: 20px 0;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease-in-out;
}

.print-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 16px;
    color: white;
    width: 24px;
    height: 24px;
    transition: transform 0.2s ease;
}

.print-link:hover {
    transform: translateY(-1px);
}

.print-link svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.header.compact {
    padding: 8px 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

.header.compact .header-content {
    margin: 0;
    height: 0;
    padding: 0;
    opacity: 0;
}

.logo-container {
    background-color: white;
    padding: 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    margin: 0 10px;
    transition: all 0.3s ease;
}

.header.compact .logo-container {
    padding: 8px;
    border-radius: 8px;
    margin: 0 6px;
}

.logo {
    height: 60px;
    width: auto;
    transition: all 0.3s ease;
}

.header.compact .logo {
    height: 40px;
}

.header-text {
    text-align: center;
}

.header h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    margin: 5px 0 0 0;
    font-size: 1.1em;
    opacity: 0.9;
}

.view-controls {
    margin-top: 20px;
    text-align: center;
    max-width: 1600px;
    margin: 20px auto 0;
    padding: 0 20px;
    transition: all 0.3s ease-in-out;
    height: auto;
    opacity: 1;
    overflow: hidden;
}

.header.compact .view-controls {
    margin: 0 auto;
    height: 0;
    opacity: 0;
    padding: 0;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease-in-out;
}

.header.compact .view-toggle {
    transform: scale(0.9);
    padding: 6px 12px;
    visibility: hidden;
}

.search-container {
    margin-top: 20px;
    text-align: center;
    transition: all 0.3s ease-in-out;
    position: relative;
}

.header.compact .search-container {
    margin-top: 0;
    padding: 8px 6px;
}

.search-wrapper {
    display: inline-flex;
    align-items: center;
    width: 90%;
    max-width: 600px;
    transition: all 0.3s ease-in-out;
}

.compact-logo {
    height: 32px;
    width: auto;
    margin-right: 10px;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease-in-out;
    display: none;
}

.header.compact .compact-logo {
    opacity: 1;
    transform: translateX(0);
    display: block;
}

#searchInput {
    flex: 1;
    padding: 10px;
    font-size: 1em;
    border-radius: 5px 0 0 5px;
    border: 1px solid #ccc;
    transition: all 0.3s ease-in-out;
}

.header.compact #searchInput {
    padding: 8px;
    font-size: 0.95em;
}

#clearSearchBtn {
    padding: 10px 16px;
    font-size: 1em;
    border-radius: 0 5px 5px 0;
    border: 1px solid #ccc;
    background: #eee;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.header.compact #clearSearchBtn {
    padding: 8px 12px;
    font-size: 0.95em;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Card View Styles */

.card-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.player-card {
    display: none;
    width: 100%;
    max-width: 300px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(42, 82, 152, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    text-align: center;
    margin: 0 auto;
}

.card-view .player-card {
    display: block;
}



.card-view .player-row {
    display: none;
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-color: #2a5298;
    cursor: pointer;
}

.player-card:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-thumbnail {
    width: 100%;
    height: 240px;
    object-fit: cover;
    object-position: center top;
    border-bottom: 1px solid #eee;
    margin: 0;
}

.card-info {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: white;
}

.card-number {
    font-size: 28px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0;
}

.card-name {
    width: 100%;
    text-align: center;
    font-size: 20px;
    color: #2c3e50;
    font-weight: 600;
    margin: 0;
    padding: 0 10px;
}

.roster-container {
    max-width: 1400px;
    margin: 220px auto 0;
    transition: margin 0.3s ease-in-out;
    padding-top: 80px;
}

.header.compact ~ .roster-container {
    margin-top: 120px;
}

.roster-container.card-view {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}

/* Mobile view - 1 card per row */
.card-view .player-card {
    width: 100%;
    max-width: 300px;
    margin-bottom: 20px;
}

/* Tablet view - 2 cards per row */
@media (min-width: 768px) {
    .roster-container {
        margin-top: 220px;
    }
    .card-view .player-card {
        width: 320px;
        flex: 0 0 320px;
        margin-bottom: 0;
        display: inline-block
    }
}

/* Desktop view - 3 cards per row */
@media (min-width: 1024px) {
    .roster-container.card-view {
        max-width: 1200px;
    }
    .card-view .player-card {
        width: 320px;
        flex: 0 0 320px;
    }
}

.player-row {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s;
}

.player-row:nth-child(even) {
    background-color: #f5f5f5;
}
.player-row:nth-child(odd) {
    background-color: #fff;
}

.player-row:hover {
    background-color: #f8f9fa;
}

.player-row:last-child {
    border-bottom: none;
}

.player-number {
    font-weight: bold;
    font-size: 28px;
    color: white;
    min-width: 50px;
    text-align: center;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 5px;
    padding: 8px;
    margin-right: 18px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.player-name {
    font-size: 24px;
    color: #2c3e50;
    font-weight: 600;
    flex-grow: 1;
}

.player-thumbnail {
    width: 96px;
    height: 96px;
    border-radius: 16px;
    margin-left: 18px;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s;
    object-fit: cover;
    object-position: center top;
    border: 1px solid #b8b8b8;
}

.player-thumbnail:hover {
    transform: scale(1.1);
    border-color: #2a5298;
    border-width: 2px;
    box-shadow: 0 4px 8px rgba(42, 82, 152, 0.3);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0);
    transition: background-color 0.3s ease-out;
}

.modal.visible {
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    top: 50%;
    transform: translateY(-50%) scale(0.7);
    text-align: center;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                opacity 0.3s ease-out;
}

.modal.visible .modal-content {
    transform: translateY(-50%) scale(1);
    opacity: 1;
}

.modal-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.modal-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: block;
}

.modal-info {
    color: rgb(255, 255, 255);
    margin-top: 15px;
    padding: 15px 0;
    font-size: 24px;
    font-weight: bold;
    border-radius: 8px;
    text-align: center;
    box-sizing: border-box;
    text-transform: capitalize;
    display: inline-block;
    padding-left: 60px;
    padding-right: 60px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#modalImage[src=""] {
    display: none;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #2a5298;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.loading-spinner.visible {
    display: block;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.modal-player-number {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 60%);
    color: white;
    font-size: 38px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(216, 216, 216, 0.2);
}

.modal-player-number:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}


.modal-content.bouncing-out {
    animation: bounceOut 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes bounceOut {
    0% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    20% {
        opacity: 0.9;
        transform: translateY(-50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50%) scale(0.3);
    }
}

.close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(30,60,114,0.7);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: background 0.2s;
}

.close:hover,
.close:focus {
    color: #ccc;
    background: rgba(42,82,152,0.9);
}

.total-count {
    text-align: center;
    margin-top: 20px;
    font-style: italic;
    color: #2a5298;
    font-weight: 500;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .header {
        padding: 15px 0;
    }

    /* Show scroll to top button only on mobile */
    .scroll-top-button {
        display: flex;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .header h1 {
        font-size: 2em;
    }

    .logo {
        height: 50px;
    }

    .search-wrapper {
        width: 95%;
    }

    .header.compact .compact-logo {
        height: 28px;
        margin-right: 8px;
    }

    .close {
        top: auto;
        bottom: 20px !important;
        right: 12px !important;
        font-size: 44px;
        width: 60px;
        height: 60px;
        background-color: #f1f1f1;
        color: #1e3c72;
    }

    /* Card view adjustments for mobile */
    .roster-container.card-view {
        padding: 15px;
        gap: 20px;
    }

    .card-view .player-card {
        margin-bottom: 20px;
    }

    .card-thumbnail {
        height: 200px; /* Slightly smaller images on mobile */
    }

    /* Row view adjustments */
    .player-row {
        padding: 8px;
    }

    .player-number {
        min-width: 35px;
        font-size: 16px;
        margin-right: 10px;
    }

    .player-name {
        font-size: 14px;
    }

    .player-thumbnail {
        width: 35px;
        height: 35px;
        margin-left: 10px;
    }
}
