/**
 * نظام إدارة بيانات محلية أبوحمد — ولاية نهر النيل
 * تصميم الواجهة العربية RTL المتكامل ولوحة التحكم الحكومية
 */

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

:root {
    /* Primary Brand Palette: Navy / Dark Teal (Governmental Official Identity) */
    --color-primary: #0f3d59;
    --color-primary-dark: #0a293c;
    --color-primary-light: #e6f0f7;
    --color-primary-border: #bfdbfe;
    --primary: #0f3d59;
    --primary-hover: #0a293c;
    --primary-light: #e6f0f7;
    --primary-border: #bfdbfe;

    /* Secondary Palette: Emerald Forest (Agricultural & Ecological Flourish) */
    --color-secondary: #15803d;
    --color-secondary-dark: #166534;
    --color-secondary-light: #ecfdf5;
    --color-secondary-border: #bbf7d0;
    --accent: #15803d;
    --accent-hover: #166534;
    --accent-light: #ecfdf5;

    /* Warning Palette: Amber Gold */
    --color-warning: #d97706;
    --color-warning-dark: #b45309;
    --color-warning-light: #fffbeb;
    --color-warning-border: #fde68a;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;

    /* Danger Palette: Crimson Red (Alerts, Flood Disasters, Rejections) */
    --color-danger: #dc2626;
    --color-danger-dark: #b91c1c;
    --color-danger-light: #fef2f2;
    --color-danger-border: #fecaca;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;

    /* Info Palette: Sky / River Blue (Water Networks, Reports) */
    --color-info: #0284c7;
    --color-info-dark: #0369a1;
    --color-info-light: #f0f9ff;
    --color-info-border: #bae6fd;
    --info: #0284c7;
    --info-light: #f0f9ff;
    --info-border: #bae6fd;

    /* Success Palette */
    --color-success: #16a34a;
    --color-success-dark: #15803d;
    --color-success-light: #ecfdf5;
    --color-success-border: #bbf7d0;

    /* Slate Neutral Color Scale */
    --color-slate-50: #f8fafc;
    --color-slate-100: #f1f5f9;
    --color-slate-200: #e2e8f0;
    --color-slate-300: #cbd5e1;
    --color-slate-400: #94a3b8;
    --color-slate-500: #64748b;
    --color-slate-600: #475569;
    --color-slate-700: #334155;
    --color-slate-800: #1e293b;
    --color-slate-900: #0f172a;
    --color-slate-950: #020617;

    /* Surfaces & Backgrounds */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f1f5f9;

    /* Text Colors */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    /* Border Colors */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Layout Dimensions */
    --sidebar-width: 275px;
    --topbar-height: 70px;
}

/* Global Reset & Base Rules */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    direction: rtl;
    text-align: right;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--color-slate-800);
    line-height: 1.6;
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
    font-weight: 700;
    line-height: 1.35;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--color-primary-dark);
}

code, kbd, samp, pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    direction: ltr;
    unicode-bidi: isolate;
}

code {
    background: var(--color-slate-100);
    color: var(--color-slate-800);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-slate-200);
    display: inline-block;
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-body);
    position: relative;
}

/* Sidebar (Supports both .app-sidebar and .sidebar) */
.app-sidebar,
.sidebar {
    width: var(--sidebar-width);
    background: #0b2231;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    box-shadow: -2px 0 16px rgba(0, 0, 0, 0.16);
    overflow-y: auto;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Sleek Scrollbar for Sidebar */
.app-sidebar::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.app-sidebar::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.app-sidebar::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.app-sidebar::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Sidebar Brand Header */
.sidebar-brand,
.sidebar-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #081a26;
    flex-shrink: 0;
}

.brand-emblem,
.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #0d9488 0%, #0f3d59 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.brand-text,
.sidebar-title {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand-text h3,
.sidebar-title h2 {
    color: #ffffff;
    font-size: 15px;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.2px;
    line-height: 1.25;
    white-space: nowrap;
}

.brand-text small,
.sidebar-title span {
    color: #94a3b8;
    font-size: 11px;
    display: block;
    margin-top: 2px;
    white-space: nowrap;
}

/* Sidebar Navigation Items */
.sidebar-nav,
.sidebar-menu {
    padding: 14px 12px 36px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-section-title,
.menu-category {
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 800;
    letter-spacing: 0.6px;
    margin: 16px 10px 6px;
    padding-bottom: 2px;
}

.nav-link,
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: #cbd5e1;
    border-radius: var(--radius-md);
    margin-bottom: 3px;
    font-weight: 500;
    font-size: 13.5px;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover,
.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(-3px);
}

.nav-link.active,
.nav-item.active {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.2), rgba(15, 61, 89, 0.8));
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    border-right: 3.5px solid #38bdf8;
}

.nav-link svg,
.nav-item svg {
    flex-shrink: 0;
    opacity: 0.8;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-link:hover svg,
.nav-item:hover svg {
    opacity: 1;
    transform: scale(1.05);
}

.nav-link.active svg,
.nav-item.active svg {
    opacity: 1;
    stroke: #38bdf8;
}

/* Main Content Wrapper (Supports both .app-main and .main-content) */
.app-main,
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    background-color: var(--bg-body);
    transition: margin-right 0.25s ease;
}

/* Topbar (Supports both .app-topbar and .topbar) */
.app-topbar,
.topbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--color-slate-200);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

.topbar-search,
.search-box {
    position: relative;
    width: 320px;
}

.topbar-actions,
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* User Menu & Dropdown */
.user-menu-wrapper {
    position: relative;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 50px;
    background: #ffffff;
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1050;
    overflow: hidden;
    animation: fadeInDropdown 0.15s ease-out;
}

.user-dropdown-menu.show {
    display: block !important;
}

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

/* Content Area (Supports both .app-content and .page-content) */
.app-content,
.page-content {
    padding: 28px 32px;
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 4px;
    line-height: 1.25;
}

.page-subtitle {
    color: var(--color-slate-500);
    font-size: 0.875rem;
}

/* ==========================================================================
   Component System: Cards, Badges, Buttons, Tables, Forms
   ========================================================================== */

/* Cards */
.card {
    background: #ffffff;
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-slate-800);
    margin: 0;
}

.card-subtitle {
    font-size: 0.8125rem;
    color: var(--color-slate-500);
    margin-top: 2px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--color-slate-200);
    background: var(--color-slate-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

/* KPI / Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-slate-600);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-slate-900);
    line-height: 1.1;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.stat-desc {
    font-size: 0.8125rem;
    color: var(--color-slate-500);
    line-height: 1.4;
}

/* Data Tables & Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    background: #ffffff;
}

.table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 13.5px;
}

.table th,
.data-table th {
    background: var(--color-slate-50);
    color: var(--color-slate-700);
    padding: 12px 16px;
    font-weight: 700;
    border-bottom: 2px solid var(--color-slate-200);
    white-space: nowrap;
    font-size: 13px;
    vertical-align: middle;
}

.table td,
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-slate-100);
    color: var(--color-slate-800);
    vertical-align: middle;
}

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

.table tbody tr:last-child td,
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.3;
}

.badge-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-border);
}

.badge-secondary {
    background: var(--color-slate-100);
    color: var(--color-slate-700);
    border: 1px solid var(--color-slate-200);
}

.badge-success {
    background: var(--color-secondary-light);
    color: var(--color-secondary);
    border: 1px solid var(--color-secondary-border);
}

.badge-warning {
    background: var(--color-warning-light);
    color: #92400e;
    border: 1px solid var(--color-warning-border);
}

.badge-danger {
    background: var(--color-danger-light);
    color: #991b1b;
    border: 1px solid var(--color-danger-border);
}

.badge-info {
    background: var(--color-info-light);
    color: #075985;
    border: 1px solid var(--color-info-border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    border-color: var(--color-slate-300);
    color: var(--color-slate-700);
}

.btn-secondary:hover {
    background: var(--color-slate-100);
    border-color: var(--color-slate-400);
    color: var(--color-slate-900);
}

.btn-success {
    background: var(--color-secondary);
    color: #ffffff;
    border-color: var(--color-secondary);
}

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

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

.btn-danger:hover {
    background: var(--color-danger-dark);
    border-color: var(--color-danger-dark);
    color: #ffffff;
}

.btn-warning {
    background: var(--color-warning);
    color: #ffffff;
    border-color: var(--color-warning);
}

.btn-warning:hover {
    background: var(--color-warning-dark);
    border-color: var(--color-warning-dark);
    color: #ffffff;
}

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

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

.btn-outline-danger {
    background: transparent;
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.btn-outline-danger:hover {
    background: var(--color-danger-light);
    color: var(--color-danger-dark);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

/* Form Controls & Labels */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 13px;
    color: var(--color-slate-700);
}

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--color-slate-300);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    color: var(--color-slate-800);
    background-color: #ffffff;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 61, 89, 0.15);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
    padding-left: 36px;
}

textarea.form-control {
    min-height: 85px;
    resize: vertical;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13.5px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-success {
    background: var(--color-secondary-light);
    border-color: var(--color-secondary-border);
    color: #166534;
}

.alert-warning {
    background: var(--color-warning-light);
    border-color: var(--color-warning-border);
    color: #92400e;
}

.alert-danger {
    background: var(--color-danger-light);
    border-color: var(--color-danger-border);
    color: #991b1b;
}

.alert-info {
    background: var(--color-info-light);
    border-color: var(--color-info-border);
    color: #075985;
}

/* Dossier Grid for Detailed Views */
.dossier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.dossier-item {
    background: var(--color-slate-50);
    border: 1px solid var(--color-slate-200);
    padding: 12px 16px;
    border-radius: var(--radius-md);
}

.dossier-label {
    font-size: 12px;
    color: var(--color-slate-500);
    margin-bottom: 4px;
    font-weight: 600;
}

.dossier-value {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--color-slate-900);
}

/* Utility Helpers */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.font-bold { font-weight: 700 !important; }
.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-slate-600) !important; }
.text-success { color: var(--color-secondary) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-info { color: var(--color-info) !important; }
.p-0 { padding: 0 !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-4 { margin-top: 24px !important; }

/* Laravel Pagination Styles */
nav[role="navigation"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 12px;
}

nav[role="navigation"] > div {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

nav[role="navigation"] p {
    font-size: 13px;
    color: var(--color-slate-600);
    margin: 0;
}

nav[role="navigation"] a,
nav[role="navigation"] span[aria-current="page"] > span,
nav[role="navigation"] span[aria-disabled="true"] > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--color-slate-300);
    border-radius: var(--radius-sm);
    color: var(--color-slate-700);
    background: #ffffff;
    text-decoration: none;
    transition: all 0.2s;
    min-width: 34px;
}

nav[role="navigation"] a:hover {
    background: var(--color-slate-100);
    border-color: var(--color-slate-400);
    color: var(--color-slate-900);
}

nav[role="navigation"] span[aria-current="page"] > span {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

nav[role="navigation"] span[aria-disabled="true"] > span {
    color: var(--color-slate-400);
    background: var(--color-slate-50);
    border-color: var(--color-slate-200);
    cursor: not-allowed;
}

nav[role="navigation"] svg {
    width: 16px;
    height: 16px;
}

/* Display & Responsive Utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }

@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
}

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-inline-block { display: inline-block !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

/* Responsive Behavior */
@media (max-width: 991px) {
    .app-sidebar,
    .sidebar {
        transform: translateX(100%);
    }

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

    .app-main,
    .main-content {
        margin-right: 0 !important;
        width: 100% !important;
    }

    .app-topbar,
    .topbar {
        padding: 0 16px;
    }

    .app-content,
    .page-content {
        padding: 20px 16px;
    }

    .topbar-search,
    .search-box {
        display: none;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Print Styles */
@media print {
    .app-sidebar,
    .sidebar,
    .app-topbar,
    .topbar,
    .filter-bar,
    .header-actions,
    .pagination-wrapper,
    footer,
    #sidebar-toggle {
        display: none !important;
    }

    .app-main,
    .main-content {
        margin-right: 0 !important;
        width: 100% !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }

    body {
        background: #ffffff !important;
        font-size: 11pt !important;
    }
}
