/**
 * 🎮 De Dagelijkse Bureau-Escape - Styling
 * ==========================================
 * Kantoor Chaos Aesthetic
 */

/* ===== CSS VARIABLES ===== */
:root {
    --paper-white: #f9f7f1;
    --ink-black: #2c2c2c;
    --post-it-yellow: #fff7a0;
    --post-it-blue: #a0d8ff;
    --post-it-green: #c7f5c7;
    --post-it-pink: #ffc0cb;
    --stamp-red: #d32f2f;
    --typewriter-gray: #4a4a4a;
    --success-green: #4caf50;
    --warning-orange: #ff9800;
    --error-red: #f44336;
    --boss-excel: #217346;
}

/* ===== RESET & BASICS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    color: var(--ink-black);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* Paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            rgba(0,0,0,0.02) 0px,
            transparent 1px,
            transparent 2px,
            rgba(0,0,0,0.02) 3px
        );
    pointer-events: none;
    z-index: 1;
}

#game-container {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== TYPOGRAPHY ===== */
.title-typewriter {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 3rem;
    color: var(--typewriter-gray);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
    margin-bottom: 10px;
    line-height: 1.2;
}

.subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

/* ===== SCREENS ===== */
.screen {
    background: var(--paper-white);
    border-radius: 8px;
    box-shadow: 
        0 10px 40px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.8);
    padding: 40px;
    position: relative;
    animation: slideIn 0.5s ease;
}

.screen.hidden {
    display: none;
}

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

/* ===== HOME SCREEN ===== */
.dossier-header {
    text-align: center;
    padding: 40px 20px;
    position: relative;
}

.stamp {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--stamp-red);
    color: white;
    font-family: 'Archivo Black', sans-serif;
    font-size: 1.5rem;
    padding: 10px 25px;
    border: 4px solid var(--stamp-red);
    transform: rotate(15deg);
    opacity: 0.85;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    letter-spacing: 3px;
}

.success-stamp {
    background: var(--success-green);
    border-color: var(--success-green);
}

.timeout-stamp {
    background: var(--error-red);
    border-color: var(--error-red);
}

/* Paper clips decoration */
.paper-clip {
    position: absolute;
    width: 60px;
    height: 80px;
    border: 4px solid #8b8b8b;
    border-radius: 20px 20px 0 0;
    opacity: 0.6;
    z-index: 10;
}

.paper-clip.top-left {
    top: -20px;
    left: 40px;
    transform: rotate(-15deg);
}

.paper-clip.top-right {
    top: -20px;
    right: 40px;
    transform: rotate(15deg);
}

/* Story box */
.story-box {
    background: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: relative;
}

.story-box::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 30px;
    width: 40px;
    height: 20px;
    background: #ffc107;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.story-box h2 {
    font-family: 'Special Elite', monospace;
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--typewriter-gray);
}

.story-box .highlight {
    background: var(--post-it-yellow);
    padding: 10px 15px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 10px;
    font-weight: 600;
    border: 2px dashed #ffd54f;
}

/* Post-it notes */
.post-it {
    background: var(--post-it-yellow);
    padding: 20px;
    margin: 20px 0;
    border-radius: 2px;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.15),
        inset 0 -2px 0 rgba(0,0,0,0.1);
    transform: rotate(-1deg);
    position: relative;
}

.post-it::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.3) 0%,
        transparent 100%
    );
}

.post-it.blue {
    background: var(--post-it-blue);
    transform: rotate(1deg);
}

.post-it.green {
    background: var(--post-it-green);
    transform: rotate(-0.5deg);
}

.post-it h3 {
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--ink-black);
}

.post-it ul {
    list-style: none;
    margin-left: 0;
}

.post-it li {
    padding: 5px 0;
    position: relative;
    padding-left: 25px;
}

.post-it li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-green);
    font-weight: bold;
}

/* Email input */
.email-input-box {
    background: white;
    border: 3px solid var(--ink-black);
    padding: 30px;
    margin: 30px 0;
    border-radius: 8px;
    text-align: center;
}

.email-input-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.email-input-box input[type="email"] {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    font-size: 1rem;
    font-family: 'IBM Plex Mono', monospace;
    border: 2px solid #ccc;
    border-radius: 6px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.email-input-box input[type="email"]:focus {
    outline: none;
    border-color: var(--boss-excel);
}

.legal-note {
    font-size: 0.85rem;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

/* ===== BUTTONS ===== */
.btn-primary,
.btn-secondary {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary {
    background: var(--boss-excel);
    color: white;
}

.btn-primary:hover {
    background: #1a5c37;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* ===== GAME SCREEN ===== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 3px solid var(--ink-black);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.timer-box,
.progress-box {
    text-align: center;
}

.timer-box .label,
.progress-box .label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timer {
    font-family: 'Archivo Black', sans-serif;
    font-size: 2.5rem;
    color: var(--boss-excel);
    margin-top: 5px;
}

.timer.caution {
    color: var(--warning-orange);
}

.timer.warning {
    color: var(--error-red);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.progress {
    font-family: 'Archivo Black', sans-serif;
    font-size: 2rem;
    color: var(--ink-black);
    margin-top: 5px;
}

.boss-key-btn {
    background: #424242;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    transition: all 0.3s;
}

.boss-key-btn:hover {
    background: #333;
    transform: scale(1.05);
}

/* Story intro */
.story-intro {
    margin-bottom: 30px;
}

.story-bubble {
    background: var(--post-it-blue);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #81c9f7;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* ===== PUZZLES ===== */
.puzzles-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.puzzle-card {
    background: white;
    border: 3px solid var(--ink-black);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
    transition: all 0.3s;
    position: relative;
}

.puzzle-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.puzzle-card.solved {
    border-color: var(--success-green);
    background: linear-gradient(to bottom, white 0%, #e8f5e9 100%);
}

.puzzle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px dashed #ccc;
}

.puzzle-number {
    font-family: 'Archivo Black', sans-serif;
    font-size: 1.2rem;
    color: var(--ink-black);
}

.puzzle-difficulty {
    font-size: 0.9rem;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.puzzle-difficulty.easy {
    background: #c8e6c9;
    color: #2e7d32;
}

.puzzle-difficulty.medium {
    background: #fff9c4;
    color: #f57f17;
}

.puzzle-difficulty.hard {
    background: #ffcdd2;
    color: #c62828;
}

.puzzle-status {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    background: #e0e0e0;
    color: #666;
}

.puzzle-status.solved {
    background: var(--success-green);
    color: white;
}

.puzzle-question {
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 20px 0;
    padding: 20px;
    background: #fafafa;
    border-left: 4px solid var(--boss-excel);
    border-radius: 4px;
    min-height: 120px;
}

.puzzle-input {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.puzzle-input input {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    font-family: 'IBM Plex Mono', monospace;
    border: 2px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.3s;
}

.puzzle-input input:focus {
    outline: none;
    border-color: var(--boss-excel);
}

.puzzle-input input:disabled {
    background: #f5f5f5;
    color: #999;
}

.btn-answer {
    padding: 12px 25px;
    background: var(--boss-excel);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-answer:hover:not(:disabled) {
    background: #1a5c37;
    transform: translateX(3px);
}

.btn-answer:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Hints */
.puzzle-hints {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.btn-hint {
    padding: 10px 18px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-hint:hover:not(.used):not(:disabled) {
    background: #f57c00;
    transform: scale(1.05);
}

.btn-hint.used {
    background: #9e9e9e;
    cursor: default;
}

.btn-hint:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.hint-display {
    margin-top: 15px;
}

.hint-item {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 12px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 0.95rem;
}

.attempts-info {
    margin-top: 10px;
    font-size: 0.9rem;
}

.attempts-text {
    color: var(--error-red);
    font-weight: 600;
}

/* ===== ALERTS ===== */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.alert {
    background: white;
    border-left: 6px solid;
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-weight: 600;
    animation: slideInRight 0.3s ease;
    opacity: 1;
    transition: opacity 0.3s;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    border-color: var(--success-green);
    color: var(--success-green);
}

.alert-error {
    border-color: var(--error-red);
    color: var(--error-red);
}

.alert-warning {
    border-color: var(--warning-orange);
    color: var(--warning-orange);
}

.alert-info {
    border-color: #2196f3;
    color: #2196f3;
}

/* ===== RESULTS SCREEN ===== */
.results-dossier {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.results-dossier h1 {
    font-family: 'Archivo Black', sans-serif;
    font-size: 3rem;
    color: var(--boss-excel);
    margin: 30px 0;
}

.results-story {
    background: var(--post-it-green);
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
    font-size: 1.1rem;
    line-height: 1.8;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 40px 0;
}

.stat-box {
    background: white;
    border: 3px solid var(--ink-black);
    border-radius: 10px;
    padding: 25px 40px;
    min-width: 150px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-family: 'Archivo Black', sans-serif;
    font-size: 2.5rem;
    color: var(--ink-black);
    margin-top: 10px;
}

/* Points breakdown */
.points-breakdown {
    background: white;
    border: 3px solid var(--ink-black);
    border-radius: 10px;
    padding: 30px;
    margin: 40px 0;
    text-align: left;
}

.points-breakdown h2 {
    font-family: 'Special Elite', monospace;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.points-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'IBM Plex Mono', monospace;
}

.points-table tr {
    border-bottom: 1px solid #e0e0e0;
}

.points-table tr:last-child {
    border-bottom: none;
}

.points-table td {
    padding: 15px 10px;
    font-size: 1rem;
}

.points-value {
    text-align: right;
    font-weight: 600;
    font-size: 1.2rem;
}

.points-value.positive {
    color: var(--success-green);
}

.points-value.negative {
    color: var(--error-red);
}

.points-value.neutral {
    color: #666;
}

.total-row {
    border-top: 3px solid var(--ink-black);
    font-size: 1.1rem;
}

.total-row td {
    padding-top: 20px;
    padding-bottom: 20px;
}

.points-message {
    margin-top: 30px;
}

/* Results actions */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

/* ===== BOSS-KEY SCREEN ===== */
#boss-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    z-index: 9999;
    overflow: auto;
}

.fake-excel {
    width: 100%;
    height: 100%;
    background: white;
    font-family: 'Calibri', 'Arial', sans-serif;
}

.excel-toolbar {
    background: var(--boss-excel);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.excel-buttons {
    display: flex;
    gap: 15px;
}

.excel-btn {
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.excel-btn:hover {
    opacity: 1;
}

.excel-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.excel-grid {
    margin: 30px;
    width: calc(100% - 60px);
    border-collapse: collapse;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.excel-grid th,
.excel-grid td {
    border: 1px solid #d0d0d0;
    padding: 12px 20px;
    text-align: left;
}

.excel-grid th {
    background: #f3f3f3;
    font-weight: 600;
    color: #333;
}

.excel-grid tr:nth-child(even) {
    background: #fafafa;
}

.excel-grid tr:hover {
    background: #f0f0f0;
}

.excel-total {
    background: #e8f5e9 !important;
    font-weight: 600;
}

.boss-hint {
    text-align: center;
    margin-top: 40px;
    font-size: 1.1rem;
    color: #666;
}

.boss-hint kbd {
    background: #333;
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    margin: 0 5px;
}

/* ===== LOADING OVERLAY ===== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-spinner p {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    font-weight: 600;
}

/* ===== FOOTER ===== */
.footer-links {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px dashed #ccc;
}

.footer-links a {
    color: var(--boss-excel);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.footer-links a:hover {
    color: #1a5c37;
    text-decoration: underline;
}

/* ===== TIMEOUT SCREEN ===== */
.timeout-message {
    background: #fff3e0;
    border: 2px solid var(--warning-orange);
    border-radius: 10px;
    padding: 30px;
    margin: 30px 0;
    font-size: 1.1rem;
    line-height: 1.8;
}

.timeout-message .highlight {
    background: var(--post-it-yellow);
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    margin-top: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .title-typewriter {
        font-size: 2rem;
    }
    
    .puzzles-container {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .results-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .screen {
        padding: 20px;
    }
    
    .puzzle-input {
        flex-direction: column;
    }
    
    .btn-answer {
        width: 100%;
    }
    
    .alert-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}
