/* ============================================
   Barka Oil - Custom Styles
   ============================================ */

:root {
    /* ألوان مستخرجة من اللوجو */
    --hs-primary-dark: #001b3a;   /* الأزرق الغامق */
    --hs-primary: #0057b7;        /* الأزرق الرئيسي */
    --hs-primary-light: #00a8ff;  /* الأزرق السماوي الفاتح */
    --hs-accent: #00e0ff;         /* لون لمّاع للهاي لايت */
    --hs-bg: #f4f7fb;             /* خلفية الصفحات */
    --hs-sidebar-bg: linear-gradient(180deg, #001b3a 0%, #00356b 40%, #001b3a 100%);
    --hs-text-main: #0f172a;
    --hs-muted: #6b7280;
    
    /* ألوان إضافية */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --sidebar-width: 260px;
}

/* ============================================
   Body & General
   ============================================ */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--hs-bg);
    color: var(--hs-text-main);
    direction: rtl;
}

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

.main-wrapper {
    min-height: 100vh;
}

.sidebar,
.app-sidebar {
    width: 260px;
    background: var(--hs-sidebar-bg);
    color: #e5e7eb;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

@media (max-width: 767.98px) {
    .sidebar {
        display: none !important;
    }
}

.sidebar-header {
    background: var(--hs-sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sidebar .nav-link,
.app-sidebar .nav-link {
    color: #e5e7eb;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-size: 0.93rem;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
    border-radius: 999px;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link .icon,
.sidebar a .icon,
.app-sidebar a .icon {
    width: 26px;
    text-align: center;
}

.sidebar .nav-link:hover,
.app-sidebar .nav-link:hover,
.sidebar a:hover {
    background: rgba(0, 168, 255, 0.18);
    color: #ffffff;
    border-right-color: var(--hs-primary-light);
}

.sidebar .nav-link.active,
.app-sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--hs-primary-light), var(--hs-primary));
    color: #ffffff;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(0, 24, 72, 0.55);
    border-right-color: transparent;
}

/* القائمة الجانبية المحسّنة */
.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    color: #e5e7eb;
    border-radius: 999px;
    margin-inline: 0.25rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
}

.sidebar-menu .nav-link .icon {
    width: 26px;
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-menu .nav-link:hover {
    background-color: rgba(0, 168, 255, 0.18);
    color: #ffffff;
    border-right-color: var(--hs-primary-light);
}

.sidebar-menu .nav-link.active {
    background: linear-gradient(135deg, var(--hs-primary-light), var(--hs-primary));
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 24, 72, 0.6);
    border-right-color: transparent;
}

/* عناوين الأقسام في السايدبار */
.sidebar-section-title {
    padding: 0.5rem 1rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #ffffff;
    font-weight: 600;
    list-style: none;
    display: inline-block;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(0, 168, 255, 0.25), rgba(0, 224, 255, 0.2));
    border: 1px solid rgba(0, 168, 255, 0.4);
    box-shadow: 0 0 12px rgba(0, 168, 255, 0.3), 
                0 0 20px rgba(0, 168, 255, 0.15),
                inset 0 0 8px rgba(0, 168, 255, 0.1);
    margin: 0.5rem 0.75rem 0.75rem;
    width: calc(100% - 1.5rem);
    text-align: center;
    transition: all 0.3s ease;
}

.sidebar-section-title:hover {
    background: linear-gradient(135deg, rgba(0, 168, 255, 0.35), rgba(0, 224, 255, 0.3));
    box-shadow: 0 0 16px rgba(0, 168, 255, 0.4), 
                0 0 28px rgba(0, 168, 255, 0.2),
                inset 0 0 10px rgba(0, 168, 255, 0.15);
    transform: translateY(-1px);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.content-wrapper {
    margin-right: 260px;
    width: calc(100% - 260px);
}

@media (max-width: 767.98px) {
    .content-wrapper {
        margin-right: 0 !important;
        width: 100% !important;
    }
}

/* ============================================
   Topbar
   ============================================ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--hs-sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #e5e7eb;
}

.topbar h4,
.topbar .text-muted,
.topbar .small {
    color: #e5e7eb !important;
}

.topbar .text-muted {
    color: rgba(229, 231, 235, 0.8) !important;
}

.topbar .btn-link {
    color: #e5e7eb !important;
}

.topbar .btn-link:hover {
    color: #ffffff !important;
}

.topbar .dropdown-toggle::after {
    border-top-color: #e5e7eb;
}

.topbar .btn-soft {
    background-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    border-color: rgba(255, 255, 255, 0.2);
}

.topbar .btn-soft:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

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

.card {
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    transition: all 0.3s ease;
    background: #ffffff;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    border-radius: 14px 14px 0 0 !important;
    padding: 1.25rem;
    font-weight: 600;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.stat-card {
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card .label {
    font-size: 0.78rem;
    color: var(--hs-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.stat-card .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--hs-primary-dark);
}

/* ============================================
   Buttons
   ============================================ */

.btn-main {
    background: linear-gradient(135deg, var(--hs-primary), var(--hs-primary-light));
    color: #ffffff !important;
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.6rem;
    font-weight: 500;
    box-shadow: 0 8px 22px rgba(0, 24, 72, 0.4);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn-main:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(0, 24, 72, 0.5);
    opacity: 0.96;
    color: #fff !important;
}

.btn-soft {
    background-color: rgba(0, 168, 255, 0.08);
    color: var(--hs-text-main);
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-soft:hover {
    background-color: rgba(0, 168, 255, 0.16);
    color: var(--hs-text-main);
    border-color: rgba(0, 168, 255, 0.3);
}

.btn i {
    margin-left: 0.5rem;
}

/* RTL Fix for buttons */
[dir="rtl"] .btn i {
    margin-left: 0;
    margin-right: 0.5rem;
}

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

.table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.table thead {
    background: linear-gradient(90deg, #e5f0ff 0%, #f3f7ff 100%);
    border-bottom: 2px solid #d1d5db;
}

.table thead th {
    font-weight: 600;
    color: #374151;
    padding: 1rem;
    font-size: 0.78rem;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

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

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* ============================================
   Forms
   ============================================ */

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-label.small {
    font-size: 0.8rem;
    font-weight: 600;
}

.form-label .required {
    color: var(--danger-color);
    margin-right: 0.25rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.625rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hs-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 87, 183, 0.25);
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* ============================================
   RTL Specific
   ============================================ */

[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .form-label {
    text-align: right;
}

[dir="rtl"] .table {
    text-align: right;
}

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

.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.8rem;
}

.badge-hs-primary {
    background-color: rgba(0, 87, 183, 0.08);
    color: var(--hs-primary-dark);
    border: 1px solid rgba(0, 87, 183, 0.4);
}

.badge-hs-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.badge-hs-info {
    background-color: rgba(0, 168, 255, 0.10);
    color: #0369a1;
    border: 1px solid rgba(0, 168, 255, 0.6);
}

.bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: #059669 !important;
}

.bg-primary-subtle {
    background-color: rgba(0, 87, 183, 0.1) !important;
    color: var(--hs-primary-dark) !important;
}

.bg-info-subtle {
    background-color: rgba(0, 168, 255, 0.1) !important;
    color: #0369a1 !important;
}

/* ============================================
   Links
   ============================================ */

a {
    color: var(--hs-primary);
    transition: color 0.3s ease;
}

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

/* ============================================
   Alerts
   ============================================ */

.alert {
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alert i {
    margin-left: 0.5rem;
}

[dir="rtl"] .alert i {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* ============================================
   Nav Pills / Tabs
   ============================================ */

.nav-pills {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.nav-pills .nav-link {
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    transition: all 0.3s ease;
    color: #6b7280;
    font-size: 0.875rem;
}

.nav-pills .nav-link:hover {
    background-color: rgba(0, 168, 255, 0.1);
    color: var(--hs-primary);
}

.nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--hs-primary), var(--hs-primary-light));
    color: #ffffff;
}

/* ============================================
   Summary Row in Tables
   ============================================ */

.table-summary {
    background-color: #f9fafb;
    font-weight: 600;
}

.table-summary td,
.table-summary th {
    border-top: 2px solid #dee2e6;
    padding: 1rem;
}

/* ============================================
   Page Header
   ============================================ */

.page-header h1,
.page-header h2 {
    color: #1f2937;
    font-weight: 700;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 0;
    margin-top: auto;
}

.footer a {
    color: var(--hs-primary);
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--hs-primary-light);
    text-decoration: underline !important;
}

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .content-wrapper {
        margin-right: 0;
        width: 100%;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .sidebar,
    .topbar,
    .btn,
    .no-print,
    .footer {
        display: none !important;
    }
    
    .content-wrapper {
        margin-right: 0;
        width: 100%;
    }
}

/* ============================================
   Responsive Styles - Mobile & Tablet
   ============================================ */

/* تحسينات للشاشات الصغيرة (موبايل) */
@media (max-width: 767.98px) {
    .topbar {
        padding-inline: 0.75rem;
    }

    .topbar h4 {
        font-size: 0.95rem;
    }

    .stat-card {
        margin-bottom: 0.5rem;
        padding: 0.75rem !important;
    }

    .stat-card .value {
        font-size: 1rem;
    }

    .card-body {
        padding: 0.75rem 0.9rem;
    }

    .card-header {
        padding: 0.65rem 0.9rem;
    }

    .card-header h5,
    .card-header h6 {
        font-size: 0.9rem;
    }

    .sidebar-section-title {
        padding: 0.45rem 0.85rem;
        font-size: 0.7rem;
        margin: 0.4rem 0.5rem 0.6rem;
        width: calc(100% - 1rem);
    }

    /* تحسين الجداول في الموبايل */
    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.4rem;
    }

    /* تحسين الأزرار */
    .btn {
        font-size: 0.875rem;
        padding: 0.4rem 0.8rem;
    }

    .btn-sm {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }

    /* تحسين الفورمات */
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.3rem;
    }

    .form-control,
    .form-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    /* تحسين الـ Footer */
    .footer {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }

    /* تحسين الـ Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    /* تحسين الـ Offcanvas */
    .offcanvas {
        width: 280px !important;
    }

    .offcanvas.text-bg-dark {
        background: var(--hs-sidebar-bg) !important;
    }

    .offcanvas-header {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .offcanvas-body {
        padding: 0;
    }

    .offcanvas .sidebar-nav {
        padding: 0.5rem;
    }

    .offcanvas .nav-link {
        color: #e5e7eb;
    }

    .offcanvas .nav-link:hover {
        background: rgba(0, 168, 255, 0.18);
        color: #ffffff;
    }

    .offcanvas .nav-link.active {
        background: linear-gradient(135deg, var(--hs-primary-light), var(--hs-primary));
        color: #ffffff;
    }
}

/* تحسينات للشاشات المتوسطة (تابلت) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 240px;
    }

    .stat-card {
        padding: 1rem;
    }

    .table {
        font-size: 0.9rem;
    }
}

/* تحسين حجم الخط في الشاشة الصغيرة */
.extra-small {
    font-size: 0.7rem;
}

/* تحسين الـ Login Page للموبايل */
@media (max-width: 991.98px) {
    .login-wrapper {
        padding: 1rem;
    }

    .login-image {
        min-height: 200px;
    }
}

/* تحسين الـ Content Wrapper للموبايل */
@media (max-width: 767.98px) {
    .content-wrapper {
        width: 100%;
        margin-right: 0 !important;
    }

    .main-wrapper {
        flex-direction: row;
    }
}

/* التأكد من أن المحتوى يأخذ العرض الكامل في الموبايل */
@media (max-width: 767.98px) {
    .main-wrapper .content-wrapper {
        margin-right: 0;
    }
}

/* تحسين الـ Grid في الموبايل */
@media (max-width: 767.98px) {
    .row.g-3 {
        --bs-gutter-y: 0.75rem;
        --bs-gutter-x: 0.75rem;
    }

    .row.g-2 {
        --bs-gutter-y: 0.5rem;
        --bs-gutter-x: 0.5rem;
    }
}

/* تحسين الـ List Groups في الموبايل */
@media (max-width: 767.98px) {
    .list-group-item {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* تحسين الـ Badges في الموبايل */
@media (max-width: 767.98px) {
    .badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
    }
}
