/* E-Flow Dashboard — tema alineado con www.e-flow.es */

:root {
    --bg: #0e1115;
    --panel: #15181e;
    --panel-soft: #11141a;
    --line: rgba(151, 163, 183, 0.16);
    --line-bright: rgba(31, 143, 255, 0.38);
    --text: #f3f5f7;
    --muted: #8d95a5;
    --muted-2: #5e6675;
    --primary: #1191f5;
    --primary-strong: #0a84f7;
    --danger: #ff5575;
    --success: #27d87b;
    --warning: #ffd25d;
    --shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
    --glow: 0 0 42px rgba(17, 145, 245, 0.18);
    --radius: 14px;
    --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }

img { max-width: 100%; }

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Header ---------- */

.eflow-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-soft);
    position: sticky;
    top: 0;
    z-index: 20;
}

.eflow-logo {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.eflow-logo span { color: var(--primary); }

.eflow-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.eflow-nav a {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.eflow-nav a.active,
.eflow-nav a:hover { color: var(--text); }

.eflow-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--muted);
}

.eflow-user .badge-role {
    background: rgba(17, 145, 245, 0.14);
    color: var(--primary);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ---------- Layout ---------- */

main.page {
    padding: 32px 0 64px;
}

h1 { font-size: 1.6rem; margin: 0 0 6px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 28px; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}

/* ---------- Panels / cards ---------- */

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 20px; }

.grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.charger-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.charger-card:hover {
    border-color: var(--line-bright);
    transform: translateY(-2px);
}

.charger-card .row-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.charger-card .name { font-weight: 600; font-size: 1.05rem; }
.charger-card .external-id { color: var(--muted-2); font-size: 0.78rem; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-disponible { background: rgba(39, 216, 123, 0.14); color: var(--success); }
.status-cargando { background: rgba(17, 145, 245, 0.16); color: var(--primary); }
.status-mantenimiento { background: rgba(255, 210, 93, 0.14); color: var(--warning); }
.status-offline { background: rgba(255, 85, 117, 0.14); color: var(--danger); }
.status-no-disponible { background: rgba(142, 149, 165, 0.14); color: var(--muted); }

/* ---------- Indicador de conexión (latido del cargador) ---------- */

.conn-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 500;
}

.conn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.conn-online { color: var(--success); }
.conn-online .conn-dot { background: var(--success); }
.conn-slow { color: var(--warning); }
.conn-slow .conn-dot { background: var(--warning); }
.conn-offline { color: var(--danger); }
.conn-offline .conn-dot { background: var(--danger); }

.charger-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.charger-card .meta strong { color: var(--text); font-weight: 600; }

.mode-tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--muted);
}

/* ---------- Forms / buttons ---------- */

label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 16px;
    transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--line-bright);
    box-shadow: var(--glow);
}

textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row label { margin: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--primary-strong); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}
.btn-secondary:hover { border-color: var(--line-bright); background: var(--panel-soft); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #e64360; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 160px; }

/* ---------- Simulador ---------- */

.sim-log {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    max-height: 320px;
    overflow-y: auto;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.sim-log > div { padding: 3px 0; border-bottom: 1px solid var(--line); }
.sim-log > div:last-child { border-bottom: none; }
.log-ok { color: var(--muted); }
.log-error { color: var(--danger); }

/* ---------- Alerts ---------- */

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.88rem;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert-error { background: rgba(255, 85, 117, 0.1); color: var(--danger); border-color: rgba(255, 85, 117, 0.3); }
.alert-success { background: rgba(39, 216, 123, 0.1); color: var(--success); border-color: rgba(39, 216, 123, 0.3); }
.alert-info { background: rgba(17, 145, 245, 0.1); color: var(--primary); border-color: rgba(17, 145, 245, 0.3); }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }

.table-wrap { overflow-x: auto; }

/* ---------- Stat tiles ---------- */

.stats-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-tile {
    flex: 1;
    min-width: 140px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.stat-tile .label { color: var(--muted); font-size: 0.78rem; margin-bottom: 6px; }
.stat-tile .value { font-size: 1.5rem; font-weight: 700; }

/* ---------- Auth pages ---------- */

.auth-wrap {
    min-height: calc(100vh - 66px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card .eyebrow { text-align: center; }
.auth-card h1 { text-align: center; margin-bottom: 24px; }

/* ---------- QR pages ---------- */

.qr-wrap { text-align: center; }
.qr-box {
    display: inline-block;
    background: #fff;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin: 20px 0;
}

/* ---------- Chart ---------- */

.chart-wrap { position: relative; height: 340px; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
    .eflow-header { flex-wrap: wrap; }
    .eflow-nav { order: 3; width: 100%; justify-content: flex-start; gap: 14px; }
    main.page { padding: 22px 0 48px; }
    .panel { padding: 18px; }
    h1 { font-size: 1.35rem; }
    .stats-row { flex-direction: column; }
    .form-row { flex-direction: column; }
}
