/* Custom Styles for Hub Panel Dashboard */

:root {
    --primary-purple: #444392;
    --dark-purple: #353570;
    --light-purple: #5d5da8;
    --sidebar-bg: #353570;
    --topbar-bg: #444392;
    --card-bg: #ffffff;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --success-color: #10b981;
    --danger-color: #ef4444;
}

/* RTL/LTR Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f7fafc;
    color: var(--text-dark);
}

/* RTL Font Support */
[dir="rtl"] body {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
}

/* Top Navbar */
.top-navbar {
    background-color: var(--topbar-bg) !important;
/*    padding: 1rem 2rem;*/
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-navbar .navbar-brand h4 {
    font-size: 1.5rem;
}

.top-navbar .search-box {
    position: relative;
    width: 300px;
}

.top-navbar .search-box i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

[dir="ltr"] .top-navbar .search-box i {
    right: 15px;
}

[dir="rtl"] .top-navbar .search-box i {
    left: 15px;
}

.top-navbar .search-box input {
    border-radius: 25px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

[dir="ltr"] .top-navbar .search-box input {
    padding-right: 40px;
}

[dir="rtl"] .top-navbar .search-box input {
    padding-left: 40px;
}

.top-navbar .search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.top-navbar .search-box input:focus {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: none;
}

/* Sidebar */
.sidebar {
    background-color: var(--sidebar-bg);
    min-height: calc(100vh - 70px);
    padding: 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #ff3582;
}


.sidebar-toggle {
    padding: 0;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-decoration: none;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle:focus {
    box-shadow: none;
}

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

.sidebar .nav-item {
    margin-bottom: 0.25rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: white !important;
    font-weight: 600;
    border-left: 4px solid #ffffff;
}

[dir="rtl"] .sidebar .nav-link.active {
    border-left: none;
    border-right: 4px solid #ffffff;
}

.sidebar .nav-item.active > .nav-link {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: white !important;
    font-weight: 600;
}

.sidebar .nav-link i.fa-chevron-left,
.sidebar .nav-link i.fa-chevron-right {
    font-size: 0.75rem;
}

[dir="ltr"] .sidebar .nav-link i.fa-chevron-left {
    margin-left: auto;
    display: inline-block;
}

[dir="ltr"] .sidebar .nav-link i.fa-chevron-right {
    display: none;
}

[dir="rtl"] .sidebar .nav-link i.fa-chevron-right {
    margin-right: auto;
    display: inline-block;
}

[dir="rtl"] .sidebar .nav-link i.fa-chevron-left {
    display: none;
}

.sidebar .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.2);
    display: none;
}

.sidebar .nav-item.active .sub-menu {
    display: block;
}

/* Bootstrap collapse in sidebar: when .show, display sub-menu */
.sidebar .sub-menu.collapse.show {
    display: block;
}

.sidebar .sub-menu li {
    padding: 0;
}

.sidebar .sub-menu a {
    color: rgba(255, 255, 255, 0.7) !important;
    display: block;
    text-decoration: none;
    transition: all 0.3s;
}

[dir="ltr"] .sidebar .sub-menu a {
    padding: 0.5rem 1.5rem 0.5rem 3rem;
}

[dir="rtl"] .sidebar .sub-menu a {
    padding: 0.5rem 3rem 0.5rem 1.5rem;
}

.sidebar .sub-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.sidebar .sub-menu a.active {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.1) 100%);
    color: #ffffff !important;
    font-weight: 600;
    border-left: 3px solid #10b981;
}

[dir="rtl"] .sidebar .sub-menu a.active {
    border-left: none;
    border-right: 3px solid #10b981;
}

/* Chevron Icon Animation */
.sidebar .chevron-icon {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.sidebar .nav-link .chevron-icon.fa-chevron-up {
    transform: rotate(180deg);
}

/* Sidebar Collapsed (Desktop) */
@media (min-width: 769px) {
    body.sidebar-collapsed .sidebar {
        width: 72px !important;
        flex: 0 0 72px !important;
        max-width: 72px !important;
    }

    body.sidebar-collapsed main {
        width: calc(100% - 72px) !important;
    }

    body.sidebar-collapsed .sidebar-header {
        padding: 1rem;
    }

    body.sidebar-collapsed .sidebar-brand {
        display: none;
    }

    body.sidebar-collapsed .sidebar .nav-link span,
    body.sidebar-collapsed .sidebar .sub-menu {
        display: none !important;
    }

    body.sidebar-collapsed .sidebar .nav-link {
        justify-content: center;
        padding: 0.85rem 0;
    }

    body.sidebar-collapsed .sidebar .nav-link i {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.sidebar-collapsed .sidebar .chevron-icon {
        display: none;
    }

    body.sidebar-collapsed .sidebar .nav-link.active {
        border-left: none;
        border-right: none;
        background-color: rgba(255, 255, 255, 0.18);
    }
}

/* Main Content */
main {
    padding: 2rem;
    margin-top: 70px;
}

.dashboard-header h2 {
    color: var(--text-dark);
    font-size: 2rem;
}

.dashboard-filter-card {
    border: 1px solid #e6ebf5;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
    box-shadow: 0 12px 32px rgba(68, 67, 146, 0.08);
    overflow: hidden;
}

.dashboard-filter-header {
    background: linear-gradient(90deg, rgba(68, 67, 146, 0.08) 0%, rgba(68, 67, 146, 0.02) 100%);
    border-bottom: 1px solid #edf1f7;
    padding: 1rem 1.25rem;
}

.dashboard-filter-header h5 {
    color: var(--dark-purple);
    font-weight: 700;
    font-size: 1rem;
}

.dashboard-filter-clear-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #d7deeb;
    border-radius: 10px;
    background: #ffffff;
    color: var(--dark-purple);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(68, 67, 146, 0.08);
}

.dashboard-filter-clear-btn:hover {
    background: #f3f5ff;
    color: var(--primary-purple);
    border-color: #c9d3e6;
}

.dashboard-filter-clear-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(93, 93, 168, 0.14);
}

.dashboard-filter-body {
    padding: 1.25rem;
}

.dashboard-filter-field {
    background: #ffffff;
    border: 1px solid #e9edf5;
    border-radius: 14px;
    padding: 0.75rem 0.85rem 0.85rem;
    height: 100%;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dashboard-filter-label {
    display: block;
    color: #596579;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 0.55rem;
}

.dashboard-filter-input {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid #dbe4f0;
    background-color: #f8faff;
    color: #1f2937;
    box-shadow: none;
}

.dashboard-filter-input:focus {
    border-color: var(--light-purple);
    background-color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(93, 93, 168, 0.12);
}

/* KPI Cards */
.kpi-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kpi-card .card-body {
    padding: 1.5rem;
}

.kpi-card p,
.kpi-card h3 {
    color: #1f2937;
}

.kpi-card-orders {
    background: linear-gradient(135deg, #eef4ff 0%, #dbeafe 100%);
}

.kpi-card-delivered {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.kpi-card-cancelled {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.kpi-card-progress {
    background: linear-gradient(135deg, #fff8e6 0%, #fde68a 100%);
}

.kpi-card-revenue {
    background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 100%);
}

.kpi-card-commission {
    background: linear-gradient(135deg, #ecfdf3 0%, #bbf7d0 100%);
}

.kpi-card-cod {
    background: linear-gradient(135deg, #ecfeff 0%, #bae6fd 100%);
}

.kpi-card-outstanding {
    background: linear-gradient(135deg, #fff7ed 0%, #fdba74 100%);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.kpi-card h3 {
    font-size: 1.75rem;
    margin: 0.5rem 0;
}

.kpi-card small {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Charts */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 70px;
        width: 250px;
        transition: all 0.3s;
        z-index: 999;
    }

    [dir="ltr"] .sidebar {
        right: -100%;
    }

    [dir="ltr"] .sidebar.show {
        right: 0;
    }

    [dir="rtl"] .sidebar {
        left: -100%;
    }

    [dir="rtl"] .sidebar.show {
        left: 0;
    }

    main {
        margin-right: 0;
        margin-left: 0;
    }

    .top-navbar .search-box {
        width: 200px;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

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