/* Modern Team Display Page Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Barlow Semi Condensed', sans-serif;
}

/* Animated gradient background */
body {
    min-height: 100vh;
    background: linear-gradient(125deg,
            #ff7eb3,
            #ff758c,
            #ff8c42,
            #ffd700,
            #b388ff,
            #8c9eff);
    background-size: 300% 300%;
    animation: gradientMove 35s ease infinite;
    position: relative;
    overflow-x: hidden;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.container {
    --top-panel-offset: 2.88vh;
    --top-panel-height: 22vh;
    width: 100%;
    height: 100vh;
    max-width: 100%;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Header Section - 60px + 400px + 60px = 520px total */
.header {
    text-align: center;
    position: relative;
    flex-shrink: 0;
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 0;
}

.info-section {
    position: fixed;
    top: var(--top-panel-offset);
    left: 50%;
    width: min(46vw, 820px);
    height: var(--top-panel-height);
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transform: translateX(-50%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    z-index: 100;
}

.presenter-name {
    font-size: 1.8rem;
    color: rgba(0, 0, 0, 0.9);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 400;
}

.show-title {
    font-size: 4.5rem;
    font-weight: 400;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
    line-height: 1;
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.subtitle {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* QR Code Container */
.qr-code-container {
    position: fixed;
    top: var(--top-panel-offset);
    left: var(--top-panel-offset);
    width: var(--top-panel-height);
    height: var(--top-panel-height);
    background: white;
    /* The image includes the four-module white margin required for scanning. */
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 8px 24px rgba(64, 20, 47, 0.24);
    z-index: 100;
}

.qr-code {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Teams Container - Takes remaining space */
.teams-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 3rem;
    margin: 0 auto;
    padding: 1vh 2rem 5vh 2rem; /* Reduced top room to move circles higher up */
    flex: 1;
    flex-wrap: nowrap;
    width: 100%;
    gap: 2rem;
    box-sizing: border-box;
    overflow: hidden; /* Prevent scrolling, force dynamic sizing to fit */
}

.teams-container::-webkit-scrollbar {
    display: none;
}

/* Team Column */
.team-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    animation: slideUp 0.5s ease forwards;
    opacity: 0;
    gap: 1.5vh;
    flex: 1;
    max-width: 450px;
    height: 100%;
    position: relative;
    min-width: 0;
    overflow: visible; /* Allow circles to breathe if needed */
}

.team-column:nth-child(1) {
    animation-delay: 0.1s;
}

.team-column:nth-child(2) {
    animation-delay: 0.2s;
}

.team-column:nth-child(3) {
    animation-delay: 0.3s;
}

.team-column:nth-child(4) {
    animation-delay: 0.4s;
}

.team-column:nth-child(5) {
    animation-delay: 0.5s;
}

.team-column:nth-child(6) {
    animation-delay: 0.6s;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }

    from {
        transform: translateY(30px);
        opacity: 0;
    }
}

/* Team Circle - ~200px height area = ~9.6vh */
.team-circle {
    --base-size: min(9.6vh, calc(75vw / var(--team-count, 5)));
    --border-width: calc(var(--base-size) * 0.1);

    width: var(--base-size);
    height: var(--base-size);
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border: var(--border-width) solid #2c3e50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--base-size) * 0.45);
    font-weight: bold;
    color: #2c3e50;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 5;
}

.team-circle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.team-circle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.team-circle:hover::before {
    animation: shine 0.6s ease;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
        opacity: 0;
    }
}

/* Team Players Container - Shows all players without scrolling */
.team-numbers {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--slot-gap, 0.5rem);
    width: 100%;
    padding: 0 10px;
    flex: 1;
    overflow: visible;
}


/* Player Slot - Original Gradient with Dynamic Sizing */
.team-slot {
    background: linear-gradient(135deg, #F8D2BA 0%, #AB13A8 100%);
    color: white;
    padding: var(--slot-padding-v, 0.3rem) 0.7rem;
    border-radius: var(--slot-radius, 12px);
    text-align: center;
    width: 100%;
    min-height: var(--slot-min-height, 1.8rem);
    font-size: var(--slot-font-size, 1.1rem);
    font-weight: 500;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(171, 19, 168, 0.3);
    transition: all 0.3s ease;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    line-height: 1.1;
    overflow: hidden;
}

.team-slot:hover {
    transform: translateX(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(171, 19, 168, 0.4);
}

.team-slot .player-number {
    font-size: 0.6em;
    color: rgba(0, 0, 0, 0.4);
    font-weight: 600;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.team-slot .player-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Flash animation for existing items when something happens */
@keyframes itemHighlight {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); background: rgba(255, 255, 255, 1); }
}

/* Name Announcement Overlay */
.announcement-overlay {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #F8D2BA 0%, #AB13A8 100%);
    padding: 2rem 4rem;
    border-radius: 30px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 100px rgba(171, 19, 168, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.announcement-overlay.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.announcement-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 5px;
    margin-bottom: 0.5rem;
}

.announcement-name {
    color: white;
    font-size: 6rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Flying Name Shadow */
.flying-name {
    position: fixed;
    background: linear-gradient(135deg, #F8D2BA 0%, #AB13A8 100%);
    color: white;
    padding: var(--slot-padding-v, 0.5rem) var(--slot-padding-h, 1rem);
    border-radius: var(--slot-radius, 15px);
    font-size: var(--slot-font-size, 1.4rem);
    font-weight: 600;
    z-index: 2000;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    white-space: nowrap;
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Status Indicator */
.status-indicator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.status-dot {
    width: 12px;
    height: 12px;
    background: #00ff00;
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.status-text {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Fullscreen Hint */
.fullscreen-hint {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.fullscreen-hint:hover {
    opacity: 1;
}

/* Fullscreen mode adjustments */
:fullscreen .fullscreen-hint {
    display: none;
}

:fullscreen .qr-code-container {
    top: 30px;
    left: 30px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .teams-container {
        gap: 2rem;
    }

    .team-numbers {
        width: 200px;
    }
    
    .team-slot {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .info-section {
        position: static;
        width: calc(100% - 2rem);
        height: auto;
        transform: none;
    }

    .show-title {
        font-size: 3rem;
    }

    .subtitle {
        font-size: 1.8rem;
    }

    .qr-code-container {
        display: none;
    }

    .teams-container {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }

    .team-column {
        width: 100%;
        max-width: 300px;
    }

    .team-numbers {
        width: 100%;
    }

    .fullscreen-hint {
        display: none;
    }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 4rem;
    color: white;
    font-size: 2rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-left: 10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Latest Photos Container Style (Top Right) */
.latest-photos-container {
    position: fixed;
    top: var(--top-panel-offset);
    right: var(--top-panel-offset);
    width: 320px;
    height: var(--top-panel-height);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    padding: 8px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 100;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.latest-photos-container.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
    pointer-events: none;
}

.photo-frame {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    padding: 10px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Barlow Semi Condensed', sans-serif;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
