/* ============================================
   ALM TASBIAAT Admin - SaaS-grade layout
   ============================================ */

:root {
    --primary-green: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --sidebar-bg: #0f172a;
    --sidebar-text: #e2e8f0;
    --sidebar-text-muted: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active: rgba(13, 148, 136, 0.2);
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --main-bg: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --card-radius: 12px;
    --gold: #c9a227;
}

body {
    background-color: var(--main-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* ---------- Login / standalone pages ---------- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-green));
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

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

.login-logo i {
    font-size: 48px;
    color: var(--primary-green);
}

.standalone-main {
    min-height: 100vh;
    padding: 1rem;
}

/* ---------- Admin layout (sidebar + main) ---------- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1030;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand a {
    color: white !important;
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

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

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    opacity: 0.9;
    width: 1.5rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #5eead4;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer .logout-link {
    color: var(--sidebar-text-muted);
}

.sidebar-footer .logout-link:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* Mobile: sidebar overlay */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    }

    body.sidebar-overlay-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1029;
    }
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

@media (max-width: 991.98px) {
    .admin-main {
        margin-left: 0;
    }
}

.admin-topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.admin-topbar .btn-link {
    text-decoration: none;
    padding: 0.5rem;
}

.topbar-title {
    font-weight: 600;
    margin-left: 0.5rem;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
}

@media (min-width: 992px) {
    .admin-content {
        padding: 2rem;
    }
}

/* ---------- Cards & content ---------- */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    background: white;
}

.card-header {
    background: white;
    color: #0f172a;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    padding: 1rem 1.25rem;
}

.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    border-radius: var(--card-radius);
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.stat-card.green { background: linear-gradient(135deg, var(--primary-green), var(--primary-dark)); }
.stat-card.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-card.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card.purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

/* ---------- Tables ---------- */
.table th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

.table td {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* ---------- Buttons ---------- */
.btn-success {
    background: var(--primary-green);
    border-color: var(--primary-green);
}

.btn-success:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-success {
    border-color: var(--primary-green);
    color: var(--primary-green);
}

.btn-outline-success:hover {
    background: var(--primary-light);
    border-color: var(--primary-green);
    color: var(--primary-dark);
}

.btn-action {
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
}

/* ---------- Badges ---------- */
.badge-category {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    font-weight: 500;
}

/* ---------- Forms ---------- */
.form-label {
    font-weight: 500;
    color: #334155;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* ---------- Arabic content ---------- */
.arabic-text {
    font-family: 'Traditional Arabic', 'Amiri', serif;
    font-size: 1.25rem;
    direction: rtl;
    text-align: right;
    line-height: 1.8;
}

textarea.arabic-input {
    font-family: 'Traditional Arabic', 'Amiri', serif;
    font-size: 1.2rem;
    direction: rtl;
    text-align: right;
    line-height: 1.8;
}

.content-preview {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Alerts ---------- */
.alert-floating {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1050;
    min-width: 300px;
    border-radius: var(--card-radius);
}

/* ---------- Page titles ---------- */
.admin-content .row.mb-4 h2 {
    color: #0f172a;
    font-weight: 700;
    font-size: 1.5rem;
}

.admin-content .text-muted {
    color: #64748b !important;
}

/* ---------- API docs ---------- */
.admin-content pre {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    font-size: 0.875rem;
}

.admin-content code {
    color: var(--primary-green);
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.admin-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}
