/* ═══════════════════════════════════════════
   PersonaGrid – Main Stylesheet
   Dark futuristic theme · Blue & Orange accent
   ═══════════════════════════════════════════ */

:root {
    --bg-primary: #060b18;
    --bg-secondary: #0c1529;
    --bg-card: #111d35;
    --bg-card-hover: #162545;
    --bg-input: #0a1428;
    --border: #1a2d50;
    --border-focus: #00a3ff55;
    --text: #e8edf5;
    --text-sec: #7b8fad;
    --text-muted: #4a5d7a;
    --blue: #00a3ff;
    --blue-dim: #00a3ff22;
    --orange: #f08c28;
    --orange-dim: #f08c2822;
    --green: #00d68f;
    --green-dim: #00d68f22;
    --red: #ff4757;
    --red-dim: #ff475722;
    --purple: #a855f7;
    --sidebar-w: 260px;
    --header-h: 0px;
    --radius: 10px;
    --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'IBM Plex Sans', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: #33b5ff; }

/* ─── Sidebar ─── */
.sidebar {
    position: fixed; left: 0; top: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; gap: 14px;
}
.sidebar-brand img { width: 38px; height: 38px; object-fit: contain; }
.sidebar-brand .brand-text {
    font-family: 'Exo 2', sans-serif; font-weight: 700; font-size: 1.25rem;
}
.sidebar-brand .brand-text span:first-child { color: var(--blue); }
.sidebar-brand .brand-text span:last-child { color: var(--orange); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-section-title {
    font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--text-muted); padding: 0 12px; margin-bottom: 8px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--text-sec); font-size: 0.88rem; font-weight: 400;
    transition: all .2s; cursor: pointer; margin-bottom: 2px;
}
.nav-item:hover { background: var(--blue-dim); color: var(--text); }
.nav-item.active { background: var(--blue-dim); color: var(--blue); font-weight: 500; }
.nav-item i { width: 20px; text-align: center; font-size: 0.95rem; }

.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-footer .admin-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--orange));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: #fff;
}
.sidebar-footer .admin-info { flex: 1; }
.sidebar-footer .admin-name { font-size: 0.82rem; font-weight: 500; }
.sidebar-footer .admin-role { font-size: 0.7rem; color: var(--text-muted); }

/* ─── Main Content ─── */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    padding: 32px 36px;
}

/* ─── Page Header ─── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 32px; flex-wrap: wrap; gap: 16px;
}
.page-header h2 {
    font-family: 'Exo 2', sans-serif; font-weight: 700; font-size: 1.6rem;
    display: flex; align-items: center; gap: 12px;
}
.page-header h2 i { color: var(--blue); font-size: 1.3rem; }
.page-header p { color: var(--text-sec); font-size: 0.88rem; margin-top: 4px; }

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: all .25s;
}
.card:hover { border-color: var(--border-focus); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px; display: flex; align-items: flex-start; gap: 18px;
    transition: all .25s;
}
.stat-card:hover { border-color: var(--border-focus); transform: translateY(-2px); }
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
    flex-shrink: 0;
}
.stat-icon.blue { background: var(--blue-dim); color: var(--blue); }
.stat-icon.orange { background: var(--orange-dim); color: var(--orange); }
.stat-icon.green { background: var(--green-dim); color: var(--green); }
.stat-icon.purple { background: rgba(168,85,247,.15); color: var(--purple); }
.stat-value { font-family: 'Exo 2', sans-serif; font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.78rem; color: var(--text-sec); margin-top: 2px; }

/* ─── Table ─── */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.table-header h3 {
    font-family: 'Exo 2', sans-serif; font-weight: 600; font-size: 1.05rem;
}
table {
    width: 100%; border-collapse: collapse;
}
thead th {
    padding: 14px 20px; text-align: left;
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted);
    border-bottom: 1px solid var(--border); background: var(--bg-secondary);
}
tbody td {
    padding: 14px 20px; font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

.client-cell { display: flex; align-items: center; gap: 12px; }
.client-logo {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    object-fit: contain;
}
.client-logo-placeholder {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--blue-dim), var(--orange-dim));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.75rem; color: var(--blue);
}
.client-name { font-weight: 500; }
.client-email { font-size: 0.78rem; color: var(--text-sec); }

/* ─── Status Badges ─── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
}
.badge-active { background: var(--green-dim); color: var(--green); }
.badge-inactive { background: var(--red-dim); color: var(--red); }
.badge-suspended { background: var(--orange-dim); color: var(--orange); }
.badge i { font-size: 0.55rem; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 0.85rem; font-weight: 500; border: none;
    cursor: pointer; transition: all .2s; font-family: inherit;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--blue), #0088dd);
    color: #fff; box-shadow: 0 2px 12px var(--blue-dim);
}
.btn-primary:hover { background: linear-gradient(135deg, #33b5ff, var(--blue)); color: #fff; transform: translateY(-1px); }
.btn-secondary { background: var(--bg-card); color: var(--text-sec); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--blue); color: var(--text); }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-dim); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.78rem; }
.btn-icon { padding: 7px 10px; }

.actions { display: flex; gap: 6px; }

/* ─── Forms ─── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
    display: block; font-size: 0.78rem; font-weight: 500;
    color: var(--text-sec); margin-bottom: 6px;
}
.form-group label .required { color: var(--red); }
.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text); font-size: 0.88rem;
    font-family: inherit; transition: all .2s;
}
.form-control:focus {
    outline: none; border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-dim);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-section-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 0.95rem; font-weight: 600;
    color: var(--text); padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin: 8px 0 20px; grid-column: 1 / -1;
    display: flex; align-items: center; gap: 8px;
}
.form-section-title i { color: var(--blue); font-size: 0.85rem; }

.form-actions {
    grid-column: 1 / -1;
    display: flex; gap: 12px; justify-content: flex-end;
    padding-top: 16px; border-top: 1px solid var(--border);
    margin-top: 8px;
}

/* ─── Logo Upload ─── */
.logo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px; text-align: center;
    cursor: pointer; transition: all .2s;
    position: relative;
}
.logo-upload-area:hover { border-color: var(--blue); background: var(--blue-dim); }
.logo-upload-area i { font-size: 2rem; color: var(--text-muted); margin-bottom: 8px; }
.logo-upload-area p { font-size: 0.82rem; color: var(--text-sec); }
.logo-upload-area input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.logo-preview {
    max-width: 120px; max-height: 80px; object-fit: contain;
    border-radius: var(--radius-sm); margin-top: 10px;
}

/* ─── Flash Messages ─── */
.flash {
    padding: 14px 20px; border-radius: var(--radius-sm);
    margin-bottom: 24px; display: flex; align-items: center; gap: 10px;
    font-size: 0.88rem; animation: fadeIn .3s;
}
.flash-success { background: var(--green-dim); color: var(--green); border: 1px solid #00d68f44; }
.flash-error { background: var(--red-dim); color: var(--red); border: 1px solid #ff475744; }
.flash-warning { background: var(--orange-dim); color: var(--orange); border: 1px solid #f08c2844; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ─── Service Toggle Cards ─── */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; display: flex; flex-direction: column; gap: 12px;
    transition: all .25s;
}
.service-card.enabled { border-color: var(--green); box-shadow: 0 0 20px var(--green-dim); }
.service-card-header { display: flex; align-items: center; gap: 14px; }
.service-icon {
    width: 42px; height: 42px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.service-card-header h4 { font-size: 0.95rem; font-weight: 600; }
.service-provider { font-size: 0.72rem; color: var(--text-muted); }
.service-desc { font-size: 0.82rem; color: var(--text-sec); line-height: 1.5; }

/* ─── Toggle Switch ─── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.toggle {
    position: relative; width: 44px; height: 24px;
    background: var(--border); border-radius: 12px;
    cursor: pointer; transition: background .25s;
}
.toggle.on { background: var(--green); }
.toggle::after {
    content: ''; position: absolute;
    top: 3px; left: 3px; width: 18px; height: 18px;
    background: #fff; border-radius: 50%;
    transition: transform .25s;
}
.toggle.on::after { transform: translateX(20px); }
.toggle-label { font-size: 0.78rem; color: var(--text-sec); }

/* ─── Login Page ─── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, var(--blue-dim) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, var(--orange-dim) 0%, transparent 50%);
}
.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px; padding: 48px 40px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-logo {
    text-align: center; margin-bottom: 32px;
}
.login-logo img { width: 64px; height: 64px; margin-bottom: 12px; }
.login-logo h1 {
    font-family: 'Exo 2', sans-serif; font-size: 1.6rem; font-weight: 700;
}
.login-logo h1 span:first-child { color: var(--blue); }
.login-logo h1 span:last-child { color: var(--orange); }
.login-logo p { font-size: 0.82rem; color: var(--text-sec); margin-top: 4px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form .btn { width: 100%; justify-content: center; padding: 12px; font-size: 0.92rem; }

/* ─── Empty State ─── */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-sec); margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; margin-bottom: 20px; }

/* ─── Activity ─── */
.activity-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%;
    margin-top: 6px; flex-shrink: 0;
}
.activity-dot.blue { background: var(--blue); }
.activity-dot.green { background: var(--green); }
.activity-dot.orange { background: var(--orange); }
.activity-text { font-size: 0.85rem; }
.activity-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    :root { --sidebar-w: 220px; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Detail View ─── */
.detail-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.detail-item label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: .8px;
    color: var(--text-muted); display: block; margin-bottom: 4px;
}
.detail-item span { font-size: 0.92rem; color: var(--text); }
.detail-item.full { grid-column: 1 / -1; }

/* ─── Confirm Dialog ─── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.65); z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px;
    max-width: 420px; width: 90%;
}
.modal-box h3 { margin-bottom: 12px; font-family: 'Exo 2', sans-serif; }
.modal-box p { color: var(--text-sec); font-size: 0.88rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
