/* Main Stylesheet for Sarraf Exchange & Financial Services System */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Kufi+Arabic:wght@300;400;500;600;700&display=swap');

:root {
    /* Base Color Tokens */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gray-950: #030712;

    /* Theme Accents (Default: Emerald) */
    --accent-50: #ecfdf5;
    --accent-100: #d1fae5;
    --accent-500: #10b981;
    --accent-600: #059669;
    --accent-700: #047857;

    /* Semantic Colors */
    --success: #20bf55;     /* Green: Income, positive balance, completed */
    --danger: #ef233c;      /* Red: Outgoing, shop debts, cancelled */
    --warning: #f77f00;     /* Orange: Pending, overdue, warnings */
    --info: #0077b6;        /* Blue: Information, cashbox balances */
    --deposit: #7209b7;     /* Purple: Deposits and transfers */

    /* Typography */
    --font-ltr: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-rtl: 'Noto Kufi Arabic', 'Outfit', sans-serif;

    /* Sidebar Widths */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

/* Light / Dark Mode Variables override */
[data-bs-theme="light"] {
    --bg-main: var(--gray-50);
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-500);
    --border-color: var(--gray-200);
    --bg-active: var(--gray-100);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] {
    --bg-main: var(--gray-950);
    --bg-card: var(--gray-900);
    --bg-sidebar: var(--gray-900);
    --text-primary: var(--gray-100);
    --text-secondary: var(--gray-400);
    --border-color: var(--gray-800);
    --bg-active: var(--gray-800);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* Color Accent Variations */
[data-theme-color="blue"] {
    --accent-50: #eff6ff;
    --accent-100: #dbeafe;
    --accent-500: #3b82f6;
    --accent-600: #2563eb;
    --accent-700: #1d4ed8;
}
[data-theme-color="emerald"] {
    --accent-50: #ecfdf5;
    --accent-100: #d1fae5;
    --accent-500: #10b981;
    --accent-600: #059669;
    --accent-700: #047857;
}
[data-theme-color="purple"] {
    --accent-50: #faf5ff;
    --accent-100: #f3e8ff;
    --accent-500: #a855f7;
    --accent-600: #9333ea;
    --accent-700: #7e22ce;
}
[data-theme-color="orange"] {
    --accent-50: #fff7ed;
    --accent-100: #ffedd5;
    --accent-500: #f97316;
    --accent-600: #ea580c;
    --accent-700: #c2410c;
}
[data-theme-color="red"] {
    --accent-50: #fef2f2;
    --accent-100: #fee2e2;
    --accent-500: #ef4444;
    --accent-600: #dc2626;
    --accent-700: #b91c1c;
}

/* Base resets & layouts */
body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-ltr);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body.rtl {
    font-family: var(--font-rtl);
}

/* Main Dashboard Grid */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    padding-bottom: 2rem;
}

/* Sidebar Styling */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.rtl .app-sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.app-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.5rem;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-item a i {
    font-size: 1.25rem;
    width: 24px;
    margin-right: 0.75rem;
}

.rtl .sidebar-item a i {
    margin-right: 0;
    margin-left: 0.75rem;
}

.sidebar-item a:hover, 
.sidebar-item.active a {
    background-color: var(--bg-active);
    color: var(--accent-500);
}

.app-sidebar.collapsed .sidebar-item a span,
.app-sidebar.collapsed .sidebar-brand span {
    display: none;
}

.app-sidebar.collapsed .sidebar-item a {
    justify-content: center;
    padding: 0.75rem;
}

.app-sidebar.collapsed .sidebar-item a i {
    margin: 0;
}

/* Header Styling */
.app-header {
    height: 70px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

/* Collapsible responsive container offsets */
.main-content {
    margin-left: 0;
}

/* Cards & Widgets */
.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Financial Color coding */
.bg-success-light { background-color: rgba(32, 191, 85, 0.1); color: var(--success); }
.bg-danger-light { background-color: rgba(239, 35, 60, 0.1); color: var(--danger); }
.bg-warning-light { background-color: rgba(247, 127, 0, 0.1); color: var(--warning); }
.bg-info-light { background-color: rgba(0, 119, 182, 0.1); color: var(--info); }
.bg-deposit-light { background-color: rgba(114, 9, 183, 0.1); color: var(--deposit); }

.border-success-custom { border-left: 4px solid var(--success) !important; }
.border-danger-custom { border-left: 4px solid var(--danger) !important; }
.border-warning-custom { border-left: 4px solid var(--warning) !important; }
.border-info-custom { border-left: 4px solid var(--info) !important; }
.border-deposit-custom { border-left: 4px solid var(--deposit) !important; }

.rtl .border-success-custom { border-left: none !important; border-right: 4px solid var(--success) !important; }
.rtl .border-danger-custom { border-left: none !important; border-right: 4px solid var(--danger) !important; }
.rtl .border-warning-custom { border-left: none !important; border-right: 4px solid var(--warning) !important; }
.rtl .border-info-custom { border-left: none !important; border-right: 4px solid var(--info) !important; }
.rtl .border-deposit-custom { border-left: none !important; border-right: 4px solid var(--deposit) !important; }

/* Tables and standard lists */
.table-custom {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-custom table {
    margin-bottom: 0;
}

.table-custom th {
    background-color: var(--bg-active);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem;
}

.table-custom td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table-custom tr:last-child td {
    border-bottom: none;
}

/* Modals */
.modal-content-custom {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

/* Utility Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
    animation: fadeIn 0.3s ease forwards;
}

/* Responsive sidebars for RTL vs LTR */
@media(max-width: 768px) {
    .app-sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        height: 100vh;
    }
    .rtl .app-sidebar {
        left: auto;
        right: calc(-1 * var(--sidebar-width));
    }
    .app-sidebar.show {
        left: 0;
    }
    .rtl .app-sidebar.show {
        left: auto;
        right: 0;
    }
}

/* Settings Tabs Design */
.settings-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    text-align: start;
}

.settings-tabs .nav-link.active {
    background-color: var(--accent-500);
    color: #fff !important;
}

/* Quick Exchange Widget Styles */
.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.rate-badge {
    background-color: var(--bg-active);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

/* Printing styles wrapper */
@media print {
    body * {
        visibility: hidden;
    }
    .print-area, .print-area * {
        visibility: visible;
    }
    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}


/* ============================================================
   Sarraf Pro 2026 visual refresh: RTL/LTR, clarity and dark mode
   ============================================================ */
:root {
    --sidebar-width: 284px;
    --sidebar-collapsed-width: 82px;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
}

[data-bs-theme="light"] {
    --bg-main: #f4f7fb;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-elevated: #ffffff;
    --text-primary: #142033;
    --text-secondary: #637083;
    --border-color: #e6ebf2;
    --bg-active: #edf7f3;
    --header-glass: rgba(255, 255, 255, .88);
}

[data-bs-theme="dark"] {
    --bg-main: #07111f;
    --bg-card: #101d2e;
    --bg-sidebar: #0b1727;
    --bg-elevated: #142338;
    --text-primary: #f2f6fc;
    --text-secondary: #aebbd0;
    --border-color: rgba(255, 255, 255, .10);
    --bg-active: rgba(16, 185, 129, .14);
    --header-glass: rgba(11, 23, 39, .90);
}

html, body { min-height: 100%; }
body {
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.65;
}
body.rtl { direction: rtl; }
body.ltr { direction: ltr; }
.rtl .app-wrapper { flex-direction: row-reverse; }
.ltr .app-wrapper { flex-direction: row; }

/* Sidebar */
.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    flex: 0 0 var(--sidebar-width);
    background: var(--bg-sidebar);
    border-color: var(--border-color);
    box-shadow: 0 0 30px rgba(0, 0, 0, .08);
}
.sidebar-brand { height: 78px; padding-inline: 1.2rem; }
.sidebar-brand a { width: 100%; }
.sidebar-brand .stat-icon {
    border-radius: 13px;
    box-shadow: 0 8px 18px rgba(16, 185, 129, .18);
}
.sidebar-menu { padding: .9rem .72rem 1.5rem; scrollbar-width: thin; }
.sidebar-item a {
    min-height: 46px;
    border-radius: 12px;
    padding: .72rem .86rem;
    margin-bottom: .18rem;
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid transparent;
}
.sidebar-item a i { color: inherit; text-align: center; }
.sidebar-item a:hover {
    color: var(--text-primary);
    background: var(--bg-active);
    border-color: rgba(16, 185, 129, .14);
    transform: translateX(2px);
}
.rtl .sidebar-item a:hover { transform: translateX(-2px); }
.sidebar-item.active a {
    color: var(--accent-500);
    background: linear-gradient(135deg, var(--bg-active), rgba(16, 185, 129, .07));
    border-color: rgba(16, 185, 129, .20);
    box-shadow: inset 3px 0 0 var(--accent-500);
}
.rtl .sidebar-item.active a { box-shadow: inset -3px 0 0 var(--accent-500); }
.app-sidebar.collapsed { flex-basis: var(--sidebar-collapsed-width); }

/* Header and workspace */
.main-content { min-width: 0; background: var(--bg-main); }
.app-header {
    min-height: 74px;
    height: auto;
    padding: .82rem 1.35rem;
    background: var(--header-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-color: var(--border-color);
}
.app-header .btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
    background: var(--bg-card);
}
.app-header .btn-outline-secondary:hover { color: var(--text-primary); background: var(--bg-active); }
main.container-fluid { max-width: 1720px; padding: 1.35rem !important; }

/* Cards */
.card, .stat-card, .table-custom, .modal-content, .dropdown-menu, .list-group-item {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.card, .stat-card, .table-custom { border-radius: var(--radius-md); }
.stat-card {
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}
.stat-card::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    inset-inline-end: -42px;
    top: -42px;
    border-radius: 50%;
    background: rgba(16, 185, 129, .05);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(0, 0, 0, .12); }
.stat-icon { border-radius: 14px; }

/* Dark-mode text clarity */
[data-bs-theme="dark"] .text-muted { color: var(--text-secondary) !important; }
[data-bs-theme="dark"] .text-body, [data-bs-theme="dark"] .text-dark { color: var(--text-primary) !important; }
[data-bs-theme="dark"] .bg-body-tertiary, [data-bs-theme="dark"] .bg-dark-subtle { background-color: var(--bg-elevated) !important; }
[data-bs-theme="dark"] .table { --bs-table-color: var(--text-primary); --bs-table-bg: transparent; --bs-table-hover-color: #fff; --bs-table-hover-bg: rgba(255,255,255,.035); }
[data-bs-theme="dark"] .dropdown-item { color: var(--text-primary); }
[data-bs-theme="dark"] .dropdown-item:hover, [data-bs-theme="dark"] .dropdown-item:focus { background: var(--bg-active); color: #fff; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select {
    color: var(--text-primary);
    background-color: #0b1727;
    border-color: rgba(255,255,255,.14);
}
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus {
    background-color: #0d1b2d;
    color: #fff;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 .2rem rgba(16,185,129,.15);
}
[data-bs-theme="dark"] .form-control::placeholder { color: #8694aa; }
[data-bs-theme="dark"] .table-custom th { color: #d4deed; background: #142338; }
[data-bs-theme="dark"] .border-bottom, [data-bs-theme="dark"] .border-top, [data-bs-theme="dark"] hr { border-color: var(--border-color) !important; opacity: 1; }

/* Buttons and table polish */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: linear-gradient(135deg, var(--accent-500), var(--accent-700)); border: 0; box-shadow: 0 7px 16px rgba(16,185,129,.18); }
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.table-custom { box-shadow: 0 8px 24px rgba(0,0,0,.055); }
.table-custom table { color: var(--text-primary); }
.table-custom th { white-space: nowrap; }
.badge { border-radius: 999px; padding: .42em .68em; }
.dropdown-menu { border-radius: 14px; box-shadow: 0 18px 35px rgba(0,0,0,.16); }

/* RTL/LTR alignment helpers */
.rtl .settings-tabs .nav-link { text-align: right; }
.ltr .settings-tabs .nav-link { text-align: left; }
.rtl .border-start { border-right: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; border-left: 0 !important; }
.rtl .text-end { text-align: left !important; }
.ltr .text-end { text-align: right !important; }

.sidebar-backdrop { display: none; }
@media (max-width: 768px) {
    .app-sidebar { position: fixed; top: 0; bottom: 0; height: 100vh; width: min(86vw, var(--sidebar-width)); z-index: 1060; }
    .ltr .app-sidebar { left: calc(-1 * var(--sidebar-width)); right: auto; }
    .rtl .app-sidebar { right: calc(-1 * var(--sidebar-width)); left: auto; }
    .ltr .app-sidebar.show { left: 0; }
    .rtl .app-sidebar.show { right: 0; }
    .app-sidebar.collapsed { width: min(86vw, var(--sidebar-width)); }
    .app-sidebar.collapsed .sidebar-item a span, .app-sidebar.collapsed .sidebar-brand span { display: inline; }
    .app-sidebar.collapsed .sidebar-item a { justify-content: flex-start; padding: .72rem .86rem; }
    .rtl .app-sidebar.collapsed .sidebar-item a { justify-content: flex-start; }
    .app-sidebar.collapsed .sidebar-item a i { margin-inline-end: .75rem; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(2px); z-index: 1055; }
    .sidebar-backdrop.show { display: block; }
    .app-header { padding-inline: .85rem; }
    .app-header .gap-3 { gap: .55rem !important; }
    main.container-fluid { padding: .95rem !important; }
    .stat-card { padding: 1rem; }
}
