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

:root {
    /* Premium Modern HSL Color Palette */
    --primary-h: 224;
    --primary-s: 85%;
    --primary-l: 55%;
    --primary-color: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-hover: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 8%));
    --primary-light: hsl(var(--primary-h), var(--primary-s), 96%);

    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;

    /* Neutrals */
    --body-bg: #f8fafc;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-translucent: rgba(226, 232, 240, 0.8);

    /* Sidebar Variables */
    --sidebar-width: 280px;
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --sidebar-color: #334155;
    --sidebar-hover-bg: rgba(241, 245, 249, 0.8);
    --sidebar-active-bg: linear-gradient(135deg, var(--primary-color), #3b82f6);
    --sidebar-active-color: #ffffff;
    --sidebar-border: rgba(226, 232, 240, 0.8);

    /* Spacing & Radius */
    --card-border-radius: 20px;
    --btn-border-radius: 12px;
    --input-border-radius: 12px;

    /* Modern Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 12px 24px -6px rgba(15, 23, 42, 0.06), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 35px 60px -15px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.05);
    --shadow-glow: 0 8px 20px -4px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    direction: rtl;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Sidebar Styling */
.main-sidebar {
    background: var(--sidebar-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    color: var(--sidebar-color);
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 40px rgba(15, 23, 42, 0.02);
    border-left: 1px solid var(--sidebar-border);
}

.sidebar-header {
    padding: 2rem 2.25rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    letter-spacing: -0.5px;
}

.sidebar-brand span.icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(6, 182, 212, 0.1));
    border-radius: 10px;
    font-size: 1.15rem;
    color: var(--primary-color);
}

.sidebar-brand:hover {
    color: var(--primary-hover);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    color: #475569;
    text-decoration: none;
    border-radius: var(--btn-border-radius);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 0.95rem;
    justify-content: flex-start;
}

.nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--primary-color);
    transform: translateX(-4px);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
    box-shadow: var(--shadow-glow);
}

.nav-link.active .icon-svg {
    color: #ffffff !important;
    fill: #ffffff !important;
}

.nav-link .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: all 0.25s ease;
}

.icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    vertical-align: middle;
}

.brand-icon {
    width: 24px;
    height: 24px;
    fill: var(--primary-color) !important;
}

.nav-link:hover .icon-svg {
    transform: scale(1.15);
    color: var(--primary-color);
}

.nav-splitter {
    font-size: 0.78rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    padding: 1.5rem 1.5rem 0.5rem 0;
    margin-top: 0.5rem;
    opacity: 0.85;
    border-bottom: 1px dashed rgba(226, 232, 240, 0.5);
    margin-bottom: 0.5rem;
    text-align: right;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--sidebar-border);
    background-color: rgba(250, 251, 252, 0.5);
}

/* Main Content */
.main-content {
    margin-right: var(--sidebar-width);
    padding: 2.5rem;
    min-height: 100vh;
    transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Responsive Mobile */
@media (max-width: 991.98px) {
    .main-sidebar {
        transform: translateX(100%);
        box-shadow: -15px 0 40px rgba(15, 23, 42, 0.12);
        background: #ffffff;
    }

    .main-sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        padding: 1.5rem 1rem;
    }
}

.mobile-toggle {
    display: none;
    background: rgba(37, 99, 235, 0.08);
    border: none;
    font-size: 1.3rem;
    color: var(--primary-color);
    cursor: pointer;
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-toggle:hover {
    background: rgba(37, 99, 235, 0.15);
}

@media (max-width: 991.98px) {
    .mobile-toggle {
        display: flex;
    }
}

/* Cards & Containers */
.card {
    background: #ffffff;
    border: 1px solid var(--border-translucent);
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: rgba(37, 99, 235, 0.15);
}

.card-header {
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 1.75rem;
}

.card-header h5 {
    margin: 0;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 2rem;
}

/* Typography & Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Forms */
.form-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #334155;
    margin-bottom: 0.6rem;
}

.form-control,
.form-select {
    padding: 0.8rem 1.2rem;
    border-radius: var(--input-border-radius);
    border: 1.5px solid #e2e8f0;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
    color: #0f172a;
    background-position: left 0.75rem center;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    outline: none;
}

.form-control::placeholder {
    color: #94a3b8;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.75rem;
    border-radius: var(--btn-border-radius);
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-outline-secondary {
    border: 1.5px solid var(--border-color);
    color: #475569;
    background-color: white;
}

.btn-outline-secondary:hover {
    background-color: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

.btn-outline-primary {
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    background-color: white;
}

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

/* Alerts */
.alert {
    border: none;
    border-radius: var(--btn-border-radius);
    padding: 1.15rem 1.5rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-light {
    background-color: #fff;
    border: 1px solid var(--border-color);
}

.alert-info {
    background-color: rgba(6, 182, 212, 0.08);
    color: #0e7490;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.08);
    color: #047857;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
}

/* Tables */
.table-responsive {
    border-radius: var(--card-border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.table {
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    padding: 1.15rem 1.25rem;
}

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

.table tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.8) !important;
}

.table tbody td {
    padding: 1.15rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: #334155;
    font-weight: 500;
    font-size: 0.92rem;
}

/* Badges */
.badge {
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.25px;
}

.badge.bg-primary {
    background: rgba(37, 99, 235, 0.1) !important;
    color: var(--primary-color) !important;
}

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

.badge.bg-secondary {
    background: rgba(100, 116, 139, 0.1) !important;
    color: var(--secondary-color) !important;
}

/* Stat Cards */
.stat-card {
    background: #fff;
    border-radius: var(--card-border-radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-translucent);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.stat-card:hover::after {
    opacity: 1;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(6, 182, 212, 0.08));
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Footer */
.main-footer {
    padding: 2rem 0;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-top: 1px solid var(--border-color);
    background-color: #ffffff;
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hover-lift {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hover-lift:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* Premium Portal Gateways Style System (Login & Activation) */
.portal-bg {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-card {
    border-radius: 20px !important;
    overflow: hidden;
    z-index: 10;
    transition: box-shadow 0.25s ease-in-out;
}

.portal-header {
    padding: 2.5rem 2rem !important;
    text-align: center;
}

.portal-header h1 {
    font-size: 2rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.portal-header p {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.portal-input {
    border-radius: 12px !important;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

.portal-btn {
    border: none !important;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
}

/* Custom Drop File Area */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--card-border-radius);
    padding: 2.5rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

/* Breadcrumbs & Status Bar */
.top-status-bar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    padding: 0.85rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
    gap: 8px;
    align-items: center;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "›" !important;
    font-family: inherit !important;
    font-size: 1.1rem;
    color: #94a3b8;
    line-height: 1;
    padding: 0 4px;
}

.breadcrumb-item a {
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-color);
    font-weight: 700;
}

/* Green pulse for active API */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.pulse-dot.success {
    background-color: var(--success-color);
}

.pulse-dot.warning {
    background-color: var(--warning-color);
}

.pulse-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: indicator-pulse 1.8s infinite ease-in-out;
}

.pulse-dot.success::after {
    background-color: var(--success-color);
}

.pulse-dot.warning::after {
    background-color: var(--warning-color);
}

@keyframes indicator-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

[dir="rtl"] .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

[dir="rtl"] .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}

[dir="rtl"] .form-check-label {
    padding-right: 0.5rem;
    padding-left: 0;
}

[dir="rtl"] .gap-3 {
    gap: 1rem !important;
}

/* SweetAlert2 Custom Styling */
.swal2-custom-popup {
    font-family: 'Cairo', sans-serif !important;
    border-radius: 18px !important;
    padding: 2.2rem !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    background: #ffffff !important;
}

.swal2-custom-title {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin-bottom: 0.5rem !important;
    font-family: 'Cairo', sans-serif !important;
}

.swal2-custom-text {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    line-height: 1.7 !important;
    font-family: 'Cairo', sans-serif !important;
}

.swal2-custom-confirm-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    padding: 10px 24px !important;
    border-radius: 10px !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin: 8px !important;
    font-family: 'Cairo', sans-serif !important;
}

.swal2-custom-confirm-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4) !important;
}

.swal2-custom-cancel-btn {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    padding: 10px 24px !important;
    border-radius: 10px !important;
    border: 1px solid #e2e8f0 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin: 8px !important;
    font-family: 'Cairo', sans-serif !important;
}

.swal2-custom-cancel-btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}