/* ============================================
   GLOBAL STYLES
   ============================================ */

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.2);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--light-bg);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
	padding-bottom: 10px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    transition: var(--transition);
    font-weight: 500;
    border-radius: 8px;
    padding: 10px 20px;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-xl {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    background: white;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

.card-header.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-bottom: none;
}

/* ============================================
   LIST CARDS
   ============================================ */

.list-card {
    cursor: pointer;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.list-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.list-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--secondary-color);
}

.list-card-category {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.list-card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.list-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   GAME CARDS
   ============================================ */

.group-card {
    border-left: 5px solid var(--info-color);
    transition: var(--transition);
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.archive-card {
    border-left: 5px solid var(--text-muted);
    opacity: 0.9;
}

/* ============================================
   CODE DISPLAY
   ============================================ */

.code-display {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 3px;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    user-select: all;
}

.code-box {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.btn-new-code {
    opacity: 0.3;
    transition: var(--transition);
    position: absolute;
    top: 8px;
    right: 8px;
}

.btn-new-code:hover {
    opacity: 1;
    transform: rotate(180deg);
}

/* ============================================
   ROLE CARDS (GAME)
   ============================================ */

.card-role {
    height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    cursor: pointer;
    transition: var(--transition);
    padding: 2rem;
    text-align: center;
}

.role-hidden {
    background: var(--text-primary);
    color: white;
}

.role-visible {
    background: white;
    color: var(--text-primary);
    border: 4px solid var(--border-color);
}

.role-hidden:hover {
    background: #343a40;
}

/* ============================================
   TIMER
   ============================================ */

.timer-display {
    font-size: 5rem;
    font-weight: bold;
    text-align: center;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
}

/* ============================================
   FORMS
   ============================================ */

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.list-checkbox-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    background: white;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   BADGES & PILLS
   ============================================ */

.score-pill {
    min-width: 35px;
    display: inline-block;
    text-align: center;
    padding: 4px 8px;
}

.badge {
    padding: 6px 12px;
    font-weight: 500;
}

/* ============================================
   MODALS (CUSTOM)
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content-custom {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content-custom {
    transform: scale(1);
}

.modal-header-custom {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body-custom {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer-custom {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   ALERTS (CUSTOM)
   ============================================ */

.alert-custom {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

.alert-custom.alert-success {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.alert-custom.alert-danger {
    background: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-custom.alert-info {
    background: #d1ecf1;
    border-color: var(--info-color);
    color: #0c5460;
}

.alert-custom.alert-warning {
    background: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.spinner-custom {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================
   UTILITIES
   ============================================ */

.hover-lift {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-2px);
}

.text-truncate-2 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .code-display {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }
    
    .timer-display {
        font-size: 3.5rem;
    }
    
    .btn-xl {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .card-role {
        height: 300px;
        padding: 1.5rem;
    }
    
    .modal-content-custom {
        width: 95%;
        max-height: 90vh;
    }
}

@media (max-width: 576px) {
    .list-checkbox-container {
        max-height: 150px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .btn, .modal-overlay {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* ============================================
   AUTO-SIZE TEXT FIX VOOR ROL KAART
   ============================================ */

#roleCard {
    container-type: inline-size;
}

#roleCard #roleText {
    /* Overschrijf de standaard 'display-1' grootte */
    /* clamp(minimaal, flexibel, maximaal) */
    /* 8cqw betekent: 8% van de breedte van de kaart */
    font-size: clamp(1.2rem, 8cqw, 3rem);
    
    /* Zorg dat de tekst netjes afbreekt en niet buiten beeld loopt */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    
    /* Zorg voor een nette regelafstand bij meerdere regels */
    line-height: 1.2;
    
    /* Moderne browser feature voor mooiere verdeling van tekstregels */
    text-wrap: balance;
    
    /* Zorg dat de tekstcontainer de ruimte neemt maar niet forceert */
    width: 100%;
    margin-bottom: 0.5rem; /* Beetje ruimte voor de subtekst */
}

/* ============================================
   STYLING VOOR VERBORGEN STATUS (VRAAGTEKEN)
   ============================================ */

#roleCard.role-hidden #roleText {
    font-size: 6rem; 
    margin-bottom: 0.5rem;
}

#roleCard.role-hidden #roleSubtext {
    font-size: 1.3rem;
    font-weight: 500;
    opacity: 0.9;
}