/* ============================================================
   MAIA - Estilos de la aplicación
   ============================================================ */

:root {
    --primary: #2c5282;
    --primary-light: #3182ce;
    --primary-dark: #1a365d;
    --success: #276749;
    --danger: #c53030;
    --warning: #c05621;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --dominant: #ebf4ff;
    --dominant-border: #3182ce;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* --- Nav --- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: var(--primary-dark);
    color: white;
}
.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    letter-spacing: 2px;
}
.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.9rem;
}
.nav-links a:hover { color: white; }

/* --- Container --- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}
.small { font-size: 0.8rem; color: var(--text-light); }

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 2rem 0 1.5rem;
}
.hero h1 { font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--primary-dark); }
.hero p { color: var(--text-light); max-width: 600px; margin: 0 auto; }

/* --- Cards --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card h2 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--primary); }
.card p { color: var(--text-light); font-size: 0.9rem; margin-bottom: 1rem; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-small { padding: 0.25rem 0.7rem; font-size: 0.8rem; }
.btn-large { padding: 0.75rem 2rem; font-size: 1.05rem; }

/* --- Alerts --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-success { background: #c6f6d5; color: var(--success); }
.alert-error { background: #fed7d7; color: var(--danger); }
.alert-warning { background: #fefcbf; color: var(--warning); }

/* --- Forms --- */
.form-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.form-section h2 {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.instruction {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-style: italic;
}
.subtitle { color: var(--text-light); margin-bottom: 1.5rem; }

.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}
.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}
.form-group.inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.form-group.inline select { width: auto; }

.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* --- Questions --- */
.box-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
}
.dimension-label {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-left: auto;
}

.questions-list { display: flex; flex-direction: column; gap: 0.5rem; }
.question-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.question-text {
    flex: 1;
    font-size: 0.9rem;
    cursor: default;
}
.q-num {
    display: inline-block;
    font-weight: 700;
    color: var(--primary);
    min-width: 2.5rem;
}
.score-input input {
    width: 65px;
    text-align: center;
    font-size: 1rem;
    padding: 0.4rem;
    border: 2px solid var(--border);
    border-radius: 4px;
}
.score-input input:focus {
    border-color: var(--primary-light);
    outline: none;
}

/* --- Matrix tables --- */
.matrix-section { margin: 2rem 0; }
.matrix-section h2 { margin-bottom: 1rem; }
.matrix-preview { display: flex; justify-content: center; margin: 1.5rem 0; }

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}
.matrix-table th, .matrix-table td {
    border: 1px solid var(--border);
    padding: 0.75rem;
    text-align: center;
    font-size: 0.9rem;
}
.matrix-table th {
    background: #edf2f7;
    font-weight: 600;
    font-size: 0.85rem;
}
.matrix-table td { position: relative; }

.results-matrix .box-num {
    display: block;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.8rem;
}
.results-matrix .box-avg {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 0.2rem;
}
.results-matrix td.dominant {
    background: var(--dominant);
    border: 2px solid var(--dominant-border);
}

.expanded-matrix .subcats {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin: 0.3rem 0;
}
.subcat {
    display: inline-block;
    background: #edf2f7;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
}
.expanded-matrix .box-avg { font-size: 1.1rem; }

.matrix-legend {
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.compact .matrix-table th,
.compact .matrix-table td { padding: 0.4rem; }
.compact .results-matrix .box-avg { font-size: 1rem; }

/* --- Data table --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    font-size: 0.85rem;
}
.data-table th, .data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.data-table th { font-weight: 600; background: #edf2f7; }
.data-table code { font-size: 0.8rem; }
.data-table .score-cell { text-align: center; font-weight: 700; min-width: 40px; }
.data-table .q-id { color: var(--primary); font-weight: 600; width: 40px; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-pending { background: #fefcbf; color: #744210; }
.badge-approved { background: #c6f6d5; color: #276749; }
.badge-rejected { background: #fed7d7; color: #9b2c2c; }

/* --- Stats --- */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}
.stat {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    text-align: center;
}
.stat-num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-light); }

/* --- Admin --- */
.admin-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.review-demo {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}
.demo-item { font-size: 0.85rem; }
.review-quadrant { margin-bottom: 1rem; }
.review-quadrant h3 {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* --- Result highlight --- */
.result-highlight {
    background: linear-gradient(135deg, #ebf8ff, #e9d8fd);
    border: 1px solid #b794f4;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}
.result-highlight h2 { color: var(--primary-dark); font-size: 1.4rem; margin-bottom: 0.5rem; }
.result-highlight.compact { padding: 1rem; }
.result-highlight.compact h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
.emphasis-label { font-size: 0.95rem; }
.tendency { font-size: 0.95rem; color: var(--primary); }
.description { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text); }

/* --- 10 types diagram --- */
.types-section { margin: 2rem 0; }
.types-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}
.types-row { display: flex; gap: 0.5rem; }
.type-box {
    width: 80px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--card-bg);
}
.type-box.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
    transform: scale(1.1);
}
.tendency-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 350px;
    margin: 0.5rem auto 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
}

/* --- Segment results --- */
.segment-results { margin: 2rem 0; }
.segment-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.segment-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.segment-card small { color: var(--text-light); }

/* --- Centered message --- */
.centered-message {
    text-align: center;
    padding: 3rem 1rem;
}
.centered-message h1 { margin-bottom: 1rem; }
.centered-message p { margin-bottom: 0.75rem; }

.login-form {
    max-width: 300px;
    margin: 1rem auto;
}

/* --- Report --- */
.report-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}
.report-header h1 { color: var(--primary-dark); }
.report-meta { color: var(--text-light); font-size: 0.85rem; margin-top: 0.5rem; }
.report-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* --- Info section --- */
.info-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
}
.info-section h2 { text-align: center; margin-bottom: 1rem; color: var(--primary-dark); }
.info-section p { text-align: center; color: var(--text-light); font-size: 0.9rem; }

/* --- Responsive --- */
@media (max-width: 600px) {
    .navbar { padding: 0.5rem 1rem; flex-wrap: wrap; }
    .container { padding: 1rem 0.75rem; }
    .hero h1 { font-size: 1.3rem; }
    .question-row { flex-direction: column; align-items: flex-start; }
    .score-input { align-self: flex-end; }
    .demo-grid { grid-template-columns: 1fr; }
    .stats-bar { flex-direction: column; }
    .types-row { flex-wrap: wrap; justify-content: center; }
    .tendency-labels { flex-direction: column; align-items: center; text-align: center; }
}

/* --- Print --- */
@media print {
    .navbar, .footer, .form-actions, .btn, .admin-actions, .segment-form { display: none; }
    .container { max-width: 100%; }
    .result-highlight { background: #f0f0ff; }
    .matrix-table td.dominant { background: #e0e0ff; }
}
