/* ============================================
   Babyfoot Presence - Modern Dark Theme
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --tourno-gold: #fbbf24;

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Logo Styling */
.logo-image {
    max-width: 140px;
    height: auto;
    margin-bottom: 10px;
    border-radius: var(--radius-md);
}

.logo-image-mobile {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
    border-radius: var(--radius-sm);
}

/* ============================================
   Utilities
   ============================================ */

.btn-submit,
.btn-vote,
.btn-login {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-submit:hover,
.btn-vote:hover,
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-glass);
    border-color: var(--text-secondary);
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: #fca5a5;
}

/* ============================================
   HOST PAGE - Split Screen Dashboard
   ============================================ */

.host-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Horizontal Premium Top Header */
.host-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    height: 70px;
    flex-shrink: 0;
    z-index: 10;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-img {
    height: 38px;
    width: auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.header-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 8px;
    -webkit-text-fill-color: initial;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-tournoi-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--tourno-gold), #f59e0b);
    color: #0f172a;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
}

.btn-tournoi-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(251, 191, 36, 0.4);
}

.btn-admin-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.25s ease;
}

.btn-admin-header:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    color: white;
}

.host-container {
    display: grid;
    grid-template-columns: 600px 1fr;
    flex: 1;
    height: calc(100vh - 70px);
    gap: 0;
}

/* Left Panel - FIXED */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: var(--bg-secondary);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
}

.qr-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.qr-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.qr-wrapper {
    background: white;
    padding: 10px;
    border-radius: var(--radius-lg);
    display: inline-block;
    margin-bottom: 10px;
    box-shadow: var(--shadow-glow);
}

.qr-image {
    width: 150px;
    height: 150px;
    display: block;
}

.qr-url {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 500;
    margin-bottom: 8px;
    word-break: break-all;
}

.qr-instruction {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Right Panel - SCROLLABLE */
.right-panel {
    display: flex;
    flex-direction: column;
    padding: 25px;
    overflow: hidden;
}

.winning-mode-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.winning-mode-card h2 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.mode-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.mode-name {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mode-votes {
    font-size: 14px;
    color: var(--text-muted);
}

/* Votes Breakdown */
.votes-breakdown {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vote-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
}

.vote-mode {
    font-size: 14px;
    color: var(--text-secondary);
}

.vote-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Players Card */
.players-card {
    flex: 1;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.players-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.player-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    margin-left: 12px;
}

.btn-add {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.players-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-content: flex-start;
    padding-right: 10px;
}

.no-players {
    text-align: center;
    color: var(--text-muted);
    padding: 60px;
    font-size: 18px;
    width: 100%;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideIn 0.3s ease;
    min-width: 200px;
    flex: 1 1 200px;
    max-width: 300px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.player-name {
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.btn-remove {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 10px;
}

.btn-remove:hover {
    background: var(--error);
    color: white;
}

.admin-link {
    align-self: flex-end;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.admin-link:hover {
    background: var(--bg-glass);
    color: var(--text-secondary);
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--error);
    color: white;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-error {
    color: var(--error);
    font-size: 14px;
    margin-bottom: 15px;
    min-height: 20px;
}

/* ============================================
   VOTE PAGE - Mobile Interface
   ============================================ */

.vote-page {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vote-container {
    width: 100%;
    max-width: 500px;
}

.vote-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 35px;
    box-shadow: var(--shadow-lg);
}

.vote-header {
    text-align: center;
    margin-bottom: 30px;
}

.vote-header h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 8px;
}

.vote-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.vote-form .form-group input {
    font-size: 18px;
    padding: 18px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-option {
    cursor: pointer;
}

.mode-option input {
    display: none;
}

.mode-label {
    display: block;
    padding: 16px 20px;
    background: var(--bg-glass);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mode-option input:checked+.mode-label {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.mode-label:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-secondary);
}

.btn-vote {
    margin-top: 10px;
    font-size: 20px;
    padding: 18px;
}

/* ============================================
   SUCCESS PAGE
   ============================================ */

.success-page {
    background: linear-gradient(180deg, #0f172a 0%, #064e3b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.success-container {
    width: 100%;
    max-width: 500px;
}

.success-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 50px 35px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.success-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.success-card h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.success-card p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 10px;
}

.success-instruction {
    color: var(--text-muted);
    margin-top: 20px;
}

.btn-back {
    display: inline-block;
    margin-top: 30px;
    padding: 14px 28px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 30px;
}

.login-form {
    text-align: left;
}

.back-link {
    display: inline-block;
    margin-top: 25px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text-secondary);
}

/* ============================================
   ADMIN PAGE
   ============================================ */

.admin-page {
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 30px;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-header h1 {
    font-size: 32px;
    font-weight: 800;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn-logout {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--error);
    color: white;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 25px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 48px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.stats-section {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 25px;
}

.stats-section.full-width {
    grid-column: 1 / -1;
}

.stats-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
}

.ranking-item .rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
}

.ranking-item .name {
    flex: 1;
    font-weight: 500;
}

.ranking-item .count {
    color: var(--text-muted);
    font-size: 14px;
}

.chart-container {
    padding: 20px;
    max-width: 350px;
    margin: 0 auto;
}

.sessions-table {
    width: 100%;
    border-collapse: collapse;
}

.sessions-table th,
.sessions-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sessions-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sessions-table tbody tr:hover {
    background: var(--bg-glass);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
    .host-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }

    .left-panel {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .right-panel {
        min-height: 50vh;
    }

    .qr-card {
        padding: 20px;
    }

    .qr-image {
        width: 150px;
        height: 150px;
    }

    .qr-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

@media (max-width: 600px) {

    .vote-card,
    .success-card,
    .login-card {
        padding: 25px;
    }

    .vote-header h1 {
        font-size: 28px;
    }

    .admin-page {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}