/* Estilos del Sistema Notarial PLD/FT */
:root {
  --primary: #0f2744;
  --primary-light: #1e3a5f;
  --secondary: #85144b;
  --accent: #d97706;
  --success: #15803d;
  --danger: #b91c1c;
  --warning: #b45309;
  --info: #0284c7;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-radius: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
body { background-color: var(--bg-main); color: var(--text-main); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }

/* Topbar */
.topbar { background: var(--primary); color: white; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
.topbar-brand { display: flex; align-items: center; gap: 14px; }
.notary-seal { background: var(--accent); color: white; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; border: 2px solid #fef3c7; }
.brand-titles h1 { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; }
.brand-titles p { font-size: 12px; color: #94a3b8; }
.topbar-controls { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.role-badge { background: #1e293b; border: 1px solid #475569; padding: 5px 12px; border-radius: 20px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.role-select { background: transparent; color: white; border: none; font-size: 13px; font-weight: 600; cursor: pointer; outline: none; }
.role-select option { background: #1e293b; color: white; }
.uma-badge { background: rgba(217, 119, 6, 0.25); border: 1px solid var(--accent); color: #fef3c7; padding: 4px 10px; border-radius: 4px; font-weight: 600; }
.lan-status { display: flex; align-items: center; gap: 6px; color: #86efac; font-size: 12px; font-weight: 600; }
.lan-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 8px #22c55e; }

/* Nav Tabs */
.nav-tabs-container { background: white; border-bottom: 1px solid var(--border-color); padding: 0 24px; overflow-x: auto; display: flex; gap: 4px; }
.tab-btn { background: none; border: none; padding: 14px 18px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--secondary); background: #f1f5f9; }
.badge-count { background: var(--danger); color: white; padding: 2px 7px; border-radius: 12px; font-size: 11px; font-weight: bold; }

/* Main Container */
.content-wrapper { flex: 1; padding: 24px; max-width: 1400px; margin: 0 auto; width: 100%; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.25s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Cards & Layout */
.card { background: var(--bg-card); border-radius: var(--border-radius); border: 1px solid var(--border-color); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; }
.card-header h2 { font-size: 16px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Stat Widgets */
.stat-box { background: white; border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 16px; border-left: 4px solid var(--primary); }
.stat-box.stat-danger { border-left-color: var(--danger); }
.stat-box.stat-warning { border-left-color: var(--accent); }
.stat-box.stat-success { border-left-color: var(--success); }
.stat-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text-main); }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #334155; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 13px; background: #fff; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(15, 39, 68, 0.1); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #9d174d; }
.btn-outline { background: white; border-color: var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* Tables */
.table-responsive { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; text-align: left; }
table.data-table th { background: #f1f5f9; padding: 10px 12px; font-weight: 700; color: #334155; border-bottom: 2px solid var(--border-color); }
table.data-table td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }
table.data-table tr:hover td { background: #f8fafc; }

/* Risk Badges */
.badge-risk { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-risk-bajo { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-risk-medio-bajo { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-risk-medio { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-risk-medio-alto { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.badge-risk-alto { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Alertas Box */
.alert-card { border-left: 4px solid var(--accent); padding: 14px; background: #fffbeb; border-radius: 6px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.alert-card.alert-critica { border-left-color: var(--danger); background: #fef2f2; }
.alert-title { font-weight: bold; font-size: 13px; color: #991b1b; }
.alert-desc { font-size: 12px; color: #4b5563; margin-top: 2px; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.55); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-content { background: white; border-radius: 8px; max-width: 800px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 12px; margin-bottom: 16px; }

/* Footer */
footer { background: #0b192c; color: #94a3b8; text-align: center; padding: 14px 20px; font-size: 11.5px; border-top: 1px solid #1e293b; margin-top: auto; }

/* Estilos de Impresión Oficial Notarial */
@media print {
  @page {
    size: letter portrait;
    margin: 8mm 12mm 8mm 12mm;
  }
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .topbar, .nav-tabs-container, footer, .modal-header, .modal-overlay button, #pantalla-login, .modal-content > div:last-child, main {
    display: none !important;
  }
  .modal-overlay#modal-dictamen {
    position: static !important;
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: auto !important;
  }
  .modal-overlay#modal-dictamen .modal-content {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  #modal-dictamen-body {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}
