/* ===================================================
   AquaMonitor — app.css
   =================================================== */

:root {
    --blue:       #185FA5;
    --blue-light: #E6F1FB;
    --green:      #1D9E75;
    --green-light:#E1F5EE;
    --red:        #E24B4A;
    --red-light:  #FCEBEB;
    --amber:      #BA7517;
    --amber-light:#FAEEDA;
    --gray:       #5F5E5A;
    --gray-light: #F1EFE8;

    --bg:         #F5F4F0;
    --surface:    #FFFFFF;
    --border:     rgba(0,0,0,0.10);
    --border-md:  rgba(0,0,0,0.18);

    --text:       #1A1917;
    --text-muted: #73726C;
    --text-hint:  #9C9A92;

    --radius:     8px;
    --radius-lg:  12px;
    --shadow:     0 1px 3px rgba(0,0,0,0.06);

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'SF Mono', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

body.body-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

code {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--gray-light);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--text);
}

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--surface);
    border-bottom: 0.5px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    font-size: 13px;
    color: var(--text-muted);
}

.nav-user {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Container ──────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ── Cards ──────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Stat cards ─────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px 14px;
    border: 0.5px solid var(--border);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-val {
    font-size: 22px;
    font-weight: 500;
    color: var(--text);
}

/* ── Cisterna cards ─────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.cisterna-card {
    display: block;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s;
}

.cisterna-card:hover {
    border-color: var(--border-md);
    text-decoration: none;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.card-name {
    font-size: 14px;
    font-weight: 500;
}

.card-loc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.nivel-bar {
    background: var(--gray-light);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.nivel-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .3s;
}

.bar-success  { background: var(--green); }
.bar-warning  { background: var(--amber); }
.bar-danger   { background: var(--red); }
.bar-secondary{ background: var(--gray); }

.card-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.card-nivel {
    font-size: 20px;
    font-weight: 500;
}

.card-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.card-footer {
    border-top: 0.5px solid var(--border);
    padding-top: 8px;
}

.last-update {
    font-size: 11px;
    color: var(--text-hint);
}

/* ── Badges ─────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-success   { background: var(--green-light); color: #085041; }
.badge-warning   { background: var(--amber-light);  color: #633806; }
.badge-danger    { background: var(--red-light);    color: #791F1F; }
.badge-secondary { background: var(--gray-light);   color: var(--gray); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    font-size: 13px;
    border: 0.5px solid var(--border-md);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background .12s;
}

.btn:hover { background: var(--gray-light); text-decoration: none; }

.btn-primary {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.btn-primary:hover { background: #1050890; }

.btn-block { width: 100%; justify-content: center; margin-top: 4px; }

.btn-sm { font-size: 12px; padding: 4px 10px; }

.btn-back {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-back:hover { color: var(--text); }

/* ── Forms ───────────────────────────────────────────── */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 0.5px solid var(--border-md);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color .12s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24,95,165,0.12);
}

/* ── Login ───────────────────────────────────────────── */
.login-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 20px;
}

.login-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 4px;
}

.login-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ── Alerts ──────────────────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-success { background: var(--green-light); color: #085041; }
.alert-danger  { background: var(--red-light);   color: #791F1F; }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabla th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 0.5px solid var(--border);
    background: var(--bg);
    white-space: nowrap;
}

.tabla td {
    padding: 9px 12px;
    border-bottom: 0.5px solid var(--border);
    color: var(--text);
}

.tabla tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover td { background: var(--bg); }

/* ── Range pills ─────────────────────────────────────── */
.range-pills { display: flex; gap: 4px; }

.pill {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    border: 0.5px solid var(--border-md);
    color: var(--text-muted);
    text-decoration: none;
}

.pill:hover { background: var(--gray-light); text-decoration: none; }

.pill-active {
    background: var(--blue-light);
    color: var(--blue);
    border-color: transparent;
}

/* ── Misc ────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h2 { font-size: 15px; font-weight: 500; }

.page-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header h1 { font-size: 20px; font-weight: 500; }

.muted { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.text-danger { color: var(--red); }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
