/* ============================================
   MasterLibya Design Management System
   Brand Colors:
     - Charcoal:  #2D2D2D
     - Orange:    #F5921B
     - Gold:      #E8A838
     - Dark:      #1A1A1A
     - Light:     #F8F6F3
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;500;600;700&family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1A1A1A;
    --sidebar-color: #9CA3AF;
    --sidebar-active: #F5921B;
    --sidebar-hover: #2D2D2D;
    --topbar-height: 64px;
    --primary: #F5921B;
    --primary-dark: #D97B0E;
    --primary-light: #FDB34D;
    --charcoal: #2D2D2D;
    --charcoal-dark: #1A1A1A;
    --charcoal-light: #3D3D3D;
    --gold: #E8A838;
    --cream: #F8F6F3;
}

/* ============================================
   Global
   ============================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f1f5f9;
    color: #334155;
}

.cursor-pointer {
    cursor: pointer;
}

/* ============================================
   AUTH PAGE - Horizontal Split Premium
   ============================================ */

.auth-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #FFFFFF;
    overflow: hidden;
    font-family: 'Tajawal', 'Inter', sans-serif;
}

/* ── Split Layout ── */
.auth-split {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ── LEFT: Brand showcase (dark) ── */
.auth-brand-side {
    flex: 0 0 48%;
    background: var(--charcoal-dark);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    overflow: hidden;
}

/* Background pattern */
.brand-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(30deg, rgba(245,146,27,0.03) 1px, transparent 1px),
        linear-gradient(150deg, rgba(245,146,27,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Floating glows */
.brand-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
}
.brand-glow-1 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(245,146,27,0.15), transparent 70%);
    top: -10%; right: -10%;
    animation: glowDrift1 20s ease-in-out infinite;
}
.brand-glow-2 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(232,168,56,0.1), transparent 70%);
    bottom: -5%; left: -10%;
    animation: glowDrift2 25s ease-in-out infinite;
}

@keyframes glowDrift1 {
    0%, 100% { transform: translate(0,0); }
    50% { transform: translate(-40px, 30px); }
}
@keyframes glowDrift2 {
    0%, 100% { transform: translate(0,0); }
    50% { transform: translate(30px, -20px); }
}

/* Brand content */
.brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 380px;
}

.brand-logo-wrap {
    margin-bottom: 2.5rem;
}

.brand-logo-wrap img {
    max-width: 240px;
    height: auto;
    filter: brightness(1.15);
}

.brand-divider {
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    margin: 0 auto 2rem;
}

.brand-title {
    font-family: 'Tajawal', 'Playfair Display', sans-serif;
    font-size: 2.8rem;
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.3;
    margin-bottom: 1rem;
    letter-spacing: 0;
}

.brand-subtitle {
    color: rgba(255,255,255,0.4);
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 0.03em;
    margin-bottom: 2.5rem;
}

/* Feature badges */
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255,255,255,0.35);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.brand-feature i {
    color: var(--primary);
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
}

/* Brand footer */
.brand-footer {
    position: absolute;
    bottom: 2rem;
    left: 0; right: 0;
    text-align: center;
    color: rgba(255,255,255,0.15);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    z-index: 2;
}

/* ── RIGHT: Login form (white) ── */
.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: #FFFFFF;
    position: relative;
}

/* Subtle border accent between panels */
.auth-form-side::before {
    content: '';
    position: absolute;
    top: 15%; bottom: 15%; right: 0;
    width: 3px;
    background: linear-gradient(180deg, transparent, var(--primary), var(--gold), var(--primary), transparent);
    border-radius: 3px;
}

[dir="ltr"] .auth-form-side::before {
    right: auto;
    left: 0;
}

.auth-form-inner {
    width: 100%;
    max-width: 400px;
    animation: formSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes formSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Login Header ── */
.login-header {
    margin-bottom: 2rem;
}

.login-header h4 {
    font-family: 'Tajawal', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--charcoal);
    margin-bottom: 0.35rem;
}

.login-header p {
    color: #9CA3AF;
    font-size: 0.9rem;
    font-weight: 400;
    margin: 0;
}

/* ── Form Fields ── */
.field-group {
    margin-bottom: 1.25rem;
}

.field-group label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6B7280;
    margin-bottom: 0.5rem;
}

.field-group label i {
    color: var(--primary);
    font-size: 0.8rem;
}

.field-input {
    display: block;
    width: 100%;
    padding: 0.85rem 1.1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--charcoal);
    background: #F9FAFB;
    border: 2px solid #E5E7EB;
    border-radius: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.field-input::placeholder {
    color: #C0C5CE;
}

.field-input:focus {
    background: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(245,146,27,0.08), 0 2px 12px rgba(245,146,27,0.06);
}

.field-password-wrap {
    position: relative;
}

.field-password-wrap .field-input {
    padding-left: 3rem;
}

.field-eye {
    position: absolute;
    top: 50%; left: 0.9rem; right: auto;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem;
    transition: color 0.2s;
}

.field-eye:hover {
    color: var(--primary);
}

/* ── Login Button ── */
.btn-login {
    display: block;
    width: 100%;
    padding: 0.95rem;
    margin-top: 0.5rem;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.35s ease;
    font-family: inherit;
}

.btn-login-text {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login-shine {
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    z-index: 1;
    transition: left 0.5s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245,146,27,0.3);
}

.btn-login:hover .btn-login-shine {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Security Note ── */
.login-security {
    text-align: center;
    margin-top: 1.25rem;
    color: #C0C5CE;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.login-security i {
    color: #22C55E;
    margin-right: 0.2rem;
}

/* ── Demo Accounts ── */
.login-demo {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid #F3F4F6;
    position: relative;
}

.login-demo::before {
    content: '';
    position: absolute;
    top: -1px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    border-radius: 1px;
}

.demo-label {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9CA3AF;
    margin-bottom: 0.75rem;
}

.demo-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.demo-table td {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    background: #F9FAFB;
    border: none;
}

.demo-table tr td:first-child {
    border-radius: 0 8px 8px 0;
}

.demo-table tr td:last-child {
    border-radius: 8px 0 0 8px;
    text-align: left;
}

.demo-role {
    color: #9CA3AF;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.demo-table code {
    background: rgba(245,146,27,0.08);
    color: var(--charcoal);
    padding: 0.15em 0.45em;
    border-radius: 5px;
    font-size: 0.78rem;
}

.demo-pass {
    color: var(--primary);
    font-weight: 700;
}

/* ── Alerts on white background ── */
.alert-sm {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: none;
}

.auth-form-side .alert-danger {
    background: #FEF2F2;
    color: #991B1B;
}

.auth-form-side .alert-success {
    background: #F0FDF4;
    color: #166534;
}

.auth-form-side .alert-warning {
    background: #FFFBEB;
    color: #92400E;
}

.auth-form-side .spinner-border-sm {
    width: 1rem; height: 1rem;
    border-width: 2px;
}

/* ── Mobile: stack vertically ── */
@media (max-width: 991.98px) {
    .auth-split {
        flex-direction: column;
    }
    .auth-brand-side {
        flex: 0 0 auto;
        padding: 2.5rem 2rem;
        min-height: auto;
    }
    .brand-title {
        font-size: 2rem;
    }
    .brand-title br { display: none; }
    .brand-features { flex-direction: row; flex-wrap: wrap; justify-content: center; }
    .auth-form-side { padding: 2rem 1.5rem; }
    .auth-form-side::before { display: none; }
    .brand-footer { position: static; margin-top: 2rem; }
}

@media (max-width: 575.98px) {
    .auth-brand-side { padding: 2rem 1.5rem; }
    .brand-logo-wrap img { max-width: 180px; }
    .brand-title { font-size: 1.6rem; }
    .brand-features { display: none; }
    .auth-form-side { padding: 1.5rem; }
    .login-header h4 { font-size: 1.5rem; }
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-color);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-nav-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.75rem 1.5rem 0.5rem;
    margin-top: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: var(--sidebar-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.sidebar-link.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-toggle {
    color: #94a3b8;
    text-decoration: none;
    padding: 0;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

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

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--charcoal);
}

.content-area {
    padding: 1.5rem;
}

/* ============================================
   User Avatar / Dropdown
   ============================================ */

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
}

.user-avatar-lg {
    width: 60px;
    height: 60px;
    font-size: 1.25rem;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #475569;
    text-decoration: none;
    padding: 0.25rem 0;
}

.user-dropdown:hover,
.user-dropdown::after {
    color: var(--charcoal);
}

/* ============================================
   Stat Cards
   ============================================ */

.stat-card {
    border-radius: 12px;
    border: none;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card-body {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.stat-card-primary { background: #fff; }
.stat-card-primary .stat-icon { background: #FFF3E0; color: var(--primary); }
.stat-card-primary .stat-value { color: var(--charcoal); }

.stat-card-warning { background: #fff; }
.stat-card-warning .stat-icon { background: #fef3c7; color: #d97706; }
.stat-card-warning .stat-value { color: #92400e; }

.stat-card-info { background: #fff; }
.stat-card-info .stat-icon { background: #e0e7ff; color: #4f46e5; }
.stat-card-info .stat-value { color: #3730a3; }

.stat-card-success { background: #fff; }
.stat-card-success .stat-icon { background: #d1fae5; color: #059669; }
.stat-card-success .stat-value { color: #065f46; }

/* ============================================
   Cards
   ============================================ */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* ============================================
   Tables
   ============================================ */

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom-width: 1px;
    padding: 0.75rem 1rem;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

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

/* ============================================
   Badges
   ============================================ */

.badge-sm {
    font-size: 0.65rem;
    padding: 0.2em 0.5em;
}

/* ============================================
   Color Swatches
   ============================================ */

.color-swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
}

/* ============================================
   Progress Tracker
   ============================================ */

.progress-tracker {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: #94a3b8;
    font-size: 0.9rem;
    position: relative;
}

.progress-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 36px;
    width: 2px;
    height: 20px;
    background: #e2e8f0;
}

.progress-step.active:not(:last-child)::before {
    background: var(--primary);
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.progress-step.active .step-indicator {
    background: var(--primary);
    color: #fff;
}

.progress-step.current .step-indicator {
    box-shadow: 0 0 0 4px rgba(245, 146, 27, 0.2);
}

.progress-step.active {
    color: var(--charcoal);
}

.progress-step.current {
    font-weight: 600;
}

/* ============================================
   Sidebar Overlay (mobile)
   ============================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ============================================
   Global Overrides - Brand Colors
   ============================================ */

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.text-primary { color: var(--primary) !important; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .content-area {
        padding: 1rem;
    }
    .stat-card-body {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================
   Utilities
   ============================================ */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alert {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
