/* FWS Group System Admin UI */
/* Brand palette derived from SLAA 50th anniversary diagonal graphic:
   Deep navy #160c54 · Indigo #4b30b8 · Magenta #c0287c                 */
:root {
    --brand-navy:   #160c54;   /* deep navy — sidebar, dark surfaces    */
    --brand-indigo: #4b30b8;   /* indigo    — primary buttons, links     */
    --brand-magenta:#c0287c;   /* magenta   — active states, accents     */
    --brand-blue:   #4b30b8;   /* alias kept for legacy inline refs      */
    --brand-teal:   #6d3dbf;   /* alias kept for legacy inline refs      */
    --brand-light:  #f0eaff;   /* very light lavender tint               */
    --primary:      #4b30b8;   /* used by var(--primary) inline styles   */
    --text-main:    #1a1a2e;
    --text-muted:   #6b7280;
    --border:       #d1d5db;
    --success:      #16a34a;
    --warning:      #d97706;
    --danger:       #dc2626;
    --info:         #0284c7;
    --bg-page:      #f3f4f6;
    --bg-card:      #ffffff;
    --sidebar-w:    240px;
    --header-h:     56px;
    --radius:       6px;
    --shadow:       0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text-main);
    background: var(--bg-page);
    line-height: 1.5;
}

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

/* ── Layout ─────────────────────────────────────────────────── */
.cgs-layout { display: flex; min-height: 100vh; }

.cgs-sidebar {
    width: var(--sidebar-w);
    background: var(--brand-navy);
    color: #fff;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.cgs-sidebar .logo {
    padding: 16px 14px;
    font-size: 15px; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.15);
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
}
.cgs-sidebar .logo span { font-size: 11px; font-weight: 400; opacity: .7; display: block; }

.cgs-nav { flex: 1; padding: 12px 0; }
.cgs-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px;
    color: rgba(255,255,255,.85);
    font-size: 13px;
    transition: background .15s;
}
.cgs-nav a:hover, .cgs-nav a.active {
    background: rgba(255,255,255,.15);
    color: #fff;
    text-decoration: none;
}
.cgs-nav a.active { border-left: 3px solid var(--brand-magenta); padding-left: 13px; background: rgba(192,40,124,.18); }
.cgs-nav .section-label {
    padding: 16px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.5);
}
.cgs-nav .icon { width: 18px; text-align: center; opacity: .8; }

.cgs-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: 12px;
    color: rgba(255,255,255,.6);
}
.cgs-sidebar-footer a { color: rgba(255,255,255,.7); }

/* Main content area */
.cgs-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex; flex-direction: column;
}

.cgs-topbar {
    height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow);
}
.cgs-topbar h1 { font-size: 17px; font-weight: 600; margin: 0; }
.cgs-topbar .topbar-right { display: flex; align-items: center; gap: 16px; }
.cgs-topbar .user-badge {
    font-size: 12px; color: var(--text-muted);
}
.cgs-topbar .user-badge strong { color: var(--text-main); }

.cgs-content {
    padding: 24px;
    flex: 1;
    max-width: 1400px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.card-header h2 { font-size: 15px; font-weight: 600; margin: 0; }
.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: #fafafa;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stats grid ──────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}
.stat-card .stat-value {
    font-size: 28px; font-weight: 700;
    color: var(--brand-indigo);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); }
.stat-card.warn  .stat-value { color: var(--warning); }
.stat-card.error .stat-value { color: var(--danger); }
.stat-card.teal  .stat-value { color: var(--brand-teal); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
table.data-table th {
    background: #f9fafb; font-weight: 600;
    padding: 9px 12px; text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
table.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
table.data-table tr:hover td { background: #f9fafb; }
table.data-table .actions { white-space: nowrap; }
table.data-table .actions a, table.data-table .actions button {
    margin-right: 6px; font-size: 12px;
}

/* ── Badges / Status pills ───────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 100px;
    font-size: 11px; font-weight: 600;
    white-space: nowrap;
}
.badge-active   { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f3f4f6; color: var(--text-muted); }
.badge-error    { background: #fee2e2; color: #b91c1c; }
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-admin    { background: #ede9fe; color: #6d28d9; }
.badge-ig       { background: #dbeafe; color: #1e40af; }
.badge-group    { background: #e0f2fe; color: #0369a1; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--radius);
    font-size: 13px; font-weight: 500; cursor: pointer;
    border: 1px solid transparent; text-decoration: none;
    transition: opacity .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary { background: var(--brand-indigo); color: #fff; }
.btn-teal    { background: var(--brand-teal); color: #fff; }
.btn-secondary { background: #fff; color: var(--text-main); border-color: var(--border); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-icon { padding: 5px 8px; }
.btn-link { background: none; border: none; color: var(--brand-indigo); padding: 0; font-size: 13px; }
.btn-xs  { padding: 2px 7px; font-size: 11px; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px;
}
.form-group .hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=tel], input[type=number], select, textarea {
    width: 100%; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; font-family: inherit;
    transition: border-color .15s;
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand-indigo);
    box-shadow: 0 0 0 2px rgba(75,48,184,.18);
}
input[readonly] { background: #f9fafb; color: var(--text-muted); cursor: default; }
textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
select { appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}

/* ── Alerts / Flash messages ─────────────────────────────────── */
.alert {
    padding: 10px 14px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 13px;
    display: flex; align-items: flex-start; gap: 8px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; gap: 4px; margin-top: 16px;
}
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 6px;
    border: 1px solid var(--border); border-radius: 4px;
    font-size: 13px; color: var(--text-main);
}
.pagination a:hover { background: var(--brand-light); color: var(--brand-indigo); text-decoration: none; }
.pagination .current { background: var(--brand-indigo); color: #fff; border-color: var(--brand-indigo); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ── Utility ─────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-full { width: 100%; }
.mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: monospace; }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-magenta) 100%);
}
.login-box {
    background: #fff; border-radius: 10px;
    padding: 40px; width: 380px;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
.login-box .login-logo {
    text-align: center; margin-bottom: 28px;
}
.login-box .login-logo h1 { font-size: 20px; color: var(--brand-navy); margin: 8px 0 2px; }
.login-box .login-logo p  { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cgs-sidebar { transform: translateX(-100%); transition: transform .2s; }
    .cgs-sidebar.open { transform: translateX(0); }
    .cgs-main { margin-left: 0; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Feed status indicator ───────────────────────────────────── */
.feed-status-dot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 5px;
}
.feed-status-dot.active  { background: var(--success); }
.feed-status-dot.error   { background: var(--danger); box-shadow: 0 0 0 2px #fee2e2; }
.feed-status-dot.pending { background: var(--warning); }
.feed-status-dot.inactive { background: #d1d5db; }

/* ── Copy button ──────────────────────────────────────────────── */
.copy-btn {
    cursor: pointer; font-size: 11px; padding: 2px 7px;
    border: 1px solid var(--border); border-radius: 3px;
    background: #f9fafb; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 3px;
}
.copy-btn:hover { background: var(--brand-light); color: var(--brand-indigo); }
