/* =====================================================================
   SISTEMA DE AGUA POTABLE - Estilos generales
   ===================================================================== */
:root {
    --jas-verde: #0f766e;
    --jas-verde-claro: #14b8a6;
    --jas-azul: #0284c7;
    --jas-tinta: #0f172a;
    --jas-texto: #334155;
    --jas-muted: #64748b;
    --jas-linea: #e2e8f0;
    --jas-fondo: #f4f8f8;
    --jas-sidebar-ancho: 264px;
    --jas-sidebar-bg: #073b3a;
    --jas-sidebar-hover: rgba(255, 255, 255, .08);
    --jas-topbar-alto: 64px;
    --jas-radio: .9rem;
    --jas-sombra: 0 10px 30px rgba(15, 23, 42, .06);
    --sidebar-ancho: var(--jas-sidebar-ancho);
    --sidebar-bg: var(--jas-sidebar-bg);
    --sidebar-bg-hover: var(--jas-sidebar-hover);
    --topbar-alto: var(--jas-topbar-alto);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background:
        radial-gradient(circle at 100% 0%, rgba(20, 184, 166, .08), transparent 28%),
        radial-gradient(circle at 0% 100%, rgba(2, 132, 199, .06), transparent 26%),
        var(--jas-fondo);
    color: var(--jas-texto);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ===================== SHELL ===================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--jas-sidebar-ancho);
    background:
        radial-gradient(circle at 8% 0%, rgba(45, 212, 191, .22), transparent 34%),
        linear-gradient(180deg, #063b3a 0%, #0a4f4a 55%, #0b5e56 100%);
    color: #d7f4ef;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1040;
    border-right: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 10px 0 40px rgba(3, 35, 34, .14);
    transition: transform .25s ease;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 99px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.2rem 1.1rem 1.05rem;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.sidebar-brand i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 1.35rem;
    color: #5eead4;
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 0 0 1px rgba(94, 234, 212, .16);
}

.sidebar-brand .brand-logo {
    display: block;
    width: 38px;
    height: 38px;
    max-width: 38px;
    max-height: 38px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    padding: .28rem;
}

.sidebar-brand strong {
    display: block;
    color: #fff;
    font-size: 1.02rem;
    letter-spacing: .04em;
    line-height: 1.2;
}

.sidebar-brand small {
    display: block;
    max-width: 175px;
    color: #9cc9c2;
    font-size: .7rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav { padding: .6rem 0 2rem; }

.nav-section {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: 1.05rem 1.1rem .4rem;
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #7fb3aa;
}

.nav-section::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, .12), transparent);
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: .12rem .65rem;
    padding: .62rem .8rem;
    color: #d2ebe6;
    text-decoration: none;
    font-size: .89rem;
    border-radius: .65rem;
    border-left: 0;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-item i {
    width: 1.25rem;
    font-size: 1.02rem;
    text-align: center;
    opacity: .9;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    transform: translateX(2px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(45, 212, 191, .24), rgba(45, 212, 191, .06));
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(94, 234, 212, .15);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: .4rem;
    bottom: .4rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #5eead4;
}

/* ===================== MAIN ===================== */
.main-area {
    flex: 1;
    margin-left: var(--jas-sidebar-ancho);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--jas-topbar-alto);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, .9);
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}

.topbar-title {
    font-size: 1.15rem;
    margin: 0;
    font-weight: 700;
    color: var(--jas-tinta);
    letter-spacing: -.015em;
}

.topbar-user { margin-left: auto; }

.topbar-user .btn-link {
    text-decoration: none;
    color: var(--jas-tinta);
    display: flex;
    align-items: center;
    gap: .55rem;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--jas-verde), var(--jas-azul));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(15, 118, 110, .22);
}

.content {
    padding: 1.5rem;
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .8rem 1.5rem;
    font-size: .76rem;
    color: #7c8d99;
    border-top: 1px solid var(--jas-linea);
    background: rgba(255, 255, 255, .7);
}

/* ===================== CARDS ===================== */
.card {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--jas-radio);
    box-shadow: var(--jas-sombra);
    background: #fff;
    transition: box-shadow .2s ease;
}

.card:hover { box-shadow: 0 14px 36px rgba(15, 23, 42, .08); }

.card-header {
    background: transparent;
    font-weight: 700;
    color: var(--jas-tinta);
    border-bottom: 1px solid #edf2f7;
    padding: 1rem 1.25rem;
}

.card-body { padding: 1.25rem; }

.card-footer {
    background: #fbfdfd;
    border-top: 1px solid #edf2f7;
    padding: .85rem 1.25rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    border-left-width: 4px !important;
    border-left-style: solid;
    background: linear-gradient(180deg, #ffffff 0%, #fbfefd 100%);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -32px;
    top: -32px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 184, 166, .13), transparent 70%);
    pointer-events: none;
}

.stat-label {
    margin-bottom: .35rem;
    font-size: .71rem;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
    color: var(--jas-muted);
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.025em;
    color: var(--jas-tinta);
}

.stat-sub {
    margin-top: .3rem;
    font-size: .78rem;
    color: #94a3b8;
}

.stat-icon {
    font-size: 2rem;
    opacity: .85;
}

.stat-icon-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 15px;
    font-size: 1.3rem;
}

.welcome-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    border-radius: var(--jas-radio);
    background:
        radial-gradient(circle at 92% 15%, rgba(255, 255, 255, .2), transparent 24%),
        linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #0284c7 100%);
    color: #fff;
    box-shadow: 0 14px 34px rgba(15, 118, 110, .2);
}

.welcome-eyebrow {
    display: block;
    margin-bottom: .25rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .78;
}

.welcome-banner h2 {
    margin: 0 0 .25rem;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.welcome-banner p {
    margin: 0;
    font-size: .86rem;
    opacity: .82;
}

.welcome-date {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex: 0 0 auto;
    padding: .55rem .85rem;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: .7rem;
    font-size: .8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(6px);
}

.tarjeta-reporte {
    transition: transform .15s ease, box-shadow .15s ease;
}

.tarjeta-reporte:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .1);
}

/* ===================== TABLAS ===================== */
.table {
    margin-bottom: 0;
    color: var(--jas-texto);
}

.table > :not(caption) > * > * {
    padding: .8rem 1rem;
    border-bottom-color: #edf2f7;
    vertical-align: middle;
}

.table > thead th {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--jas-muted);
    background: #f8fafc;
    border-bottom: 1px solid #e6edf3;
    white-space: nowrap;
}

.table-hover > tbody > tr:hover > * {
    background-color: #f4fbfa;
}

.table a {
    color: var(--jas-verde);
    font-weight: 600;
}

.badge {
    padding: .4em .68em;
    border-radius: .5rem;
    font-weight: 600;
    letter-spacing: .015em;
}

.badge.bg-light {
    background: #eef5f4 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0;
}

/* ===================== BOTONES Y FORMULARIOS ===================== */
.btn {
    border-radius: .65rem;
    font-weight: 600;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn-sm { border-radius: .5rem; }

.btn-primary {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    border: 0;
    box-shadow: 0 6px 16px rgba(15, 118, 110, .22);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #0b5f59, #0f766e);
    transform: translateY(-1px);
}

.btn-outline-primary {
    --bs-btn-color: var(--jas-verde);
    --bs-btn-border-color: #9fd6d0;
    --bs-btn-hover-bg: var(--jas-verde);
    --bs-btn-hover-border-color: var(--jas-verde);
}

.form-control,
.form-select {
    border: 1px solid #dbe5e3;
    border-radius: .65rem;
    padding: .55rem .8rem;
    color: var(--jas-tinta);
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #5eead4;
    box-shadow: 0 0 0 .2rem rgba(20, 184, 166, .15);
}

.form-label {
    font-weight: 600;
    color: #475569;
}

.input-group-text {
    border-color: #dbe5e3;
    border-radius: .65rem;
    background: #f1f7f6;
    color: var(--jas-verde);
}

/* ===================== MENUS Y MENSAJES ===================== */
.dropdown-menu {
    border: 1px solid #e6edf3;
    border-radius: .8rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
    padding: .4rem;
}

.dropdown-item {
    border-radius: .5rem;
    padding: .5rem .7rem;
    font-size: .9rem;
}

.dropdown-item:hover {
    background: #f1f7f6;
    color: var(--jas-verde);
}

.alert {
    border: 0;
    border-left: 4px solid currentColor;
    border-radius: .8rem;
    box-shadow: var(--jas-sombra);
}

.page-link {
    margin: 0 .12rem;
    border-color: var(--jas-linea);
    border-radius: .55rem !important;
    color: var(--jas-verde);
}

.page-item.active .page-link {
    background: var(--jas-verde);
    border-color: var(--jas-verde);
}

/* ===================== AUTH ===================== */
.auth-body {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 12% 18%, rgba(45, 212, 191, .36), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(14, 165, 233, .28), transparent 32%),
        linear-gradient(135deg, #032f2e 0%, #075e54 55%, #0c4a6e 100%);
}

.auth-body::before,
.auth-body::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .08);
    pointer-events: none;
}

.auth-body::before {
    width: 420px;
    height: 420px;
    top: -150px;
    right: -100px;
    box-shadow:
        0 0 0 45px rgba(255, 255, 255, .025),
        0 0 0 100px rgba(255, 255, 255, .018);
}

.auth-body::after {
    width: 320px;
    height: 320px;
    bottom: -140px;
    left: -100px;
    box-shadow:
        0 0 0 38px rgba(255, 255, 255, .025),
        0 0 0 85px rgba(255, 255, 255, .015);
}

.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.auth-card {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: rgba(255, 255, 255, .97);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 1.25rem;
    box-shadow: 0 30px 70px rgba(2, 6, 23, .35);
    padding: 2.4rem 2.1rem 2.1rem;
}

.auth-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #14b8a6, #0ea5e9);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto .9rem;
    border-radius: 20px;
    color: var(--jas-verde);
    background: linear-gradient(135deg, #ccfbf1, #e0f2fe);
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, .08);
}

.auth-logo i { font-size: 2.1rem; }

.auth-card h1 {
    font-weight: 800;
    letter-spacing: -.02em;
}

.auth-card .btn-primary { padding: .7rem; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(2, 6, 23, .25); }
    .main-area { margin-left: 0; }
    .topbar { padding: 0 1rem; }
    .content { padding: 1.1rem; }
}

@media (max-width: 575.98px) {
    .content { padding: .9rem; }
    .card-body { padding: 1rem; }
    .stat-value { font-size: 1.4rem; }
    .stat-icon { font-size: 1.5rem; }
    .stat-icon-bubble { width: 38px; height: 38px; font-size: 1.05rem; }
    .topbar-title { font-size: 1rem; }
    .app-footer { flex-direction: column; padding: .75rem 1rem; }
    .welcome-banner { align-items: flex-start; flex-direction: column; padding: 1.15rem; }
    .welcome-date { align-self: flex-start; }
}
