@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    /* Colors Ligh Mode Cyberpunk */
    --bg-color: #f4f6fa;
    --text-main: #1e293b;
    --panel-bg: #ffffff;
    
    --neon-cyan: #00b4d8;
    --neon-magenta: #e81cff;
    --neon-yellow: #f59e0b;
    
    --border-glow-cyan: 0 4px 15px rgba(0, 180, 216, 0.15);
    --border-glow-magenta: 0 4px 15px rgba(232, 28, 255, 0.15);
    
    --grid-bg: 
        linear-gradient(rgba(0, 180, 216, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 180, 216, 0.1) 1px, transparent 1px);
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    font-family: Calibri, 'Segoe UI', sans-serif;
    color: var(--text-main);
    overflow: hidden; 
    position: relative;
    font-size: 14.5px;
}

/* Fons reixa clara */
body::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--grid-bg);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
}

/* -------------------------------------
   PANTALLA 1: PORTAL D'AUTENTICACIÓ
------------------------------------- */

#auth-portal {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
}

.auth-box {
    background: var(--panel-bg);
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 2px solid #e2e8f0;
    text-align: center;
    width: 400px;
    position: relative;
    border-radius: 4px;
}

.auth-box::before {
    content: "";
    position: absolute;
    top: -2px; left: -2px; right: -2px; height: 4px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
}

.auth-box h1 {
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 1.5em;
    border-bottom: 2px dashed #cbd5e1;
    padding-bottom: 10px;
}

.input-group {
    margin-bottom: 25px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85em;
    color: var(--text-main);
    font-weight: bold;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1em;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--neon-cyan);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

.btn-submit {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background: var(--text-main);
    color: #fff;
    border: none;
    font-family: inherit;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.btn-submit:hover {
    background: var(--neon-cyan);
    box-shadow: var(--border-glow-cyan);
}


/* -------------------------------------
   PANTALLA 2: DASHBOARD (2 Columnes)
------------------------------------- */

#main-dashboard {
    height: 100vh;
    padding: 15px;
    gap: 15px;
    display: flex; /* canviarà en JS a grid/flex actiu */
}

/* Base Panel */
.panel {
    background: var(--panel-bg);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.panel-header {
    background: #f8fafc;
    padding: 10px 15px;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.95em;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-cyan { color: var(--neon-cyan); }
.text-magenta { color: var(--neon-magenta); }

.panel-content {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}

/* Columna Esquerra (Didàctica) */
.col-left {
    flex: 1; /* 50% aprox */
    display: flex;
    flex-direction: column;
}

/* Columna Dreta (Xat + Avaluació) */
.col-right {
    flex: 1; /* 50% aprox */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Top dret 40%, Bottom dret 60% */
.chat-row { flex: 4; }
.eval-row { flex: 6; }


/* Controls Didàctics */
.didactic-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
}

.btn-nav {
    background: #fff;
    border: 1px solid #cbd5e1;
    padding: 8px 15px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-nav:hover:not(:disabled) {
    background: var(--neon-cyan);
    color: #fff;
    border-color: var(--neon-cyan);
}
.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.topic-indicator {
    font-weight: bold;
    color: #64748b;
}

/* Estil Contingut Didàctic */
.didactic-content {
    line-height: 1.6;
    font-size: 1.1em;
}
.didactic-content h2 { margin-top: 0; color: var(--neon-cyan); border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; }


/* Chatbox (1/3 Right) */
.chat-history {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    height: 100px; /* Min height to enforce flex shrink mechanics */
    overflow-y: auto;
}

.msg {
    padding: 6px 12px;
    max-width: 90%;
    word-wrap: break-word;
    border-radius: 4px;
    line-height: 1.4;
}

.msg.sys {
    background: #f0f9ff;
    border-left: 3px solid var(--neon-cyan);
    align-self: flex-start;
}

.msg.user {
    background: #f1f5f9;
    border-right: 3px solid #64748b;
    align-self: flex-end;
    text-align: right;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}
.chat-input-area input {
    flex: 1;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 10px;
    font-family: inherit;
    outline: none;
}
.chat-input-area input:focus { border-color: var(--neon-cyan); }
.chat-input-area button {
    background: var(--text-main);
    color: #fff;
    border: none;
    padding: 0 15px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
}
.chat-input-area button:hover { background: var(--neon-cyan); }


/* Avaluació (2/3 Right) */
.question-block {
    margin-bottom: 20px;
    padding: 15px;
    background: #fafafa;
    border-left: 4px solid var(--neon-magenta);
    border-radius: 0 4px 4px 0;
}
.question-text {
    font-size: 1.05em;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 12px;
}
.options-list {
    list-style: none;
    padding: 0; margin: 0;
}
.options-list li { margin-bottom: 8px; }
.options-list label {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.options-list input[type="radio"] { margin-right: 10px; accent-color: var(--neon-magenta); }

textarea {
    width: 100%; height: 80px;
    border: 1px solid #cbd5e1;
    padding: 10px; font-family: inherit;
    font-size: 0.95em; resize: none; background: #fff;
}
textarea:focus { outline: none; border-color: var(--neon-magenta); }

.eval-actions {
    display: flex;
    justify-content: flex-end; /* Alineat a la dreta */
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #cbd5e1;
}

.btn-finish {
    background: transparent;
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    padding: 12px 30px; 
    font-weight: bold; 
    cursor: pointer; 
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.btn-finish:hover { 
    background: var(--neon-cyan); 
    color: #fff; 
    box-shadow: 0 0 15px rgba(0, 180, 216, 0.4);
    transform: translateY(-2px);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-cyan); }

/* -------------------------------------
   PANTALLA 3: TRANSICIÓ CINEMATOGRÀFICA
------------------------------------- */
#transition-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: var(--neon-cyan);
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}
#transition-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.warp-effect {
    width: 100px;
    height: 100px;
    border: 4px solid rgba(0, 180, 216, 0.2);
    border-top: 4px solid var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 30px;
    box-shadow: 0 0 20px rgba(0, 180, 216, 0.4);
}
@keyframes spin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); box-shadow: 0 0 40px rgba(232, 28, 255, 0.6); border-top-color: var(--neon-magenta); }
    100% { transform: rotate(360deg) scale(1); }
}
#transition-text {
    letter-spacing: 5px;
    font-size: 2em;
    text-shadow: 0 0 10px rgba(0, 180, 216, 0.5);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
