/* ================================================================
   Strategix360 – Mobile-First Responsive CSS
   ================================================================ */

:root {
    --primary: #1a56db;
    --primary-dark: #1e40af;
    --secondary: #6b7280;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --purple: #7c3aed;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAVBAR ── */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    position: sticky; top: 0; z-index: 1000;
    box-shadow: var(--shadow-md);
}

.nav-container {
    max-width: 1320px; margin: 0 auto;
    padding: 0 1rem;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap;
}

.nav-brand {
    color: #fff; font-size: 1.15rem; font-weight: 700;
    padding: .85rem 0; display: flex; align-items: center; gap: .5rem;
}
.nav-brand:hover { text-decoration: none; opacity: .9; }

.nav-toggle {
    display: block; background: none; border: none; color: #fff;
    font-size: 1.3rem; cursor: pointer; padding: .5rem;
}

.nav-menu {
    list-style: none; display: none; width: 100%;
    flex-direction: column; padding-bottom: .5rem;
}

.nav-menu.active { display: flex; }

.nav-menu a {
    color: rgba(255,255,255,.85); padding: .7rem 1rem; font-size: .85rem;
    border-radius: 6px; transition: all .2s; display: flex; align-items: center; gap: .5rem;
}

.nav-menu a span { display: inline; }
.nav-menu a:hover, .nav-menu a.active { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.nav-logout { color: #fca5a5 !important; }
.nav-logout:hover { background: rgba(220,38,38,.3) !important; }
.nav-admin { color: #c4b5fd !important; }
.nav-admin:hover, .nav-admin.active { background: rgba(124,58,237,.3) !important; }

/* ── CONTAINER ── */
.container { max-width: 1320px; margin: 0 auto; padding: 1rem .75rem; flex: 1; }

/* ── ALERTS ── */
.alert {
    padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
    font-size: .88rem; display: flex; justify-content: space-between; align-items: flex-start;
    box-shadow: var(--shadow);
}
.alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--success); }
.alert-error   { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: .5; }
.alert-close:hover { opacity: 1; }

/* ── AUTH PAGES ── */
.auth-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 80vh; padding: 1rem;
}

.auth-card {
    background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg);
    padding: 2rem; width: 100%; max-width: 440px;
}

.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-logo { font-size: 2.2rem; color: var(--primary); margin-bottom: .3rem; display: block; }
.auth-header h1 { font-size: 1.4rem; margin-bottom: .2rem; }
.auth-header p { color: var(--text-light); font-size: .88rem; }
.auth-form { display: flex; flex-direction: column; gap: .9rem; }
.auth-footer { text-align: center; margin-top: 1.3rem; padding-top: 1.3rem; border-top: 1px solid var(--border); font-size: .88rem; }

/* ── FORMS ── */
.form-group { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 0; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    padding: .6rem .8rem; border: 2px solid var(--border); border-radius: 8px;
    font-size: .88rem; transition: border-color .2s; width: 100%; font-family: inherit;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 0; }

/* EFI/EFE form grid */
.form-row-eval { display: flex; flex-direction: column; gap: .8rem; }
.fg-desc { flex: 2 !important; }

.form-card {
    background: var(--card); border-radius: var(--radius); padding: 1.5rem;
    box-shadow: var(--shadow); margin-bottom: 1.2rem;
}
.form-card h2, .form-card h3 { margin-bottom: 1rem; color: var(--primary-dark); font-size: 1.05rem; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: .35rem; padding: .55rem 1.1rem;
    border-radius: 8px; font-size: .85rem; font-weight: 600; border: none;
    cursor: pointer; transition: all .2s; text-decoration: none !important; font-family: inherit;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }

/* ── CARDS GRID ── */
.cards-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.5rem; }

.card {
    background: var(--card); border-radius: var(--radius); padding: 1.3rem;
    box-shadow: var(--shadow); border-top: 4px solid; position: relative;
}
.card-blue { border-top-color: var(--primary); }
.card-green { border-top-color: var(--success); }
.card-orange { border-top-color: var(--warning); }
.card-purple { border-top-color: var(--purple); }

.card-icon { font-size: 1.8rem; margin-bottom: .5rem; opacity: .8; }
.card-blue .card-icon { color: var(--primary); }
.card-green .card-icon { color: var(--success); }
.card-orange .card-icon { color: var(--warning); }
.card-purple .card-icon { color: var(--purple); }
.card-info h3 { font-size: 1.3rem; margin-bottom: .1rem; }
.card-info p { color: var(--text-light); font-size: .82rem; }
.card-link { display: block; margin-top: .7rem; font-size: .82rem; font-weight: 600; }

/* ── SECTION ── */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.2rem; flex-wrap: wrap; gap: .8rem;
}
.section-header h1 { font-size: 1.3rem; width: 100%; }
.section-header p { color: var(--text-light); font-size: .88rem; width: 100%; margin-top: -.4rem; }
.section-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── CHARTS ── */
.charts-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.5rem; }

/* ── TABLE ── */
.table-responsive { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 500px; }
.table th, .table td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .82rem; }
.table th { background: #f8fafc; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: .75rem; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table tfoot td { background: #f1f5f9; font-weight: 700; border-top: 2px solid var(--border); }
.table-actions { display: flex; gap: .3rem; }

/* ── BADGES ── */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-success { background: #ecfdf5; color: #065f46; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-danger { background: #fef2f2; color: #991b1b; }
.badge-purple { background: #f5f3ff; color: #5b21b6; }
.badge-info { background: #eff6ff; color: #1e40af; }

/* ── TEXT ── */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-light) !important; }

/* ── RESULTADO ── */
.resultado-card { background: var(--card); border-radius: var(--radius); padding: 1rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.resultado-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.resultado-item { display: flex; align-items: center; gap: .4rem; }
.resultado-label { font-size: .82rem; color: var(--text-light); font-weight: 600; }
.resultado-valor { font-size: 1.2rem; font-weight: 700; }

/* ── PAGO ── */
.pago-card { max-width: 500px; }
.pago-monto { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border-radius: 10px; padding: 1rem; text-align: center; margin-bottom: 1.2rem; }
.monto-label { display: block; font-size: .82rem; color: var(--text-light); }
.monto-valor { font-size: 1.8rem; font-weight: 800; color: var(--success); }
.pago-nota { background: #eff6ff; border-radius: 8px; padding: .7rem; display: flex; align-items: flex-start; gap: .4rem; color: var(--primary-dark); font-size: .82rem; }

/* ── INTERPRETACIÓN ── */
.interpretacion-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.2rem; }
.interpretacion-card { background: var(--card); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.interpretacion-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.interpretacion-header h2 { font-size: 1.05rem; }
.interpretacion-score { font-size: 1.8rem; font-weight: 800; }
.interpretacion-texto { font-size: .88rem; line-height: 1.7; margin: .8rem 0; }
.factores-cols { display: grid; grid-template-columns: 1fr; gap: .8rem; }
.factores-cols h5 { font-size: .82rem; margin-bottom: .3rem; }
.factores-cols ul { list-style: none; }
.factores-cols li { font-size: .8rem; padding: .25rem 0; border-bottom: 1px solid var(--border); }
.factores-cols small { color: var(--text-light); }
.empresa-resumen { background: var(--card); padding: 1rem 1.2rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.2rem; border-left: 4px solid var(--primary); }
.empresa-resumen h3 { margin-bottom: .2rem; }
.empresa-resumen p { font-size: .82rem; color: var(--text-light); }

/* ── RECOMENDACIONES ── */
.recomendaciones-lista { display: flex; flex-direction: column; gap: .5rem; }
.rec-item { background: #f8fafc; border-left: 3px solid var(--primary); padding: .7rem 1rem; border-radius: 0 8px 8px 0; }
.rec-item p { font-size: .88rem; line-height: 1.5; }

/* ── BARRAS ── */
.resumen-barras { display: flex; flex-direction: column; gap: .8rem; }
.barra-item label { font-size: .85rem; font-weight: 600; display: block; margin-bottom: .3rem; }
.barra-bg { background: #e2e8f0; border-radius: 10px; height: 24px; overflow: hidden; }
.barra-fill { height: 100%; border-radius: 10px; transition: width .6s ease; min-width: 4px; }

/* ── QUICK ACTIONS ── */
.quick-actions h2 { font-size: 1.1rem; margin-bottom: .8rem; }
.actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.action-btn {
    background: var(--card); border-radius: var(--radius); padding: 1.2rem .8rem;
    text-align: center; box-shadow: var(--shadow); transition: all .2s; color: var(--text);
}
.action-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; color: var(--primary); }
.action-btn i { font-size: 1.5rem; display: block; margin-bottom: .4rem; color: var(--primary); }
.action-btn span { font-size: .82rem; font-weight: 600; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 2.5rem 1rem; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state i { font-size: 2.5rem; color: var(--text-light); margin-bottom: .8rem; display: block; }
.empty-state p { color: var(--text-light); margin-bottom: .8rem; }

/* ── ORGANIGRAMA ── */
.organigrama-container { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; overflow-x: auto; min-height: 300px; -webkit-overflow-scrolling: touch; }
#orgChart svg { display: block; margin: 0 auto; }

/* ── FOOTER ── */
.footer { text-align: center; padding: 1.2rem; color: var(--text-light); font-size: .75rem; border-top: 1px solid var(--border); margin-top: auto; }

/* ================================================================
   TABLET (≥ 640px)
   ================================================================ */
@media (min-width: 640px) {
    .container { padding: 1.5rem 1rem; }
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: repeat(2, 1fr); }
    .actions-grid { grid-template-columns: repeat(4, 1fr); }
    .interpretacion-grid { grid-template-columns: repeat(2, 1fr); }
    .factores-cols { grid-template-columns: 1fr 1fr; }
    .form-row-eval { flex-direction: row; flex-wrap: wrap; }
    .form-row-eval > .form-group { min-width: 120px; }
    .form-row-eval > .fg-desc { flex: 2; min-width: 200px; }
    .section-header h1 { width: auto; }
    .section-header p { width: auto; }
}

/* ================================================================
   DESKTOP (≥ 1024px)
   ================================================================ */
@media (min-width: 1024px) {
    body { font-size: 15px; }
    .nav-toggle { display: none; }
    .nav-menu { display: flex !important; width: auto; flex-direction: row; padding: 0; gap: .15rem; }
    .nav-menu a { padding: .55rem .65rem; font-size: .82rem; }
    .cards-grid { grid-template-columns: repeat(4, 1fr); }
    .form-row-eval { flex-wrap: nowrap; }
    .form-row-eval > .form-group { min-width: 0; flex: 1; }
    .form-row-eval > .fg-desc { flex: 2; }
}

/* ================================================================
   LARGE DESKTOP (≥ 1280px)
   ================================================================ */
@media (min-width: 1280px) {
    .nav-menu a { padding: .6rem .8rem; font-size: .85rem; }
}
