/* ==== PREMIUM FEATURES STYLING ==== */

/* CSS Variables for Branding */
:root {
    --brand-primary: #667eea;
    --brand-secondary: #764ba2;
}

/* ==== ENHANCED HEADER ==== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

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

.header-text h1 {
    margin: 0;
    color: var(--brand-primary);
}

.header-text p {
    margin: 5px 0 0 0;
    opacity: 0.8;
}

.team-logo {
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--brand-primary);
}

.team-logo[style*="display: none"] {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.header-actions {
    display: none; /* Hidden by default, shown only in game rooms */
    align-items: center;
    gap: 10px;
}

.btn-icon {
    background: rgba(255,255,255,0.9);
    border: 2px solid var(--brand-primary);
    border-radius: 25px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--brand-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.btn-icon:hover {
    background: var(--brand-primary);
    color: white;
    transform: translateY(-2px);
}

body.dark-mode .btn-icon {
    background: rgba(30,41,59,0.9);
    color: #e0e6ed;
    border-color: #4a5568;
}

body.dark-mode .btn-icon:hover {
    background: var(--brand-primary);
    color: white;
}

/* ==== QR CODE SECTION ==== */
.qr-code-section {
    background: rgba(255,255,255,0.95);
    border: 2px solid #e9ecef;
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

body.dark-mode .qr-code-section {
    background: rgba(30,41,59,0.95);
    border-color: #4a5568;
    color: #e0e6ed;
}

.qr-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

body.dark-mode .qr-code-header {
    border-bottom-color: #4a5568;
}

.qr-code-header h4 {
    margin: 0;
    color: var(--brand-primary);
}

.qr-code-canvas {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 220px;
}

.qr-code-canvas img {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.qr-code-content p {
    color: #6c757d;
    margin: 15px 0;
}

body.dark-mode .qr-code-content p {
    color: #a0aec0;
}

/* ==== BRANDING PANEL ==== */
.branding-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 16px;
    padding: 25px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

body.dark-mode .branding-panel {
    background: #1e293b;
    border-color: #4a5568;
    color: #e0e6ed;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

body.dark-mode .panel-header {
    border-bottom-color: #4a5568;
}

.panel-header h4 {
    margin: 0;
    color: var(--brand-primary);
}

.branding-section {
    margin-bottom: 20px;
}

.branding-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
}

body.dark-mode .branding-section label {
    color: #e0e6ed;
}

.branding-section input[type="text"],
.branding-section input[type="color"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.branding-section input[type="color"] {
    height: 50px;
    cursor: pointer;
}

.branding-section input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

body.dark-mode .branding-section input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e0e6ed;
}

.btn-upload {
    background: var(--brand-secondary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-upload:hover {
    background: color-mix(in srgb, var(--brand-secondary) 80%, black);
    transform: translateY(-2px);
}

.logo-preview {
    margin-top: 10px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.branding-preview {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

body.dark-mode .branding-preview {
    background: #2d3748;
}

.preview-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body.dark-mode .preview-card {
    background: #1e293b;
}

.preview-header {
    padding: 15px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.preview-content {
    padding: 15px;
}

.preview-button {
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
}

/* Branding Actions */
.branding-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    justify-content: center;
}

body.dark-mode .branding-actions {
    border-top-color: #4a5568;
}

.btn-save {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 0.95rem;
}

.btn-save:hover {
    background: linear-gradient(135deg, #218838, #1ba085);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-reset {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 0.95rem;
}

.btn-reset:hover {
    background: linear-gradient(135deg, #545b62, #343a40);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

/* Branding Messages */
.branding-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: bold;
    text-align: center;
    animation: slideInDown 0.5s ease;
}

.branding-message.success {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 2px solid #28a745;
}

.branding-message.info {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
    border: 2px solid #17a2b8;
}

body.dark-mode .branding-message.success {
    background: rgba(40, 167, 69, 0.2);
    color: #5cbf2a;
}

body.dark-mode .branding-message.info {
    background: rgba(23, 162, 184, 0.2);
    color: #5bc0de;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==== ACHIEVEMENTS PANEL ==== */
.achievements-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 16px;
    padding: 25px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

body.dark-mode .achievements-panel {
    background: #1e293b;
    border-color: #4a5568;
    color: #e0e6ed;
}

.points-display {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.achievement-card {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.achievement-card.earned {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-color: var(--brand-primary);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.achievement-card.locked {
    opacity: 0.6;
    filter: grayscale(50%);
}

body.dark-mode .achievement-card {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .achievement-card.earned {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
}

.achievement-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.achievement-name {
    font-weight: bold;
    color: #495057;
    margin-bottom: 8px;
}

body.dark-mode .achievement-name {
    color: #e0e6ed;
}

.achievement-description {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 10px;
    line-height: 1.4;
}

body.dark-mode .achievement-description {
    color: #a0aec0;
}

.achievement-points {
    background: var(--brand-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
}

/* ==== ACHIEVEMENT NOTIFICATIONS ==== */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.5s ease;
    max-width: 350px;
}

.achievement-notification.show {
    transform: translateX(0);
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.achievement-notification .achievement-icon {
    font-size: 2.5rem;
    animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.achievement-title {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.achievement-notification .achievement-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
}

.achievement-notification .achievement-points {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* ==== ENHANCED BUTTONS WITH BRANDING ==== */
.btn-reveal,
.btn-clear {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border: none;
    color: white;
}

.btn-reveal:hover,
.btn-clear:hover {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--brand-primary) 80%, black),
        color-mix(in srgb, var(--brand-secondary) 80%, black)
    );
}

/* ==== SESSION REPORTS STYLING ==== */
.report-generating {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid var(--brand-primary);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

body.dark-mode .report-generating {
    background: #1e293b;
    color: #e0e6ed;
}

.report-generating .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--brand-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* ==== RESPONSIVE DESIGN ==== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-content {
        justify-content: center;
    }
    
    .branding-panel,
    .achievements-panel {
        padding: 20px;
        max-width: 90%;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .achievement-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .achievement-notification.show {
        transform: translateY(0);
    }
    
    .qr-code-section {
        padding: 15px;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .btn-icon {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .achievement-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .branding-section input[type="color"] {
        height: 40px;
    }
}

/* ==== OVERLAY FOR MODALS ==== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.modal-overlay.show {
    display: block;
}

/* ==== ENHANCED CLOSE BUTTONS ==== */
.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(108, 117, 125, 0.1);
    color: #495057;
    transform: scale(1.1);
}

body.dark-mode .close-btn {
    color: #a0aec0;
}

body.dark-mode .close-btn:hover {
    background: rgba(160, 174, 192, 0.1);
    color: #e0e6ed;
}

/* ==== LOADING ANIMATIONS ==== */
.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse-glow {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px var(--brand-primary);
    }
    50% {
        box-shadow: 0 0 20px var(--brand-primary), 0 0 30px var(--brand-primary);
    }
}