/**
 * Game History Page Styles
 * Displays historical game sessions for bar admins
 */

/* ========== Layout ========== */
body {
    background: var(--color-bg-dark);
    color: var(--color-text);
    min-height: 100vh;
}

.screen {
    min-height: 100vh;
}

.screen.hidden {
    display: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ========== Login Screen ========== */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: var(--color-bg-darker);
    padding: 3rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--color-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #fff;
    font-weight: 700;
}

.login-box > p {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

.login-error {
    color: #ef4444;
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-md);
}

.login-error.hidden {
    display: none;
}

/* ========== Header ========== */
.header {
    background: var(--color-bg-darker);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 2px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-choice-a), var(--color-choice-b), var(--color-choice-c), var(--color-choice-d));
}

.header h1 {
    margin: 0;
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
}

.header p {
    color: var(--color-text-secondary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ========== Cards ========== */
.card {
    background: var(--color-bg-darker);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 2px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-choice-a), var(--color-choice-b), var(--color-choice-c), var(--color-choice-d));
}

.card h2 {
    margin-top: 0;
    color: #fff;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-box {
    text-align: center;
    background: var(--color-bg-dark);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--color-border);
    transition: all var(--transition);
}

.stat-box:hover {
    border-color: var(--color-choice-b);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--color-choice-a), var(--color-choice-b));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Game-specific stat colors */
.stat-box.stat-blindtest .stat-value {
    background: linear-gradient(135deg, #ff5565, #ff3d50);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-box.stat-quiz .stat-value {
    background: linear-gradient(135deg, #ffd700, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-box.stat-simon .stat-value {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-box.stat-timeline .stat-value {
    background: linear-gradient(135deg, #00d4ff, #0ea5e9);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ========== Filters ========== */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #fff;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-border);
    background: var(--color-bg-dark);
    color: var(--color-text);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-choice-a);
    box-shadow: 0 0 0 3px rgba(255, 85, 101, 0.1);
}

.form-group select option {
    background: var(--color-bg-darker);
    color: var(--color-text);
}

/* ========== Buttons ========== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-choice-a), #ff3d50);
    color: white;
}

.btn-secondary {
    background: var(--color-bg-dark);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-choice-b);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    font-size: 1.1rem;
}

/* ========== Badge ========== */
.badge {
    background: var(--color-choice-a);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ========== Games List ========== */
.games-list {
    margin-top: 1.5rem;
}

.game-item {
    background: var(--color-bg-dark);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all var(--transition);
    cursor: pointer;
}

.game-item:hover {
    border-color: var(--color-choice-b);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.game-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-type {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.game-type.blindtest {
    background: rgba(255, 85, 101, 0.2);
    color: #ff5565;
}

.game-type.quiz {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.game-type.simon {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.game-type.timeline {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
}

.game-status {
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.game-status.completed {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.game-status.active {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.game-item-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.game-item-body strong {
    color: #fff;
    display: block;
    margin-bottom: 0.25rem;
}

.game-winner {
    color: #ffd700 !important;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--color-text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-secondary);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--color-border);
}

.pagination.hidden {
    display: none;
}

#page-info {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--color-bg-darker);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color var(--transition);
}

.modal-close:hover {
    color: #fff;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #fff;
    font-size: 1.5rem;
    padding-right: 2rem;
}

.modal-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}

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

.modal-detail-label {
    color: var(--color-text-secondary);
}

.modal-detail-value {
    color: #fff;
    font-weight: 600;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .card {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .game-item-body {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .game-item-body {
        grid-template-columns: 1fr;
    }
}
