:root {
    /* PALETA VISUAL - DESIGN SYSTEM */
    --bg-app: #131313;
    --bg-card: #1E1E1E;
    --bg-input: #2C2C2C;
    --primary: #8B2CF5;
    --primary-hover: #7A20D6;
    --primary-light: #A855F7;
    --text-main: #FFFFFF;
    --text-sec: #A0A0A0;
    
    --accent-success: #00E676;
    --accent-error: #FF5252;

    /* Colores Placas */
    --plate-std: #E0E0E0; 
    --plate-h1: #81C784; 
    --plate-foc: #E57373; 
    --plate-gd: #FFF176;

    /* Variables UI */
    --radius-card: 20px;
    --radius-btn: 14px;
    --radius-input: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    padding: 20px;
    min-height: 100vh;
    display: flex; flex-direction: column;
    max-width: 500px; margin: 0 auto;
}

h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 5px; }
h2 { font-size: 1.4rem; font-weight: 600; margin-bottom: 20px; }
p { color: var(--text-sec); font-size: 0.95rem; }
label { font-size: 0.85rem; color: var(--text-sec); margin-bottom: 8px; margin-top: 18px; display: block; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

.view { display: none; opacity: 0; transition: opacity 0.3s ease; flex-grow: 1; }
.view.active { display: flex; flex-direction: column; opacity: 1; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

header { margin-bottom: 30px; margin-top: 10px; }
.profile-icon { float: right; background: var(--bg-card); padding: 8px; border-radius: 50%; color: var(--text-main); }

.grid-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.card-btn {
    background: var(--bg-card); border: 1px solid #333; border-radius: var(--radius-card);
    padding: 20px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
    cursor: pointer; height: 140px; transition: all 0.2s ease; position: relative; overflow: hidden;
}
.card-btn:active { transform: scale(0.96); background: #252525; }
.card-btn .icon { font-size: 2rem; color: var(--text-main); background: rgba(255,255,255,0.1); padding: 10px; border-radius: 12px; margin-bottom: 15px; }
.card-btn span { font-size: 1rem; font-weight: 600; color: var(--text-main); line-height: 1.2; }
.card-btn.wide { grid-column: span 2; height: auto; flex-direction: row; align-items: center; gap: 15px; }
.card-btn.wide .icon { margin-bottom: 0; }

#project-status {
    background: linear-gradient(135deg, #2a2a2a 0%, #1E1E1E 100%);
    padding: 20px; border-radius: var(--radius-card); margin-top: 30px; border: 1px solid #333;
    display: none; position: relative;
}
#project-status::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); border-radius: 4px 0 0 4px; }

.btn-main, .btn-view-project {
    background: var(--primary); color: #fff; border: none; padding: 18px; width: 100%; border-radius: var(--radius-btn);
    font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: 25px;
    box-shadow: 0 4px 15px rgba(139, 44, 245, 0.3); transition: background 0.2s, transform 0.1s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-main:active, .btn-view-project:active { background: var(--primary-hover); transform: scale(0.98); }

.form-container { background: var(--bg-app); padding-bottom: 40px; }
input[type="text"], input[type="number"] {
    background: var(--bg-input); border: 1px solid transparent; padding: 16px; border-radius: var(--radius-input);
    color: var(--text-main); font-size: 1rem; width: 100%; font-weight: 500; transition: all 0.2s;
}
input:focus { border-color: var(--primary); background: #333; }

.toggle-group { background: var(--bg-input); padding: 4px; border-radius: var(--radius-btn); display: flex; margin-bottom: 20px; }
.btn-toggle-side { flex: 1; background: transparent; border: none; color: var(--text-sec); padding: 12px; border-radius: 10px; cursor: pointer; font-weight: 500; transition: 0.2s; }
.btn-toggle-side.active { background: var(--primary); color: white; font-weight: 600; }

.layer-box { background: var(--bg-card); border: 1px solid #333; border-radius: var(--radius-card); padding: 20px; margin-bottom: 15px; }
.layer-title { font-size: 0.8rem; color: var(--primary-light); text-transform: uppercase; font-weight: 700; margin-bottom: 15px; letter-spacing: 1px; }

select.plate-selector {
    appearance: none; background: var(--bg-input); color: var(--text-main); border: none;
    padding: 14px; border-radius: var(--radius-input); width: 100%; font-size: 0.95rem;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2082.2c3.6-3.6%205.4-7.8%205.4-12.8%200-5-1.8-9.3-5.4-12.9z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat; background-position: right 15px top 50%; background-size: 10px auto;
}
.plate-std { border-left: 4px solid var(--plate-std) !important; }
.plate-h1 { border-left: 4px solid var(--plate-h1) !important; }
.plate-foc { border-left: 4px solid var(--plate-foc) !important; }
.plate-gd { border-left: 4px solid var(--plate-gd) !important; }

.options-group { background: var(--bg-card); padding: 20px; border-radius: var(--radius-card); margin-top: 25px; }
.chk-row { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; padding: 5px 0; }
input[type="checkbox"] { appearance: none; width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--text-sec); background: transparent; cursor: pointer; position: relative; }
input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
input[type="checkbox"]:checked::after { content: '✔'; color: white; position: absolute; left: 5px; top: 0px; font-size: 14px; }
label.chk-label { margin: 0; color: var(--text-main); font-weight: 500; cursor: pointer; text-transform: none; font-size: 1rem; }

.header-back { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.btn-icon-back { background: none; border: none; color: var(--text-sec); font-size: 1.5rem; cursor: pointer; }
.result-card { background: var(--bg-card); border-radius: var(--radius-card); overflow: hidden; margin-bottom: 20px; }
#result-list { list-style: none; padding: 0; }
#result-list li { padding: 18px 20px; border-bottom: 1px solid #2C2C2C; display: flex; justify-content: space-between; align-items: center; }
#result-list li:last-child { border-bottom: none; }
.item-header { background: #252525; color: var(--primary-light); padding: 10px 15px; font-weight: 700; font-size: 0.9rem; border-radius: 8px; margin: 15px 15px 5px 15px; }
.mat-name { font-size: 0.95rem; color: var(--text-sec); }
.mat-qty { font-size: 1.1rem; color: var(--text-main); font-weight: 600; }

.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.btn-export { padding: 15px; border: none; border-radius: var(--radius-btn); font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-export.pdf { background: #3c1515; color: #ff8a80; border: 1px solid #5c1b1b; }
.btn-export.excel { background: #1b3a28; color: #a5d6a7; border: 1px solid #2e5c40; }
.btn-secondary { background: transparent; color: var(--text-sec); border: 1px solid #333; width: 100%; padding: 15px; border-radius: var(--radius-btn); cursor: pointer; }
.alert-box { background: rgba(255, 82, 82, 0.1); color: #FF8A80; padding: 15px; border-radius: 12px; margin-top: 15px; font-size: 0.9rem; display: none; align-items: center; gap: 10px; border: 1px solid rgba(255, 82, 82, 0.2); }

/* --- ESTILOS DE HERRAMIENTAS (NUEVO) --- */
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.tool-card {
    background: var(--bg-card); border: 1px solid #333; border-radius: 16px;
    text-decoration: none; overflow: hidden; transition: transform 0.2s; display: flex; flex-direction: column;
}
.tool-card:active { transform: scale(0.97); }
.tool-img {
    width: 100%;
    height: 140px;
    object-fit: contain; /* Para que se vea la herramienta entera */
    background: #f5f5f5; /* Fondo gris claro para resaltar la herramienta */
    padding: 10px;
}
.tool-info { padding: 15px; display: flex; flex-direction: column; flex-grow: 1; }
.tool-info h3 { color: var(--text-main); font-size: 0.95rem; margin-bottom: 5px; line-height: 1.2; }
.tool-info p { color: var(--text-sec); font-size: 0.75rem; margin-bottom: 12px; flex-grow: 1; }
.tool-btn {
    background: #FF9900; color: black; font-weight: 700; font-size: 0.8rem;
    padding: 8px; border-radius: 8px; text-align: center; margin-top: auto;
}
/* === ESTILOS DEL MURO DE DUDAS (CHAT) === */

/* El contenedor de cada mensaje */
.qa-card {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* La cabecera del mensaje (Nombre y Fecha) */
.qa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.qa-user {
    color: var(--primary-light); /* Violeta claro */
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qa-date {
    color: var(--text-sec);
    font-size: 0.75rem;
}

/* El texto de la pregunta */
.qa-text {
    color: #E2E8F0;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* La respuesta del Experto (TÚ) */
.qa-reply-box {
    margin-top: 15px;
    background: rgba(16, 185, 129, 0.08); /* Fondo verde muy sutil */
    border-left: 3px solid var(--accent-success); /* Borde verde */
    padding: 12px 15px;
    border-radius: 0 12px 12px 12px;
}

.qa-reply-label {
    color: var(--accent-success);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}
/* =========================================
   ESTILOS MURO DE DUDAS (Fix Visual)
   ========================================= */

/* 1. Arreglar el cuadro de texto (Textarea) */
#qa-text {
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid transparent;
    border-radius: var(--radius-input);
    padding: 16px;
    font-family: 'Inter', sans-serif; /* Quita la letra fea */
    font-size: 1rem;
    width: 100%;
    resize: none; /* Que no se pueda estirar feo */
    transition: all 0.2s;
    margin-bottom: 15px;
}

#qa-text:focus {
    border-color: var(--primary);
    background: #333;
    outline: none;
}

/* 2. Estilo de las tarjetas de preguntas (Chat) */
.qa-card {
    background-color: var(--bg-card);
    border: 1px solid #333;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.qa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.qa-name {
    color: var(--primary-light);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex; align-items: center; gap: 6px;
}

.qa-date {
    font-size: 0.75rem;
    color: var(--text-sec);
}

.qa-body {
    color: #E0E0E0;
    line-height: 1.5;
    font-size: 0.95rem;
}

/* 3. Estilo de la respuesta del experto */
.qa-reply {
    margin-top: 15px;
    background: rgba(46, 204, 113, 0.1); /* Verde muy suave transparente */
    border-left: 3px solid var(--accent-success);
    padding: 12px;
    border-radius: 0 8px 8px 8px;
}
.qa-reply strong {
    color: var(--accent-success);
    font-size: 0.8rem;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}
