/* =========================================================
   نظام العرض الرقمي - لوحة التحكم
   Design system v3: warm gold/deep-brown brand identity with
   varied accent colors per content area (restoring color that
   the flat cool-gray v2 pass lost), professional icon set,
   split-screen login in the register of premium SaaS platforms.
   ========================================================= */

:root {
    /* Neutrals - warm-tinted, not stark cool gray */
    --ink: #201A14;
    --ink-soft: #6B6258;
    --ink-faint: #9B9184;
    --paper: #F7F5F2;
    --panel: #FFFFFF;
    --line: #EAE3D8;
    --line-strong: #D8CDBC;

    /* Brand - warm gold, used with a deep-brown gradient panel */
    --brand: #C8842A;
    --brand-dark: #A66A1E;
    --brand-deep: #241B12;
    --brand-deep-2: #150F0A;
    --brand-tint: #FBF0DD;
    --brand-tint-strong: #F3DDB1;

    /* Varied accent palette - used per content area to restore real color */
    --accent-blue: #2F6FEB;    --accent-blue-tint: #EAF1FE;
    --accent-purple: #7C5CFC;  --accent-purple-tint: #F1EDFE;
    --accent-pink: #E0507B;    --accent-pink-tint: #FCEAF0;
    --accent-green: #1E9E6B;   --accent-green-tint: #E7F7EF;

    /* Status colors - pills/badges only */
    --ok: #1E9E6B;
    --ok-tint: #E7F7EF;
    --warn: #B9790A;
    --warn-tint: #FBF0DC;
    --danger: #C23B33;
    --danger-tint: #FBE9E7;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(32, 26, 20, 0.06);
    --shadow: 0 2px 6px rgba(32, 26, 20, 0.07), 0 8px 24px -8px rgba(32, 26, 20, 0.10);
    --shadow-lg: 0 20px 50px -12px rgba(21, 15, 10, 0.35);
}

* { box-sizing: border-box; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; }

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

.sidebar {
    width: 268px;
    background: linear-gradient(180deg, var(--brand-deep) 0%, var(--brand-deep-2) 100%);
    color: #CFC3B2;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-left: 1px solid rgba(255,255,255,0.06);
}

.sidebar .brand {
    padding: 22px 20px 20px;
    font-size: 17px;
    font-weight: 800;
    color: #FBF8F3;
    display: flex;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    letter-spacing: -0.01em;
}

.sidebar .brand .mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px; flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(200,132,42,0.4);
}

.sidebar nav { padding: 12px 12px; }

.sidebar .nav-link {
    color: #CFC3B2;
    padding: 10px 13px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 13.8px;
    font-weight: 500;
    margin-bottom: 2px;
    border-inline-end: 3px solid transparent;
    transition: background .12s ease, color .12s ease;
}

.sidebar .nav-link i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; opacity: 0.85; }

.sidebar .nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(200,132,42,0.22) 0%, rgba(200,132,42,0.08) 100%);
    color: #FBF8F3;
    font-weight: 700;
    border-inline-end-color: var(--brand);
}
.sidebar .nav-link.active i { opacity: 1; color: #E9A94D; }

.sidebar .nav-section-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    color: #7A6F60; padding: 18px 13px 6px; font-weight: 700;
}

.main-area { flex: 1; min-width: 0; }

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

.topbar h5 { font-weight: 700; font-size: 16px; margin: 0; }

.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-soft); }
.topbar .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(200,132,42,0.3);
}

.content { padding: 26px; max-width: 1400px; }

/* ---------- Cards ---------- */
.card-plain { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 19px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-card .num { font-size: 27px; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: -0.02em; }
.stat-card .label { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; font-weight: 500; }
.stat-card .icon-badge {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    background: var(--brand-tint);
    color: var(--brand-dark);
}
.icon-badge-gold   { background: var(--brand-tint); color: var(--brand-dark); }
.icon-badge-blue   { background: var(--accent-blue-tint); color: var(--accent-blue); }
.icon-badge-purple { background: var(--accent-purple-tint); color: var(--accent-purple); }
.icon-badge-pink   { background: var(--accent-pink-tint); color: var(--accent-pink); }
.icon-badge-green  { background: var(--accent-green-tint); color: var(--accent-green); }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.01em; }
.pill-online  { background: var(--ok-tint); color: var(--ok); }
.pill-offline { background: var(--danger-tint); color: var(--danger); }
.pill-warn    { background: var(--warn-tint); color: var(--warn); }
.pill-muted   { background: #F0ECE3; color: var(--ink-soft); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */
.btn-brand {
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
    border-color: var(--brand-dark); color: #fff; font-weight: 700;
    box-shadow: 0 2px 8px rgba(200,132,42,0.3);
}
.btn-brand:hover { background: linear-gradient(160deg, var(--brand-dark) 0%, #8C5A16 100%); border-color: #8C5A16; color: #fff; }
.btn-brand:focus { box-shadow: 0 0 0 3px var(--brand-tint-strong); }

.btn-outline-secondary { border-color: var(--line-strong); color: var(--ink-soft); font-weight: 500; }
.btn-outline-secondary:hover { background: var(--paper); border-color: var(--ink-faint); color: var(--ink); }
.btn-outline-danger { font-weight: 500; }

/* ---------- Tables ---------- */
.table-clean thead th {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-faint); border-bottom: 1px solid var(--line); font-weight: 700; padding-bottom: 10px;
}
.table-clean td { vertical-align: middle; border-color: var(--line); padding-top: 12px; padding-bottom: 12px; }
.table-clean tbody tr:hover { background: var(--paper); }

/* ---------- Forms ---------- */
.form-control, .form-select { border-color: var(--line-strong); font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.form-label { font-weight: 600; font-size: 13.5px; color: var(--ink); margin-bottom: 6px; }

/* =========================================================
   Login page — split screen, global-SaaS register
   ========================================================= */
.login-shell {
    min-height: 100vh; display: flex;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}
.login-form-pane {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: var(--panel); padding: 40px 24px;
}
.login-form-inner { width: 100%; max-width: 380px; }
.login-form-inner .mark {
    width: 52px; height: 52px; border-radius: 14px;
    background: linear-gradient(160deg, var(--brand-deep) 0%, var(--brand-deep-2) 100%);
    display: flex; align-items: center; justify-content: center;
    color: var(--brand); font-size: 22px; margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.login-form-inner h3 { font-weight: 800; margin-bottom: 6px; }
.login-form-inner .sub { color: var(--ink-soft); margin-bottom: 30px; font-size: 14px; }

.field-icon-wrap { position: relative; }
.field-icon-wrap input { padding-inline-end: 42px; }
.field-icon-wrap i {
    position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%);
    color: var(--ink-faint); font-size: 15px; pointer-events: none;
}

.login-trust {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    color: var(--ink-faint); font-size: 12.5px; margin-top: 20px;
}

.login-support-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #E7F8EF;
    border: 1px solid #CFEBDD;
}
.login-support-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.login-support-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.login-support-number {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #128C4A;
    text-decoration: none;
}
.login-support-number:hover { text-decoration: underline; color: #0F7A40; }

.login-brand-pane {
    flex: 1;
    display: flex; flex-direction: column; justify-content: space-between;
    background:
        radial-gradient(circle at 15% 15%, rgba(200,132,42,0.20), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(200,132,42,0.12), transparent 45%),
        linear-gradient(160deg, var(--brand-deep) 0%, var(--brand-deep-2) 100%);
    color: #F3E9D8;
    padding: 44px 52px;
    position: relative;
    overflow: hidden;
}
.login-brand-pane .top-lockup { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.login-brand-pane .top-lockup .mark {
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px;
}
.login-brand-pane .top-lockup .name { font-weight: 800; font-size: 17px; color: #FBF8F3; }
.login-brand-pane .top-lockup .tagline {
    font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #B8A98C; margin-top: 1px;
}

.login-brand-pane .headline { text-align: end; margin-top: 30px; }
.login-brand-pane .headline h1 { font-size: 28px; font-weight: 800; line-height: 1.35; color: #FBF8F3; margin-bottom: 14px; }
.login-brand-pane .headline p { font-size: 14.5px; line-height: 1.8; color: #C9BBA3; max-width: 460px; margin-inline-start: auto; }

.feature-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px;
}
.feature-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: 16px 18px;
    text-align: end;
}
.feature-card .fi {
    width: 34px; height: 34px; border-radius: 9px;
    background: rgba(200,132,42,0.18); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 15px;
    margin-inline-start: auto; margin-bottom: 10px;
}
.feature-card .ft { font-weight: 700; font-size: 13.8px; color: #FBF8F3; margin-bottom: 3px; }
.feature-card .fd { font-size: 12px; color: #A7987F; line-height: 1.5; }

.login-brand-pane .foot { font-size: 11.5px; color: #7A6F5C; text-align: end; }

@media (max-width: 900px) {
    .login-brand-pane { display: none; }
    .sidebar { position: fixed; inset-inline-end: -268px; z-index: 1050; transition: inset-inline-end .2s ease; }
    .sidebar.open { inset-inline-end: 0; }
}

/* ---------- Drag handle / playlist ---------- */
.drag-handle { cursor: grab; color: var(--ink-faint); }
.playlist-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.playlist-item.dragging { opacity: 0.5; }
.playlist-item .type-badge {
    width: 38px; height: 38px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-tint); color: var(--brand-dark); font-size: 15px; flex-shrink: 0;
}

/* ---------- Media grid ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.media-tile { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; position: relative; }
.media-tile img, .media-tile video { width: 100%; height: 110px; object-fit: cover; display: block; background: var(--paper); }
.media-tile .meta { padding: 8px 10px; font-size: 12px; color: var(--ink-soft); }

/* ---------- Screen pairing code display ---------- */
.screen-code-box {
    font-family: 'Cairo', monospace;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-align: center;
    background: var(--brand-tint);
    color: var(--brand-dark);
    border: 1.5px dashed var(--brand);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

/* ---------- Subscription banner (shown to branch admins) ---------- */
.subs-banner {
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: var(--panel);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 28px;
}
.subs-banner.state-active  { border-color: #CFEBDD; background: var(--ok-tint); }
.subs-banner.state-expiring{ border-color: #F2E0B0; background: var(--warn-tint); }
.subs-banner.state-expired { border-color: #F3CFC9; background: var(--danger-tint); }
.subs-banner .subs-item { font-size: 13px; color: var(--ink-soft); }
.subs-banner .subs-item strong { color: var(--ink); font-weight: 700; }
.subs-banner .subs-headline { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.subs-banner.state-active  .subs-headline { color: var(--ok); }
.subs-banner.state-expiring .subs-headline { color: var(--warn); }
.subs-banner.state-expired .subs-headline { color: var(--danger); }

/* ---------- Support page ---------- */
.support-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}
.support-icon-whatsapp { background: #E7F8EF; color: #25D366; }
.support-icon-phone    { background: var(--brand-tint); color: var(--brand); }
.support-number { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }
.btn-support-whatsapp {
    background: #25D366;
    border: none;
    color: #fff;
    font-weight: 700;
    border-radius: 10px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-support-whatsapp:hover { background: #1EBE59; color: #fff; }

/* ---------- Modals ---------- */
.modal-content { border-radius: var(--radius); border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom-color: var(--line); }
.modal-footer { border-top-color: var(--line); }

@media (max-width: 900px) {
    .sidebar { position: fixed; inset-inline-end: -268px; z-index: 1050; transition: inset-inline-end .2s ease; }
    .sidebar.open { inset-inline-end: 0; }
}
