/*! ZonaTV Panel — tema propio, sin dependencias externas de CSS/JS */

:root {
    --bg: #131416;
    --surface: #191A1D;
    --surface-2: #1E2023;
    --border: rgba(242, 241, 238, 0.09);
    --text: #F2F1EE;
    --text-muted: #8B8A86;
    --accent: #D9A24B;
    --accent-hover: #E8B96B;
    --danger: #E0554D;
    --success: #8FA98C;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 14px;
}

h1, h2, h3, h4, h5, .brand, .btn, .nav-link {
    font-family: 'Sora', 'Manrope', sans-serif;
}

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

::selection { background: rgba(217, 162, 75, 0.35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #3A3C3E; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- Layout: sidebar + content ---- */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 24px 10px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.04em;
}

.sidebar .brand svg { flex: 0 0 auto; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.nav-link:hover { background: rgba(242, 241, 238, 0.05); color: var(--text); }

.nav-link.active {
    background: rgba(217, 162, 75, 0.14);
    color: var(--accent);
}

.nav-link svg { flex: 0 0 auto; opacity: 0.9; }

.main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 28px 32px 60px 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar h1 {
    font-size: 21px;
    font-weight: 600;
    margin: 0;
}

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

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 26px rgba(0,0,0,0.25);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.card h2, .card h3 { margin-top: 0; }

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

.tile {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}

.tile h4 { margin: 0 0 6px 0; font-size: 15px; }
.tile p { margin: 0; color: var(--text-muted); font-size: 13px; word-break: break-all; }

/* ---- Forms ---- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }

.field { margin-bottom: 16px; }
.field small { display: block; color: var(--text-muted); margin-top: 4px; font-size: 12px; }

input[type="text"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    background: rgba(242, 241, 238, 0.06);
    border: 1.4px solid rgba(242, 241, 238, 0.14);
    color: var(--text);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(217, 162, 75, 0.16);
}

input[type="file"] { padding: 8px 10px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 10px;
    padding: 11px 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #131416; box-shadow: 0 10px 20px -10px rgba(217,162,75,0.55); }
.btn-primary:hover { background: var(--accent-hover); color: #131416; }

.btn-ghost { background: transparent; border: 1.4px solid rgba(242,241,238,0.25); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: rgba(224, 85, 77, 0.14); color: var(--danger); }
.btn-danger:hover { background: rgba(224, 85, 77, 0.24); }

.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.btn-icon { padding: 8px; }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---- Badge / switch ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-on { background: rgba(143, 169, 140, 0.15); color: var(--success); }
.badge-off { background: rgba(224, 85, 77, 0.15); color: var(--danger); }

/* ---- Flash messages ---- */
.flash {
    padding: 13px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}
.flash-success { background: rgba(143, 169, 140, 0.14); color: var(--success); border: 1px solid rgba(143,169,140,0.25); }
.flash-error { background: rgba(224, 85, 77, 0.14); color: var(--danger); border: 1px solid rgba(224,85,77,0.25); }

/* ---- Login screen ---- */
body.login-body {
    background:
        radial-gradient(45% 60% at 82% 14%, rgba(120,150,168,0.28), rgba(120,150,168,0) 60%),
        radial-gradient(38% 55% at 12% 8%, rgba(196,140,90,0.26), rgba(196,140,90,0) 60%),
        radial-gradient(60% 70% at 50% 100%, rgba(31,37,37,0.45), rgba(31,37,37,0) 60%),
        linear-gradient(160deg, #201d1a 0%, #17191a 45%, #101112 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(25, 26, 29, 0.82);
    border: 1px solid rgba(242,241,238,0.1);
    border-radius: 18px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    padding: 40px 32px;
}

.login-card .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: 0.06em;
    margin-bottom: 26px;
}

.login-card h1 { font-size: 22px; margin: 0 0 6px 0; }
.login-card p.sub { color: var(--text-muted); margin: 0 0 26px 0; font-size: 14px; }

.login-card .btn-primary { width: 100%; justify-content: center; height: 48px; border-radius: 24px; margin-top: 6px; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; display: flex; align-items: center; overflow-x: auto; padding: 12px; }
    .sidebar .brand { padding: 0 12px; margin-right: 8px; }
    .sidebar nav { display: flex; gap: 4px; }
    .nav-link span { display: none; }
    .main { padding: 20px 16px 40px 16px; }
}
