/* Hawe Admin Panel — Clean, professional UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e1e4e8;
    --text: #1f2937;
    --text-muted: #6b7280;
    --primary: #3aafa9;
    --primary-hover: #2d9a95;
    --green: #10b981;
    --red: #ef4444;
    --blue: #3b82f6;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Layout ──────────────────────────── */
.admin-layout {
    min-height: 100vh;
}

.sidebar {
    background: #1a1f2e;
    color: #fff;
    padding: 1.5rem 0;
    position: fixed;
    width: 240px;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1rem;
}

.sidebar-logo h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.sidebar-logo small { color: rgba(255,255,255,0.4); font-size: 0.72rem; }

.sidebar-nav { list-style: none; padding: 0 0.75rem; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    color: rgba(255,255,255,0.65);
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-nav a.active { background: rgba(58,175,169,0.15); color: var(--primary); }
.sidebar-nav .icon { font-size: 1.1rem; width: 20px; text-align: center; }

.main-content {
    margin-left: 240px;
    padding: 2rem;
    min-height: 100vh;
}

/* ── Top Bar ──────────────────────────── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.topbar h1 { font-size: 1.5rem; font-weight: 700; }
.topbar-actions { display: flex; gap: 0.5rem; }

/* ── Cards ──────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 { font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ── Tables ──────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tr:hover td { background: #fafbfc; }
.data-table .slug { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; color: var(--text-muted); }

/* ── Competition / Comparison Tables ──── */
.comp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    table-layout: fixed;
}

.comp-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: #f8f9fb;
    border-bottom: 2px solid var(--border);
    border-top: 1px solid var(--border);
    white-space: nowrap;
}

.comp-table th:not(:last-child),
.comp-table td:not(:last-child) {
    border-right: 1px solid #f0f1f3;
}

.comp-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #eef0f2;
    vertical-align: middle;
}

.comp-table tbody tr:hover td {
    background: rgba(58,175,169,0.03);
}

.comp-table tbody tr:nth-child(even) td {
    background: #fafbfc;
}

.comp-table tbody tr:nth-child(even):hover td {
    background: rgba(58,175,169,0.05);
}

/* First column (tier/codec label) */
.comp-table td:first-child {
    font-weight: 600;
    white-space: nowrap;
    background: #f8f9fb;
}

/* Hawe CDN highlight column */
.comp-table .hawe-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Competitor price cells */
.comp-table .comp-price {
    white-space: nowrap;
}

.comp-table .comp-price small {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 1px;
}

.comp-table .comp-source {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ── Buttons ──────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-success:disabled, .btn-success.disabled {
    background: #6b7280; color: rgba(255,255,255,0.5);
    cursor: not-allowed; opacity: 0.6;
}
.btn-success:disabled:hover, .btn-success.disabled:hover {
    background: #6b7280;
}
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 0.95rem; }

/* ── Forms ──────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.form-group .help { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58,175,169,0.12);
}

textarea.code-editor {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 400px;
    white-space: pre;
    tab-size: 4;
}

textarea.code-editor-sm {
    min-height: 120px;
}

/* ── Flash Messages ──────────────────── */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.88rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.flash-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.flash-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.flash-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ── Login Page ──────────────────────── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a1f2e;
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 2.5rem;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    text-align: center;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.login-card .btn { width: 100%; justify-content: center; padding: 0.65rem; }

/* ── Grid ──────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ── Stats ──────────────────────────── */
.stat-card { padding: 1.25rem; text-align: center; }
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── Media Grid ──────────────────────── */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.media-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-align: center;
}

.media-item img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    background: #f8f9fa;
    padding: 0.5rem;
}

.media-item .info {
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

/* ── Responsive ──────────────────────── */
@media (max-width: 900px) {
    .admin-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 1rem; }
    .grid-2 { grid-template-columns: 1fr; }
}

/* ── Publish indicator ─────────────── */
.publish-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
}
.publish-badge.live { background: #ecfdf5; color: #059669; }

/* ══════════════════════════════════════════════════════════
   Multi-site additions: site switcher, tenant labels, admin
   tables for sites/users, inline forms and feature toggles.
   ══════════════════════════════════════════════════════════ */

.sidebar { display: flex; flex-direction: column; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; }

.sidebar-label {
    color: rgba(255,255,255,0.3);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-switcher {
    padding: 0 1.25rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 0.75rem;
}
.site-switcher form { margin: 0.35rem 0 0; }
.site-switch-btn {
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.65);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}
.site-switch-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.site-switch-btn.active {
    background: rgba(58,175,169,0.15);
    border-color: rgba(58,175,169,0.4);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
    display: block;
    margin-bottom: 0.5rem;
    color: rgba(255,255,255,0.4);
    font-size: 0.72rem;
    word-break: break-all;
}

.topbar-sub {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.topbar-sub code { font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; }

.muted { color: var(--text-muted); font-size: 0.85rem; }
.warn-inline { color: var(--red); font-size: 0.72rem; margin-top: 0.15rem; }

.tag {
    display: inline-block;
    margin: 0 0.2rem 0.2rem 0;
    padding: 0.12rem 0.42rem;
    border-radius: 4px;
    background: rgba(107,114,128,0.12);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
}
.tag-on { background: rgba(58,175,169,0.14); color: var(--primary-hover); }
.tag-off { background: rgba(239,68,68,0.12); color: var(--red); }

.data-table tr.subrow td { background: rgba(0,0,0,0.015); padding-top: 0.5rem; padding-bottom: 0.6rem; }

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0.25rem 0;
}
.inline-form label { font-size: 0.72rem; color: var(--text-muted); }
.inline-form input[type="text"],
.inline-form input[type="password"],
.inline-form select {
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font: inherit;
    font-size: 0.8rem;
}
.inline-form label input[type="text"] { display: block; margin-top: 0.15rem; }

.feature-toggles { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; }
.chk {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text);
    white-space: nowrap;
}
.chk input { margin: 0; }

.code-block {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8f9fa;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    line-height: 1.55;
    overflow-x: auto;
}

/* Password generator / strength hint (static/js/password-tools.js) */
.pw-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
}
.pw-tools .btn { padding: 0.25rem 0.5rem; font-size: 0.74rem; }
.pw-meter { font-size: 0.74rem; color: var(--text-muted); }
.pw-meter.pw-weak { color: var(--red); }
.pw-meter.pw-ok { color: #b45309; }
.pw-meter.pw-strong { color: var(--green); }
