/* Tanzeel Admin - logo matched operations UI */

:root {
    --ink-950: #070806;
    --ink-900: #0d0f0c;
    --ink-850: #14140f;
    --ink-800: #1c1a14;
    --ink-700: #272419;
    --paper-50: #fbf4e3;
    --paper-100: #f3e8cc;
    --paper-200: #e4d3aa;
    --gold-300: #f3d98c;
    --gold-400: #d7b66b;
    --gold-500: #b8934f;
    --gold-600: #8d6a35;
    --clay-500: #a77653;
    --danger: #d96565;
    --success: #83c89a;
    --warning: #d7a957;
    --text-primary: #fbf4e3;
    --text-secondary: rgba(251, 244, 227, 0.72);
    --text-muted: rgba(251, 244, 227, 0.46);
    --border: rgba(243, 217, 140, 0.16);
    --border-strong: rgba(243, 217, 140, 0.28);
    --surface: rgba(251, 244, 227, 0.045);
    --surface-strong: rgba(251, 244, 227, 0.08);
    --radius-sm: 7px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
    --shadow-soft: 0 16px 42px rgba(0, 0, 0, 0.24);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background:
        linear-gradient(135deg, rgba(243, 217, 140, 0.08) 0%, transparent 34%),
        linear-gradient(225deg, rgba(167, 118, 83, 0.08) 0%, transparent 40%),
        var(--ink-950);
    line-height: 1.5;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(251, 244, 227, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(251, 244, 227, 0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, black, transparent 85%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Fraunces', 'Outfit', serif;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.05;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.brand-mark {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    background: #010200;
    box-shadow: 0 18px 44px rgba(184, 147, 79, 0.22);
}

.brand-mark.small {
    width: 46px;
    height: 46px;
    margin: 0 0 14px;
    border-radius: 12px;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Login */
#login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-container {
    width: min(440px, 100%);
    padding: 42px;
    background: linear-gradient(155deg, rgba(251, 244, 227, 0.085), rgba(251, 244, 227, 0.035));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--paper-50);
    font-size: 32px;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 30ch;
    margin: 0 auto;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea,
.search-box input,
.section-header select {
    width: 100%;
    padding: 12px 14px;
    color: var(--text-primary);
    background: rgba(7, 8, 6, 0.54);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-box input:focus,
.section-header select:focus {
    border-color: var(--gold-400);
    background: rgba(7, 8, 6, 0.72);
    box-shadow: 0 0 0 4px rgba(215, 182, 107, 0.13);
}

.form-group input::placeholder,
.search-box input::placeholder {
    color: var(--text-muted);
}

.error-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 180ms var(--ease), box-shadow 220ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    box-shadow: 0 12px 30px rgba(184, 147, 79, 0.28);
}

.btn-secondary {
    color: var(--text-primary);
    background: var(--surface);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
}

.btn-danger {
    color: #fff7f2;
    background: var(--danger);
}

.btn-full {
    width: 100%;
}

.btn-small {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 12px;
}

/* Layout */
#dashboard-screen {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    min-width: 270px;
    height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: rgba(13, 15, 12, 0.92);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.sidebar-header {
    padding: 26px 22px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 24px;
    color: var(--paper-50);
}

.sidebar-header span {
    display: block;
    margin-top: 5px;
    color: var(--gold-400);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 12px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: color 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--surface);
}

.nav-item.active {
    color: var(--gold-300);
    background: rgba(215, 182, 107, 0.12);
    border-color: rgba(215, 182, 107, 0.26);
}

.nav-icon,
.stat-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-weight: 800;
    letter-spacing: 0;
}

.nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: var(--gold-300);
    background: rgba(215, 182, 107, 0.10);
    border: 1px solid rgba(215, 182, 107, 0.16);
    font-size: 11px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
    font-size: 13px;
}

[data-icon="chart"]::before { content: "D"; }
[data-icon="users"]::before { content: "U"; }
[data-icon="expert"]::before { content: "E"; }
[data-icon="active"]::before { content: "A"; }
[data-icon="subscribed"]::before { content: "S"; }
[data-icon="recording"]::before { content: "R"; }
[data-icon="pending"]::before { content: "P"; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    min-height: 100vh;
    margin-left: 270px;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 18px 34px;
    background: rgba(7, 8, 6, 0.74);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

#page-title {
    font-size: 27px;
    color: var(--paper-50);
}

.content-section {
    padding: 32px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 124px;
    padding: 22px;
    background: linear-gradient(145deg, rgba(251, 244, 227, 0.075), rgba(251, 244, 227, 0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.stat-info h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    color: var(--paper-50);
}

.stat-info p {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Sections */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box input {
    width: min(340px, 42vw);
}

.section-header select {
    width: auto;
    min-width: 170px;
}

/* Tables */
.table-container {
    overflow: hidden;
    overflow-x: auto;
    background: rgba(13, 15, 12, 0.72);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

thead {
    background: rgba(251, 244, 227, 0.045);
}

th {
    padding: 14px 16px;
    color: var(--gold-400);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
}

td {
    padding: 15px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(243, 217, 140, 0.10);
    font-size: 14px;
}

tbody tr {
    transition: background 160ms var(--ease);
}

tbody tr:hover {
    background: rgba(215, 182, 107, 0.07);
}

tbody tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    padding: 36px 18px;
    color: var(--text-muted);
    text-align: center;
}

.action-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-active { background: rgba(131, 200, 154, 0.14); color: var(--success); }
.status-inactive { background: rgba(217, 101, 101, 0.14); color: var(--danger); }
.status-none { background: rgba(251, 244, 227, 0.08); color: var(--text-muted); }
.status-expired { background: rgba(215, 169, 87, 0.15); color: var(--warning); }
.status-cancelled { background: rgba(217, 101, 101, 0.14); color: var(--danger); }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(7, 8, 6, 0.78);
    backdrop-filter: blur(10px);
}

.modal-content {
    width: min(560px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(13, 15, 12, 0.98);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.modal-content.modal-small {
    max-width: 410px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 20px;
}

.close-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 20px;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.form-grid .form-group.full-width {
    grid-column: span 2;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold-500);
}

.checkbox-group label {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
}

/* Pagination and feedback */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-bottom: 10px;
}

.pagination button {
    min-width: 38px;
    min-height: 36px;
    padding: 8px 12px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--gold-400);
    background: rgba(215, 182, 107, 0.10);
}

.pagination button.active {
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    border-color: transparent;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    padding: 14px 18px;
    color: var(--text-primary);
    background: rgba(13, 15, 12, 0.98);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    font-size: 14px;
    animation: slideIn 220ms var(--ease);
}

.toast.success { border-color: rgba(131, 200, 154, 0.5); }
.toast.error { border-color: rgba(217, 101, 101, 0.55); }

@keyframes slideIn {
    from { transform: translateX(18px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Mobile */
.mobile-header {
    display: none;
    position: fixed;
    inset: 0 0 auto;
    z-index: 200;
    height: 62px;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    background: rgba(7, 8, 6, 0.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

.mobile-header h1 {
    font-size: 18px;
}

.menu-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.menu-btn span {
    width: 17px;
    height: 2px;
    background: var(--gold-300);
    border-radius: 999px;
}

@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 260ms var(--ease);
        z-index: 300;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: 62px;
    }

    .top-bar {
        display: none;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .form-group.full-width {
        grid-column: span 1;
    }
}

@media (max-width: 700px) {
    .login-container {
        padding: 32px 24px;
    }

    .content-section {
        padding: 18px;
    }

    .section-header,
    .search-box {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .search-box input,
    .section-header select {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 112px;
    }

    .table-container {
        margin: 0 -18px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .modal-content {
        max-height: calc(100vh - 24px);
    }

    .modal-actions {
        flex-direction: column-reverse;
    }
}

/* Account workspaces */
.account-note { grid-column: 1 / -1; color: #52645c; font-size: .875rem; line-height: 1.6; }
#account-error, #account-password-form [role="alert"] { color: #9d2828; }
.form-group textarea { width: 100%; border: 1px solid #c5cec6; border-radius: 8px; padding: 12px; font: inherit; color: #20352b; background: #fff; resize: vertical; }
:focus-visible { outline: 3px solid #49705c; outline-offset: 3px; }
.nav-item { cursor: pointer; }
.main-content { min-width: 0; }
.content-section { min-width: 0; }
.table-container { max-width: 100%; }
.account-note { color: var(--text-secondary); }
#account-error, #account-password-form [role="alert"] { color: #ffaaaa; }
@media(max-width:1024px) { .main-content { width: 100%; max-width: 100vw; } }
