/* assets/css/theme.css */

/* --- 1. VARIABLES & RESET --- */
:root {
    /* Base Variables (Default Light Theme) */
    --primary: #7367F0;
    --primary-light: #8e85f3;
    --primary-dark: #6258d1;
    --primary-soft: rgba(115, 103, 240, 0.1);

    --secondary: #8e9196;
    --success: #28C76F;
    --danger: #EA5455;
    --warning: #FF9F43;
    --info: #00CFE8;

    /* Backgrounds */
    --bg-body: #F8F7FF;
    --bg-card: #FFFFFF;
    --bg-sidebar: rgba(255, 255, 255, 0.7);
    --bg-header: rgba(255, 255, 255, 0.5);

    /* Glassmorphism Props */
    --glass-bg: rgba(255, 255, 255, 0.5);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: blur(12px);

    /* Text */
    --text-main: #34335c;
    --text-light: #676782;
    --text-muted: #a1a1b5;

    /* Spacing & Borders */
    --radius: 1rem;
    --radius-sm: 0.6rem;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 10px 40px rgba(115, 103, 240, 0.1);
    --border-color: #e6e6f2;

    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    /* Updated for clean & professional look */
}

/* --- THEME: REFINED LIGHT (Modern Clean Purple) --- */
[data-theme="refined-light"] {
    --bg-body: #F4F6FB;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-header: #FFFFFF;
    --primary: #6C63FF;
    --primary-light: #8b85ff;
    --primary-dark: #5a52e0;
    --primary-soft: rgba(108, 99, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(108, 99, 255, 0.08);
    --glass-blur: blur(12px);
    --text-main: #1e1b4b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e8eaf0;
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-premium: 0 8px 30px rgba(108, 99, 255, 0.08);
    --radius: 14px;
    --radius-sm: 10px;
}

/* --- THEME: MOROCCAN WARM (Dark Gold/Brown) --- */
[data-theme="moroccan-warm"] {
    --bg-body: #1a1310;
    --bg-card: #261e18;
    --bg-sidebar: #1f1712;
    --bg-header: #1f1712;
    --primary: #D4A843;
    --primary-light: #e0be6a;
    --primary-dark: #b8912e;
    --primary-soft: rgba(212, 168, 67, 0.12);
    --glass-bg: rgba(38, 30, 24, 0.9);
    --glass-border: rgba(212, 168, 67, 0.1);
    --glass-blur: blur(10px);
    --text-main: #f5efe6;
    --text-light: #9b8b79;
    --text-muted: #6d5f50;
    --border-color: rgba(255, 255, 255, 0.07);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-premium: 0 10px 40px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --radius-sm: 8px;
    --secondary: #9b8b79;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fb923c;
    --info: #D4A843;
}

/* --- THEME: DEEP DARK (Pro Blue/Cyan) --- */
[data-theme="deep-dark"] {
    --bg-body: #0d0f14;
    --bg-card: #161921;
    --bg-sidebar: #111318;
    --bg-header: #111318;
    --primary: #3B82F6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --primary-soft: rgba(59, 130, 246, 0.1);
    --glass-bg: rgba(22, 25, 33, 0.9);
    --glass-border: rgba(59, 130, 246, 0.08);
    --glass-blur: blur(10px);
    --text-main: #e2e8f0;
    --text-light: #64748b;
    --text-muted: #475569;
    --border-color: rgba(255, 255, 255, 0.06);
    --shadow-soft: 0 4px 30px rgba(0, 0, 0, 0.5);
    --shadow-premium: 0 10px 40px rgba(0, 0, 0, 0.6);
    --radius: 12px;
    --radius-sm: 8px;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
}

/* Dark Mode Overrides for Hardcoded Styles */
[data-theme="moroccan-warm"] .form-control {
    background: #2d2319 !important;
    border-color: rgba(255,255,255,0.1) !important;
    color: #f5efe6 !important;
}
[data-theme="deep-dark"] .form-control {
    background: #1a1d27 !important;
    border-color: rgba(255,255,255,0.08) !important;
    color: #e2e8f0 !important;
}

[data-theme="moroccan-warm"] .custom-table th {
    background-color: #2d2319 !important;
    color: #9b8b79 !important;
    border-color: rgba(255,255,255,0.07) !important;
}
[data-theme="deep-dark"] .custom-table th {
    background-color: #1a1d27 !important;
    color: #64748b !important;
    border-color: rgba(255,255,255,0.06) !important;
}

[data-theme="moroccan-warm"] .custom-table td {
    border-color: rgba(255,255,255,0.07) !important;
    color: #f5efe6 !important;
}
[data-theme="deep-dark"] .custom-table td {
    border-color: rgba(255,255,255,0.06) !important;
    color: #e2e8f0 !important;
}

[data-theme="moroccan-warm"] .nav-link:hover,
[data-theme="deep-dark"] .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="moroccan-warm"] .page-header h2,
[data-theme="deep-dark"] .page-header h2,
[data-theme="moroccan-warm"] .page-header p,
[data-theme="deep-dark"] .page-header p {
    color: #D0D2D6 !important;
}

[data-theme="moroccan-warm"] .custom-table tbody tr:hover {
    background-color: #332a1f !important;
}
[data-theme="deep-dark"] .custom-table tbody tr:hover {
    background-color: #1e2230 !important;
}

/* --- Dark Themes: Bootstrap text & card overrides --- */
[data-theme="moroccan-warm"] .text-muted,
[data-theme="deep-dark"] .text-muted {
    color: var(--text-light) !important;
}

[data-theme="moroccan-warm"] .card,
[data-theme="deep-dark"] .card {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

[data-theme="moroccan-warm"] .card .fw-bold,
[data-theme="deep-dark"] .card .fw-bold {
    color: var(--text-main) !important;
}

[data-theme="moroccan-warm"] .card .text-uppercase,
[data-theme="deep-dark"] .card .text-uppercase {
    color: var(--text-light) !important;
}

[data-theme="moroccan-warm"] .card .text-success {
    color: #4ade80 !important;
}
[data-theme="moroccan-warm"] .card .text-primary {
    color: #D4A843 !important;
}
[data-theme="moroccan-warm"] .card .text-warning {
    color: #fb923c !important;
}
[data-theme="moroccan-warm"] .card .text-info {
    color: #D4A843 !important;
}
[data-theme="moroccan-warm"] .card .text-secondary {
    color: #9b8b79 !important;
}

[data-theme="deep-dark"] .card .text-success {
    color: #10b981 !important;
}
[data-theme="deep-dark"] .card .text-primary {
    color: #60a5fa !important;
}
[data-theme="deep-dark"] .card .text-warning {
    color: #f59e0b !important;
}
[data-theme="deep-dark"] .card .text-info {
    color: #06b6d4 !important;
}
[data-theme="deep-dark"] .card .text-secondary {
    color: #94a3b8 !important;
}

/* Sidebar, header, glass elements */
[data-theme="moroccan-warm"] .sidebar,
[data-theme="deep-dark"] .sidebar {
    background: var(--bg-sidebar) !important;
    border-color: var(--border-color) !important;
}

[data-theme="moroccan-warm"] #top-bar,
[data-theme="deep-dark"] #top-bar {
    background: var(--bg-header) !important;
    border-color: var(--border-color) !important;
}

[data-theme="moroccan-warm"] .glass-card,
[data-theme="deep-dark"] .glass-card {
    background: var(--glass-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}

[data-theme="moroccan-warm"] .modal-content,
[data-theme="deep-dark"] .modal-content {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
}

[data-theme="moroccan-warm"] .dropdown-menu,
[data-theme="deep-dark"] .dropdown-menu {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="moroccan-warm"] .table,
[data-theme="deep-dark"] .table {
    color: var(--text-main) !important;
    --bs-table-bg: var(--bg-card) !important;
    --bs-table-striped-bg: var(--bg-card) !important;
    --bs-table-hover-bg: rgba(255,255,255,0.03) !important;
}

[data-theme="moroccan-warm"] .table th,
[data-theme="deep-dark"] .table th {
    background-color: var(--bg-body) !important;
    color: var(--text-light) !important;
    border-color: var(--border-color) !important;
}

[data-theme="moroccan-warm"] .table td,
[data-theme="deep-dark"] .table td {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

[data-theme="moroccan-warm"] .table tbody tr,
[data-theme="deep-dark"] .table tbody tr {
    background-color: var(--bg-card) !important;
}

[data-theme="moroccan-warm"] .table tbody tr:hover td,
[data-theme="deep-dark"] .table tbody tr:hover td {
    background-color: rgba(255,255,255,0.04) !important;
}

[data-theme="moroccan-warm"] .table-responsive,
[data-theme="deep-dark"] .table-responsive {
    background-color: var(--bg-card) !important;
    border-radius: var(--radius) !important;
}

/* Badge overrides for dark themes */
[data-theme="moroccan-warm"] .badge,
[data-theme="deep-dark"] .badge {
    font-weight: 600 !important;
}

[data-theme="moroccan-warm"] .btn-outline-primary,
[data-theme="deep-dark"] .btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

[data-theme="moroccan-warm"] small,
[data-theme="deep-dark"] small {
    color: var(--text-light) !important;
}

/* Keep white text on gradient card (card 3) */
[data-theme="moroccan-warm"] .stat-card.text-white *,
[data-theme="deep-dark"] .stat-card.text-white * {
    color: #fff !important;
}
[data-theme="moroccan-warm"] .stat-card.text-white .opacity-75,
[data-theme="deep-dark"] .stat-card.text-white .opacity-75 {
    color: rgba(255,255,255,0.75) !important;
}

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

/* --- 2. GLOBAL LAYOUT --- */
body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    background-image:
        radial-gradient(at 0% 0%, rgba(115, 103, 240, 0.05) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(115, 103, 240, 0.03) 0, transparent 50%);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    font-size: 13.5px;
    /* Reduced from 15px */
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.brand h2 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- 2. GLOBAL LAYOUT --- */
.sidebar {
    width: 260px;
    /* Restored width for elegance */
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    margin: 20px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Subtle glass border */
    display: flex;
    flex-direction: column;
    padding: 2rem 1.2rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    flex-shrink: 0;
    border-radius: 20px;
    /* Softer corners */
    overflow: hidden;
}

/* Main Content (Right) */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: margin-left 0.4s ease;
}

/* Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        margin: 0;
        height: 100vh;
        max-height: 100vh;
        width: 280px;
        border-radius: 0;
        z-index: 9999;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
        padding: 1.5rem;
        background: var(--bg-card);
    }

    .sidebar.active {
        left: 0;
    }

    #app {
        overflow-x: hidden;
    }

    main {
        width: 100vw;
    }

    #top-bar {
        padding: 0.8rem 1rem !important;
        margin: 10px !important;
    }

    #content-area {
        padding: 1rem !important;
    }
}

#top-bar {
    position: relative;
    z-index: 1001;
    margin: 20px 20px 0 20px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.03);
}

#content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    scroll-behavior: smooth;
}

/* --- 3. COMPONENTS --- */

/* Brand */
.brand {
    padding: 0.5rem 0 2.5rem 0.5rem;
    /* More spacing below brand */
    text-align: left;
    /* Aligned left for premium feel */
}

.brand h2 {
    font-size: 1.6rem;
    font-weight: 800;
    /* Bolder */
    color: var(--text-main);
    /* Darker, cleaner */
    text-transform: none;
    /* Removed uppercase for elegance */
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

/* Navigation - Premium Refined */
.nav-menu {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    /* Hide scrollbar */
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    /* Increased vertical gap */
}

.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    /* Wider gap between icon and text */
    padding: 0.85rem 1.2rem;
    margin-bottom: 2px;
    color: var(--text-muted);
    /* Softer default color */
    text-decoration: none;
    border-radius: 14px;
    /* Soft rounding */
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid transparent;
    /* Prevent jump on active */
    position: relative;
    letter-spacing: 0.01em;
}

.nav-link i {
    font-size: 1.3rem;
    transition: all 0.3s ease;
    opacity: 0.8;
    width: 24px;
    /* Fixed width for alignment */
    text-align: center;
}

/* Subtle Hover */
.nav-link:hover {
    color: var(--text-main);
    background-color: rgba(0, 0, 0, 0.02);
    transform: translateX(3px);
    /* Gentle movement */
}

.nav-link:hover i {
    opacity: 1;
    color: var(--primary);
    transform: scale(1.05);
    /* Subtle scale */
}

/* Premium Active State: No full color block, just refined accent */
.nav-link.active {
    background-color: var(--primary-soft);
    /* Very light tint */
    color: var(--primary);
    font-weight: 700;
    box-shadow: none;
    /* Clean flat look */
}

.nav-link.active i {
    color: var(--primary);
    opacity: 1;
    transform: scale(1.1);
}

/* Removed the sliding background ::before for a cleaner look */
.nav-link::before {
    display: none;
}

.nav-divider {
    margin: 1rem 0.5rem;
    border-top: 1px solid var(--border-color);
    opacity: 0.4;
}

/* Cards (Standardized) */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1.2rem;
    /* Reduced from 1.5rem */
    margin-bottom: 1.2rem;
    /* Reduced from 1.5rem */
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

/* Titles */
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
}

.card h2,
.card h3,
.card h4 {
    color: var(--text-main);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.65rem 1.3rem;
    /* Reduced from 0.8rem 1.6rem */
    font-size: 0.9rem;
    /* Reduced from 0.95rem */
    font-weight: 600;
    font-family: var(--font-heading);
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 0.4rem;
}

.btn-xs {
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 0.3rem;
    line-height: 1.2;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.03em;
    min-width: 75px;
    /* Ensure visual consistency */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Removed btn-icon as we are back to text */
.btn-icon-only {
    /* Renamed just in case needed elsewhere, but mainly redundant now */
    width: 28px;
    height: 28px;
    padding: 0;
    min-width: auto;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(115, 103, 240, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-light);
}

.btn-outline:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, #28C76F 0%, #17a356 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #EA5455 0%, #c4383a 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #FF9F43 0%, #ffc107 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #00CFE8 0%, #00b0c7 100%);
    color: white;
}

/* Inputs */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.custom-table th {
    background-color: #fbfcff;
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 1.2rem 1rem;
    color: var(--text-muted);
    border-bottom: 2px solid #f1f0f7;
    text-align: left;
}

.custom-table td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid #f1f0f7;
    color: var(--text-main);
    vertical-align: middle;
    font-size: 0.95rem;
}

.custom-table tbody tr {
    transition: all 0.2s ease;
}

.custom-table tbody tr:hover {
    background-color: var(--primary-soft) !important;
}

/* Badges */
/* Badges & Utilities */
.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.bg-light-success {
    background: rgba(40, 199, 111, 0.12);
    color: var(--success);
}

.bg-light-danger {
    background: rgba(234, 84, 85, 0.12);
    color: var(--danger);
}

.bg-light-warning {
    background: rgba(255, 159, 67, 0.12);
    color: var(--warning);
}

.bg-light-primary {
    background: rgba(115, 103, 240, 0.12);
    color: var(--primary);
}

.bg-light-info {
    background: rgba(0, 207, 232, 0.12);
    color: var(--info);
}

/* Utilities */
.hidden {
    display: none !important;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 0.5rem;
}

.w-100 {
    width: 100%;
}

.text-right {
    text-align: right;
}

.mb-2 {
    margin-bottom: 1rem;
}

/* Modal Premium 2.0 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 26, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-container {
    width: 100%;
    max-width: 650px;
    margin: auto;
}

.modal-content-premium {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 0;
    width: 100%;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    position: relative;
}

.modal-header-premium {
    padding: 1.5rem 2rem;
    background: var(--primary);
    color: white;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

/* --- 4. ANIMATIONS & INTERACTIONS --- */

/* Page Transition Fade In */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-entry {
    animation: fadeInScale 0.35s ease-out forwards;
}

/* Table Row Hover Effect */
.custom-table tbody tr {
    transition: background-color 0.2s ease;
}

.custom-table tbody tr:hover {
    background-color: #f3f2ff !important;
    /* Very light purple tint */
    cursor: default;
}

/* --- 5. REPORTS MODULE (Arabic/RTL) --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    direction: rtl;
    /* Enforce RTL for Grid */
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.kpi-trend {
    font-size: 0.8rem;
    color: var(--text-light);
}

.reports-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    direction: rtl;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    margin: 0;
    white-space: nowrap;
}

.reports-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 5px;
    direction: rtl;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.75rem 1.7rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(115, 103, 240, 0.05);
    color: var(--primary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(115, 103, 240, 0.3);
}

.tab-content {
    display: none;
    animation: fadeInScale 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

/* --- 6. NOTIFICATIONS --- */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(234, 84, 85, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(234, 84, 85, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(234, 84, 85, 0);
    }
}

.notif-item:hover {
    background-color: #f8f8f8 !important;
}

[data-theme="dark"] #notif-menu {
    background: #283046 !important;
    border-color: #3b4253 !important;
    color: #D0D2D6 !important;
}

[data-theme="dark"] .notif-item {
    border-bottom-color: #3b4253 !important;
}

[data-theme="dark"] .notif-item.unread {
    background: rgba(115, 103, 240, 0.08) !important;
}

[data-theme="dark"] .notif-item:hover {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Floating Toast Notification */
.floating-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.floating-toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(115, 103, 240, 0.1);
    border-radius: 12px;
    padding: 15px;
    width: 330px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s ease;
}

.floating-toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

[data-theme="dark"] .floating-toast {
    background: rgba(43, 51, 70, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

.floating-toast .notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 15px;
    flex-shrink: 0;
}

.floating-toast .notif-content {
    flex: 1;
}

.floating-toast .notif-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 3px;
}

[data-theme="dark"] .floating-toast .notif-title {
    color: #eee;
}

.floating-toast .notif-msg {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

[data-theme="dark"] .floating-toast .notif-msg {
    color: #b4b7bd;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* --- 7. PRODUCTS & FAMILIES PREMIUM COMPONENTS --- */
.view-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 1000px;
    max-width: 95%;
    border-radius: 20px;
    box-shadow: var(--shadow-premium);
    border: 1px solid rgba(255, 255, 255, 0.4);
    overflow: hidden;
    animation: premiumModalIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes premiumModalIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.view-header {
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.3);
}

.view-body {
    padding: 1rem 1.5rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .view-body {
        grid-template-columns: 1fr;
    }
}

.p-img-wrapper,
.k-img-wrapper {
    width: 100%;
    height: 0;
    padding-bottom: 133.33%;
    /* 3:4 Aspect Ratio */
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    background-color: #f8f8f8;
    /* Bulletproof Fallback: CSS Background */
    background-image: url('../img/placeholder.png');
    background-size: cover;
    background-position: center;
}

.view-img-container {
    width: 100%;
    height: 240px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
}

.p-img-wrapper img,
.k-img-wrapper img,
.view-img-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.view-fam-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.view-sku {
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    color: var(--text-light);
    background: #f1f0f7;
    padding: 4px 10px;
    border-radius: 5px;
    display: inline-block;
}

.info-box {
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.info-box:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.info-box.purple {
    background: rgba(115, 103, 240, 0.03);
    border-color: rgba(115, 103, 240, 0.1);
}

.info-box.green {
    background: rgba(40, 199, 111, 0.03);
    border-color: rgba(40, 199, 111, 0.1);
}

.info-box .label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.info-box .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.view-stock-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    min-width: 60px;
}

.view-stock-item span:first-child {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-light);
}

.view-stock-item span:last-child {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

/* Families specific */
.family-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.family-card:hover {
    transform: scale(1.02);
}

/* --- PREMIUM UI ENHANCEMENTS --- */

/* Card Interactions */
.card,
.stat-card,
.kpi-premium-card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.3s ease,
        border-color 0.3s ease !important;
}

.card:hover,
.stat-card:hover,
.kpi-premium-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(115, 103, 240, 0.15) !important;
}

/* Animated Entry for Content */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.row>[class*="col-"] {
    animation: fadeInUp 0.5s ease backwards;
}

/* Staggered animation for grid items */
.row>[class*="col-"]:nth-child(1) {
    animation-delay: 0.1s;
}

.row>[class*="col-"]:nth-child(2) {
    animation-delay: 0.15s;
}

.row>[class*="col-"]:nth-child(3) {
    animation-delay: 0.2s;
}

.row>[class*="col-"]:nth-child(4) {
    animation-delay: 0.25s;
}

.row>[class*="col-"]:nth-child(5) {
    animation-delay: 0.3s;
}

.row>[class*="col-"]:nth-child(6) {
    animation-delay: 0.35s;
}

/* Status Badges Glow */
.status-badge {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.status-badge:hover {
    filter: brightness(1.05);
    transform: scale(1.05);
}

/* Micro-interaction for numbers */
#app span,
#app div {
    transition: color 0.3s ease;
}