/* =========================================================
   SIGESP – Hoja de estilos principal
   ========================================================= */
:root {
    --sg-primary:      #1e3a5f;
    --sg-primary-dark: #152b47;
    --sg-accent:       #2563eb;
    --sg-amber:        #f59e0b;
    --sg-success:      #10b981;
    --sg-danger:       #ef4444;
    --sg-warning:      #f59e0b;
    --sg-info:         #06b6d4;
    --sg-sidebar-w:    260px;
    --sg-topbar-h:     64px;
    --sg-radius:       .75rem;
    --sg-shadow:       0 1px 6px rgba(0,0,0,.08);
}

/* ── Reset base ─────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }

body {
    background-color: #0f1c2e;
    background-image:
        linear-gradient(rgba(15,28,46,.55), rgba(15,28,46,.55)),
        url('/img/fondo%20sigesp1024.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .9375rem;
    color: #1e293b;
    margin: 0;
    min-height: 100vh;
}

/* ── Wrapper ─────────────────────────────────────────────── */
#wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sg-sidebar {
    width: var(--sg-sidebar-w);
    min-height: 100vh;
    background: var(--sg-primary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
    z-index: 200;
}
.sg-sidebar::-webkit-scrollbar { width: 4px; }
.sg-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sg-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
    background: var(--sg-primary-dark);
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
    flex-shrink: 0;
}
.sg-brand:hover { color: #fff; }
.sg-brand i { font-size: 1.5rem; color: var(--sg-amber); }

.sg-nav { padding: .75rem 0 1.5rem; flex: 1; }

.sg-nav-section {
    padding: .9rem 1.5rem .3rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,.35);
    font-weight: 700;
}

.sg-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1.5rem;
    color: rgba(255,255,255,.72);
    text-decoration: none;
    font-size: .875rem;
    transition: background .15s, color .15s, border-left-color .15s;
    border-left: 3px solid transparent;
    position: relative;
}
.sg-nav-link i { font-size: 1rem; width: 1.2rem; text-align: center; flex-shrink: 0; }
.sg-nav-link:hover,
.sg-nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.09);
    border-left-color: var(--sg-amber);
    padding-left: calc(1.5rem - 3px);
}
.sg-nav-link .badge {
    margin-left: auto;
    font-size: .65rem;
    padding: .2em .5em;
}

/* Offcanvas sidebar (móvil) */
.sg-offcanvas {
    background: var(--sg-primary) !important;
    width: var(--sg-sidebar-w) !important;
    color: #fff;
}

/* ── Topbar ──────────────────────────────────────────────── */
.sg-topbar {
    height: var(--sg-topbar-h);
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(226,232,240,.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,.12);
    flex-shrink: 0;
}
.sg-topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #334155;
    margin: 0;
}

/* Texto del login partial — oscuro en topbar, claro en navbar móvil/offcanvas */
.sg-login-text { color: #334155 !important; }
.sg-navbar-mobile .sg-login-text,
.sg-offcanvas   .sg-login-text { color: #fff !important; }

/* Navbar móvil */
.sg-navbar-mobile {
    background: var(--sg-primary-dark);
    padding: .6rem 1rem;
}

/* ── Main content ────────────────────────────────────────── */
.sg-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: transparent;
}
.sg-content {
    flex: 1;
    padding: 1.75rem;
    max-width: 1440px;
    width: 100%;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: var(--sg-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    padding: 1.25rem 1.5rem;
    border-left: 4px solid transparent;
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.stat-card.blue   { border-left-color: var(--sg-accent); }
.stat-card.green  { border-left-color: var(--sg-success); }
.stat-card.amber  { border-left-color: var(--sg-amber); }
.stat-card.red    { border-left-color: var(--sg-danger); }
.stat-card.cyan   { border-left-color: var(--sg-info); }
.stat-card.purple { border-left-color: #8b5cf6; }
.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: .6rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.stat-card.blue   .stat-icon { background: #eff6ff; color: var(--sg-accent); }
.stat-card.green  .stat-icon { background: #ecfdf5; color: var(--sg-success); }
.stat-card.amber  .stat-icon { background: #fffbeb; color: var(--sg-amber); }
.stat-card.red    .stat-icon { background: #fef2f2; color: var(--sg-danger); }
.stat-card.cyan   .stat-icon { background: #ecfeff; color: var(--sg-info); }
.stat-card.purple .stat-icon { background: #f5f3ff; color: #8b5cf6; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: .8rem; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: var(--sg-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.card-header {
    background: rgba(255,255,255,.75);
    border-bottom: 1px solid rgba(241,245,249,.8);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: #334155;
    border-radius: var(--sg-radius) var(--sg-radius) 0 0 !important;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.card-header i { color: var(--sg-accent); }
.card-body { padding: 1.25rem; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: #fff; margin: 0; text-shadow: 0 1px 4px rgba(0,0,0,.4); }

/* ── Tables ──────────────────────────────────────────────── */
.table-card {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: var(--sg-radius);
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
    overflow: hidden;
}
.table { margin: 0; }
.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .75rem 1rem;
    white-space: nowrap;
}
.table tbody td {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-color: #f1f5f9;
    color: #334155;
}
.table tbody tr:hover { background: #f8fafc; }
.table-actions { white-space: nowrap; text-align: right; }

/* ── Badges de estatus ───────────────────────────────────── */
.badge-estatus {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3em .75em;
    border-radius: 2rem;
    font-size: .75rem;
    font-weight: 600;
}
.badge-activo    { background: #ecfdf5; color: #065f46; }
.badge-inactivo  { background: #f1f5f9; color: #475569; }
.badge-abierto   { background: #eff6ff; color: #1d4ed8; }
.badge-cerrado   { background: #f1f5f9; color: #475569; }
.badge-nueva     { background: #fef2f2; color: #991b1b; }
.badge-proceso   { background: #fffbeb; color: #92400e; }
.badge-resuelta  { background: #ecfdf5; color: #065f46; }
.badge-activa    { background: #eff6ff; color: #1d4ed8; }

/* ── Forms ───────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: .875rem; color: #374151; }
.form-control, .form-select {
    border-radius: .5rem;
    border-color: #d1d5db;
    font-size: .9rem;
    padding: .5rem .85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--sg-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-card {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--sg-radius);
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
    padding: 1.75rem;
}
.form-section-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: .5rem;
    margin-bottom: 1rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    border-radius: .5rem;
    font-weight: 600;
    font-size: .875rem;
    padding: .45rem 1.1rem;
    transition: all .15s;
}
.btn-primary { background: var(--sg-accent); border-color: var(--sg-accent); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-field {
    min-height: 52px;
    font-size: 1rem;
    padding: .75rem 1.5rem;
    display: flex; align-items: center; gap: .5rem;
}
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }

/* ── GPS & Campo ─────────────────────────────────────────── */
.gps-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: .6rem;
    padding: 1rem;
}
.gps-coords {
    font-family: 'Courier New', monospace;
    font-size: .85rem;
    color: #0369a1;
    font-weight: 600;
}
.foto-preview {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: .5rem;
    display: none;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert { border-radius: .6rem; border: none; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1d4ed8; }

/* ── Timeline (dashboard) ───────────────────────────────── */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-item {
    display: flex;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: .875rem;
}
.timeline-item:last-child { border-bottom: none; }

/* ── Login page ──────────────────────────────────────────── */
.sg-login-body {
    background: var(--sg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sg-login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
}
.sg-login-card {
    background: #fff;
    border-radius: var(--sg-radius);
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.sg-login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sg-primary);
    margin-bottom: .25rem;
}
.sg-login-brand i { font-size: 2rem; color: var(--sg-accent); }
.sg-login-subtitle {
    text-align: center;
    color: #64748b;
    font-size: .85rem;
    margin-bottom: 1.75rem;
}
.timeline-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: .45rem;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}
.empty-state i { font-size: 3rem; display: block; margin-bottom: .75rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sg-content { padding: 1rem; }
    .stat-card .stat-value { font-size: 1.6rem; }
}
@media (max-width: 575.98px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .table thead th, .table tbody td { padding: .6rem .75rem; }
}

/* -- Map picker ------------------------------------------- */
.sg-map-picker {
    height: 380px;
    border-radius: var(--sg-radius);
    border: 1px solid #cbd5e1;
    overflow: hidden;
    z-index: 0;
}
.sg-map-picker.sg-map-readonly { cursor: default; }
.sg-map-sm { height: 260px; }

/* ── Botón flotante de ayuda ─────────────────────────────── */
.sg-help-fab {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    z-index: 1050;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--sg-accent);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(37,99,235,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    cursor: pointer;
    transition: background .2s, transform .15s, box-shadow .2s;
}
.sg-help-fab:hover {
    background: #1d4ed8;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37,99,235,.55);
}

/* ── Panel de ayuda (offcanvas) ──────────────────────────── */
.sg-help-panel { width: 340px; }
.sg-help-header {
    background: var(--sg-primary);
    color: #fff;
    border-bottom: none;
}
.sg-help-body { background: #f8fafc; padding: 1.25rem; }
.sg-help-section-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: .6rem;
}
.sg-help-tips { list-style: none; padding: 0; margin: 0; }
.sg-help-tips li {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: .875rem;
    color: #334155;
    line-height: 1.45;
}
.sg-help-tips li:last-child { border-bottom: none; }
.sg-help-divider { border-color: #cbd5e1; margin: 1rem 0; }

/* ── Manual de operación ─────────────────────────────────── */
.sg-manual-nav {
    display: flex;
    flex-direction: column;
    padding: .5rem 0;
}
.sg-manual-nav a {
    padding: .4rem 1.1rem;
    color: #334155;
    font-size: .875rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.sg-manual-nav a:hover {
    background: #f1f5f9;
    border-left-color: var(--sg-accent);
    color: var(--sg-accent);
}
.sg-manual-nav-group {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #94a3b8;
    padding: .75rem 1.1rem .2rem;
}
.sg-manual-body { padding: 2rem 2.5rem; }
.sg-manual-section h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--sg-primary);
    margin-bottom: 1rem;
}
.sg-manual-section h5 {
    font-size: .95rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 1.25rem;
    margin-bottom: .5rem;
}
.sg-manual-hr { margin: 2rem 0; border-color: #e2e8f0; }
.sg-manual-info {
    background: #eff6ff;
    border-left: 4px solid var(--sg-accent);
    border-radius: 0 .5rem .5rem 0;
    padding: .75rem 1rem;
    color: #1e40af;
    font-size: .875rem;
    margin-top: .75rem;
}
.sg-manual-warn {
    background: #fffbeb;
    border-left: 4px solid var(--sg-amber);
    border-radius: 0 .5rem .5rem 0;
    padding: .75rem 1rem;
    color: #92400e;
    font-size: .875rem;
    margin-top: .75rem;
}
@media (max-width: 575.98px) {
    .sg-manual-body { padding: 1.25rem; }
    .sg-help-panel  { width: 90vw; }
}
