/* =====================================================
   19ª NOTARÍA DE SANTIAGO — Portal de Consultas
   main.css
   ===================================================== */

/* --- Variables ---------------------------------------- */
:root {
    --green-dark:    #1c4a1f;
    --green-mid:     #2d6b30;
    --green-light:   #3a8a3e;
    --green-pale:    #e8f2e8;
    --green-pale2:   #f2f8f2;
    --white:         #ffffff;
    --off-white:     #f8f9f7;
    --gray-50:       #f6f7f5;
    --gray-100:      #eaece8;
    --gray-200:      #d4d8d0;
    --gray-400:      #9aa396;
    --gray-600:      #5a6357;
    --gray-800:      #2e3330;
    --text-primary:  #1e2820;
    --text-secondary:#4a5548;
    --text-muted:    #7a8878;
    --error:         #c0392b;
    --error-bg:      #fdf0ef;
    --success:       #27623a;
    --shadow-sm:     0 1px 3px rgba(28,74,31,.08), 0 1px 2px rgba(28,74,31,.06);
    --shadow-md:     0 4px 12px rgba(28,74,31,.10), 0 2px 6px rgba(28,74,31,.07);
    --shadow-lg:     0 10px 30px rgba(28,74,31,.12), 0 4px 12px rgba(28,74,31,.08);
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     16px;
    --font-display:  'Cormorant Garamond', Georgia, serif;
    --font-body:     'DM Sans', system-ui, sans-serif;
    --transition:    0.2s ease;
}

/* --- Reset -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--off-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--green-mid); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--green-dark); }
img { max-width: 100%; display: block; }

/* --- Header ------------------------------------------- */
.site-header {
    background: var(--green-dark);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 68px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.header-logo { flex-shrink: 0; }
.logo-img { height: 38px; width: auto; }
.header-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-left: 20px;
    border-left: 1px solid rgba(255,255,255,.2);
}
.header-subtitle {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
}
.header-main-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
    letter-spacing: .01em;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}
.header-user {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255,255,255,.8);
    font-size: 13.5px;
    font-weight: 500;
}
.btn-header-logout {
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(255,255,255,.65);
    border: 1px solid rgba(255,255,255,.25);
    padding: 6px 14px;
    border-radius: 20px;
    transition: all var(--transition);
}
.btn-header-logout:hover {
    background: rgba(255,255,255,.12);
    color: var(--white);
    border-color: rgba(255,255,255,.5);
}

/* --- Main -------------------------------------------- */
.main-content { flex: 1; }

/* --- Messages ---------------------------------------- */
.messages-container {
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 0 24px;
}
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
}
.alert-error   { background: var(--error-bg); color: var(--error); border: 1px solid #f5c6c2; }
.alert-success { background: #eaf5ec; color: var(--success); border: 1px solid #b8e0bf; }
.alert-icon { font-size: 16px; font-weight: 700; }

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
    min-height: calc(100vh - 68px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--off-white);
    position: relative;
    overflow: hidden;
}
.login-bg-deco {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 10% 80%, rgba(28,74,31,.07) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 90% 20%, rgba(28,74,31,.05) 0%, transparent 70%);
    pointer-events: none;
}
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 44px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    border: 1px solid var(--gray-100);
}
.login-header { text-align: center; margin-bottom: 36px; }
.login-icon {
    width: 64px;
    height: 64px;
    background: var(--green-pale);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--green-dark);
}
.login-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.login-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Form */
.login-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: .02em;
    text-transform: uppercase;
}
.input-wrapper { position: relative; }
.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}
.form-input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    outline: none;
}
.form-input:focus {
    background: var(--white);
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(45,107,48,.12);
}
.form-input::placeholder { color: var(--gray-400); }
.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    transition: color var(--transition);
}
.toggle-password:hover { color: var(--green-mid); }
.form-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--error-bg);
    border: 1px solid #f5c6c2;
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 13.5px;
    font-weight: 500;
}
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: var(--green-dark);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .03em;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    margin-top: 4px;
}
.btn-login:hover {
    background: var(--green-mid);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(28,74,31,.3);
}
.btn-login:active { transform: translateY(0); }
.login-footer-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.login-footer-note strong { color: var(--text-secondary); }

/* =====================================================
   PANEL / CONSULTA
   ===================================================== */
.consulta-page { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; }

/* Hero */
.page-hero {
    background: var(--green-dark);
    margin: 0 -24px;
    padding: 36px 24px;
    margin-bottom: 32px;
}
.page-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.page-hero-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
    margin-bottom: 8px;
}
.page-hero-title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 6px;
}
.page-hero-title span { color: #a8d5aa; }
.page-hero-desc { font-size: 14px; color: rgba(255,255,255,.65); }
.stat-card {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: var(--radius-md);
    padding: 20px 32px;
    text-align: center;
    backdrop-filter: blur(4px);
}
.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 700;
    color: var(--white);
    line-height: 1;
}
.stat-label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,.6);
    margin-top: 4px;
    font-weight: 500;
}

/* Filtros */
.filters-bar {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.filters-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.filter-group--wide { flex: 1; min-width: 200px; }
.filter-label {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}
.filter-input {
    padding: 9px 12px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--transition);
}
.filter-input:focus {
    background: var(--white);
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(45,107,48,.1);
}
.filter-actions { display: flex; gap: 8px; align-items: center; }
.btn-filter-search {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: var(--green-dark);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.btn-filter-search:hover { background: var(--green-mid); }
.btn-filter-clear {
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.btn-filter-clear:hover { color: var(--error); border-color: #f5c6c2; background: var(--error-bg); }

/* Tabla */
.table-section { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); overflow: hidden; }
.table-header-row {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.table-count { font-size: 13.5px; color: var(--text-muted); }
.table-count strong { color: var(--text-primary); }
.table-wrapper { overflow-x: auto; }
.tramites-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.tramites-table thead tr {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-100);
}
.tramites-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.tramites-table td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.tramite-row:last-child td { border-bottom: none; }
.tramite-row:hover { background: var(--green-pale2); }
.badge-ot {
    display: inline-block;
    padding: 3px 10px;
    background: var(--green-pale);
    color: var(--green-dark);
    border-radius: 20px;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .02em;
}
.compareciente-name { display: block; font-weight: 500; }
.compareciente-rut { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tag-seccion {
    display: inline-block;
    padding: 3px 10px;
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.tag-seccion--lg { font-size: 13px; padding: 5px 14px; }
.obs-text { color: var(--text-secondary); line-height: 1.4; }
.obs-empty { color: var(--gray-400); font-style: italic; font-size: 12.5px; }
.btn-ver-detalle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: transparent;
    color: var(--green-dark);
    border: 1.5px solid var(--green-pale);
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--transition);
}
.btn-ver-detalle:hover {
    background: var(--green-dark);
    color: var(--white);
    border-color: var(--green-dark);
}

/* Paginación */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    border-top: 1px solid var(--gray-100);
}
.page-btn {
    padding: 8px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--green-dark);
    border: 1.5px solid var(--green-pale);
    border-radius: 20px;
    transition: all var(--transition);
}
.page-btn:hover { background: var(--green-dark); color: var(--white); border-color: var(--green-dark); }
.page-info { font-size: 13px; color: var(--text-muted); }

/* Empty state */
.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--text-muted);
}
.empty-icon { color: var(--gray-200); margin-bottom: 20px; }
.empty-state h3 { font-family: var(--font-display); font-size: 22px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; line-height: 1.6; max-width: 360px; margin: 0 auto 20px; }
.btn-empty-clear {
    display: inline-block;
    padding: 9px 22px;
    background: var(--green-dark);
    color: var(--white);
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.btn-empty-clear:hover { background: var(--green-mid); color: var(--white); }

/* =====================================================
   DETALLE DE TRÁMITE
   ===================================================== */
.detalle-page { max-width: 1100px; margin: 0 auto; padding: 32px 24px 60px; }
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.breadcrumb a { display: flex; align-items: center; gap: 4px; color: var(--green-mid); font-weight: 500; }
.breadcrumb a:hover { color: var(--green-dark); }
.breadcrumb-sep { color: var(--gray-300); }
.detalle-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
    flex-wrap: wrap;
}
.detalle-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--green-mid);
    margin-bottom: 6px;
}
.detalle-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.detalle-materia { font-size: 16px; color: var(--text-secondary); font-weight: 400; }
.detalle-header-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.detalle-fecha-recep {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Grid de cards */
.detalle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.detalle-card--full { grid-column: 1 / -1; }
.detalle-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.detalle-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.detalle-card-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.field-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    flex-shrink: 0;
    padding-top: 1px;
}
.field-value { font-size: 14px; color: var(--text-primary); text-align: right; line-height: 1.4; }
.field-value small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.field-divider { border: none; border-top: 1px solid var(--gray-100); margin: 4px 0; }
.bool-yes {
    display: inline-block;
    padding: 2px 10px;
    background: #e8f5ea;
    color: #2a7a37;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.bool-no {
    display: inline-block;
    padding: 2px 10px;
    background: var(--gray-100);
    color: var(--text-muted);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.fecha-highlight { color: var(--green-dark); font-weight: 600; }
.obs-full-text { font-size: 14.5px; color: var(--text-secondary); line-height: 1.65; }
.obs-empty-detail { font-size: 14px; color: var(--gray-400); font-style: italic; }
.historial-log {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.7;
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-100);
    font-family: 'Courier New', monospace;
    max-height: 300px;
    overflow-y: auto;
}
.detalle-back-action { margin-top: 32px; }
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    color: var(--green-dark);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}
.btn-back:hover { background: var(--green-dark); color: var(--white); border-color: var(--green-dark); }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
    background: #111f12;
    color: rgba(255,255,255,.7);
    margin-top: auto;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 36px;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 48px;
}
.footer-logo { height: 36px; width: auto; margin-bottom: 16px; opacity: .85; }
.footer-tagline { font-size: 13.5px; line-height: 1.7; max-width: 220px; }
.footer-col h4 {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--white);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--green-dark);
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-col li { font-size: 13.5px; line-height: 1.5; }
.footer-col a { color: rgba(255,255,255,.6); transition: color var(--transition); }
.footer-col a:hover { color: #a8d5aa; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 16px 24px;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,.3);
    max-width: 1200px;
    margin: 0 auto;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    .detalle-grid { grid-template-columns: 1fr 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .header-title { display: none; }
    .page-hero-inner { flex-direction: column; align-items: flex-start; }
    .detalle-grid { grid-template-columns: 1fr; }
    .detalle-header { flex-direction: column; }
    .detalle-header-meta { align-items: flex-start; }
    .footer-inner { grid-template-columns: 1fr; gap: 28px; }
    .login-card { padding: 32px 24px; }
    .filters-form { flex-direction: column; }
    .filter-group, .filter-group--wide { width: 100%; }
    .tramites-table { font-size: 12.5px; }
    .tramites-table th, .tramites-table td { padding: 10px 12px; }
}

/* =====================================================
   AJUSTES: Header centrado / Footer 2 columnas
   ===================================================== */

/* Header: logo + título centrados, acciones a la derecha */
.header-inner--centered {
    justify-content: center;
    position: relative;
}
.header-inner--centered .header-logo {
    position: static;
}
.header-inner--centered .header-title {
    flex: 0 1 auto;
    padding-left: 20px;
    border-left: 1px solid rgba(255,255,255,.2);
}
.header-inner--centered .header-actions {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
}

/* Footer: 2 columnas equitativas y centradas */
.footer-inner--two-col {
    grid-template-columns: 1fr 1fr;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    gap: 60px;
}

@media (max-width: 640px) {
    .header-inner--centered { justify-content: flex-start; }
    .header-inner--centered .header-actions { position: static; transform: none; margin-left: auto; }
    .footer-inner--two-col { grid-template-columns: 1fr; gap: 28px; }
}
