/**
 * XeBilling Modern Theme Stylesheet
 * Based on Bootstrap 5.3 & FontAwesome 6
 * Designed for XeCreators
 */

:root {
    --bs-font-sans-serif: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-bg: #f8fafc;
    --bs-body-color: #334155;

    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-primary-hover: #1d4ed8;

    --bs-secondary: #64748b;
    --bs-secondary-rgb: 100, 116, 139;

    --bs-success: #10b981;
    --bs-danger: #ef4444;
    --bs-warning: #f59e0b;
    --bs-info: #06b6d4;

    --bs-border-color: #e2e8f0;
    --bs-card-border-radius: 0.75rem;
    --bs-card-cap-bg: #ffffff;
}

body {
    font-family: var(--bs-font-sans-serif);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ==========================================================================
   Typography & Utilities
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.015em;
}

a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}
a:hover {
    color: var(--bs-primary-hover);
}

.fs-7 { font-size: 0.8125rem !important; }
.fs-8 { font-size: 0.75rem !important; }
.fw-500 { font-weight: 500 !important; }
.tracking-wider { letter-spacing: 0.05em; }
.py-1-5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.shadow-xs { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }

.bg-slate-900 { background-color: #0f172a !important; }
.bg-slate-950 { background-color: #020617 !important; }
.text-slate-300 { color: #cbd5e1 !important; }
.text-slate-400 { color: #94a3b8 !important; }
.hover-white:hover { color: #ffffff !important; transition: color 0.15s ease-in-out; }

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.main-header {
    background-color: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px);
    z-index: 1030;
    border-bottom: 1px solid #e2e8f0;
}

.main-header .nav-link {
    font-size: 0.875rem;
    color: #475569;
    border-radius: 0.5rem;
    transition: all 0.15s ease-in-out;
}
.main-header .nav-link:hover {
    color: var(--bs-primary);
    background-color: #f1f5f9;
}
.main-header .nav-link.active {
    color: var(--bs-primary);
    font-weight: 700;
}

.brand-logo {
    transition: transform 0.2s ease;
}
.brand-logo:hover {
    transform: scale(1.02);
}

/* ==========================================================================
   Cards & Widgets
   ========================================================================== */
.card {
    border-radius: var(--bs-card-border-radius);
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
}

.list-group-item {
    border-color: #f1f5f9;
    font-size: 0.875rem;
    transition: all 0.15s ease-in-out;
}
.list-group-item:hover {
    background-color: #f8fafc;
    color: var(--bs-primary) !important;
}
.list-group-item.active {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* XeBilling Legacy Widgets / H-Blocks compatibility */
.widget {
    margin-bottom: 1.5rem;
}
.widget .head {
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}
.widget .head h2 {
    font-size: 1rem;
    margin: 0;
    color: #0f172a;
}
.widget .block {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
    padding: 1.25rem;
}

.h-block {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}
.h-block .h-block-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
}
.h-block .h-block-header h2 {
    font-size: 1.25rem;
    margin: 0;
    color: #0f172a;
}
.h-block .h-block-header p {
    margin: 0.25rem 0 0 0;
    color: #64748b;
    font-size: 0.875rem;
}
.h-block .block {
    padding: 1.5rem;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.15s ease-in-out;
}
.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--bs-primary-hover);
    border-color: var(--bs-primary-hover);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 0.375rem;
}

.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    font-size: 0.875rem;
    padding: 0.55rem 0.85rem;
    color: #1e293b;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table {
    width: 100%;
    margin-bottom: 0;
    border-color: #f1f5f9;
}
.table thead th {
    background-color: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
}
.table tbody td {
    vertical-align: middle;
    padding: 0.85rem 1rem;
    color: #334155;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
}
.table tbody tr:hover td {
    background-color: #f8fafc;
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.alert {
    border-radius: 0.75rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}
.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.alert-success {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* ==========================================================================
   Popup, Modal & Loading Dimmer (XeCreators API / AJAX)
   ========================================================================== */
.dim, #fade {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    display: none;
}

.popup_block {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    color: #0f172a;
    background: #ffffff;
    padding: 24px 28px;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    width: 90%;
    max-width: 460px;
}

.popup_block h3, .popup_block h5 {
    font-size: 1.125rem;
    margin-bottom: 0;
    color: #0f172a;
}

.popup-content {
    line-height: 1.6;
    color: #475569;
}

a.close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 50%;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s ease-in-out;
}
a.close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.loading.dim .popup_block {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 180px;
    padding: 20px 30px;
}

/* ==========================================================================
   Avatars & Helpers
   ========================================================================== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    vertical-align: middle;
    overflow: hidden;
}
.avatar-xs { width: 24px; height: 24px; font-size: 0.75rem; }
.avatar-sm { width: 36px; height: 36px; font-size: 0.875rem; }
.avatar-md { width: 44px; height: 44px; font-size: 1rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar-xxl { width: 96px; height: 96px; font-size: 2rem; }

/* Circular Buttons & Icons */
.btn-circle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    border-radius: 50% !important;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    line-height: 1;
}
.btn-circle.btn-sm { width: 28px; height: 28px; min-width: 28px; min-height: 28px; font-size: 11px; }
.btn-circle.btn-md { width: 36px; height: 36px; min-width: 36px; min-height: 36px; font-size: 14px; }
.btn-circle.btn-lg { width: 44px; height: 44px; min-width: 44px; min-height: 44px; font-size: 18px; }

.cursor-pointer { cursor: pointer !important; }
.hover-primary:hover { color: var(--bs-primary) !important; }

/* Subtle Badges */
.bg-primary-subtle { background-color: #eff6ff !important; color: #1d4ed8 !important; }
.bg-success-subtle { background-color: #ecfdf5 !important; color: #047857 !important; }
.bg-danger-subtle { background-color: #fef2f2 !important; color: #b91c1c !important; }
.bg-warning-subtle { background-color: #fffbeb !important; color: #b45309 !important; }
.bg-info-subtle { background-color: #f0fdfa !important; color: #0f766e !important; }
.bg-secondary-subtle { background-color: #f8fafc !important; color: #475569 !important; }

/* ==========================================================================
   Order & Store Components
   ========================================================================== */
.product-category {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.product-category:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.product {
    background-color: #ffffff;
    padding: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}
.product:last-child {
    border-bottom: none;
}

.pricing {
    border-radius: 0.75rem;
    background: #ffffff;
}
.pricing .currency {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--bs-primary);
    margin-bottom: 0.75rem;
}

/* ==========================================================================
   Footer Styling
   ========================================================================== */
.footer-modern {
    background-color: #0f172a;
    border-top: 1px solid #1e293b;
}

.footer-links a {
    transition: color 0.15s ease-in-out, transform 0.15s ease-in-out;
    display: inline-block;
}
.footer-links a:hover {
    transform: translateX(3px);
}

.gateway-badge {
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.15s ease-in-out;
}
.gateway-badge:hover {
    transform: translateY(-2px);
}

.footer-lower {
    background-color: #020617;
}

/* ==========================================================================
   FontAwesome Compatibility Aliases
   ========================================================================== */
.fa-gauge:before, .fa-gauge-high:before, .fa-dashboard:before, .fa-tachometer-alt:before, .fa-tachometer:before, .fa-speedometer:before {
    font-family: "Font Awesome 6 Free", "FontAwesome" !important;
    font-weight: 900 !important;
    content: "\f3fd" !important;
}
.fa-ticket:before, .fa-ticket-alt:before {
    font-family: "Font Awesome 6 Free", "FontAwesome" !important;
    font-weight: 900 !important;
    content: "\f3ff" !important;
}
.fa-support:before, .fa-life-ring:before {
    font-family: "Font Awesome 6 Free", "FontAwesome" !important;
    font-weight: 900 !important;
    content: "\f1cd" !important;
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   Print & PDF Export Styles
   ========================================================================== */
@media print {
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    .main-header, .footer-modern, .footer-lower, .sidebar-menu-wrapper, .navbar, .btn-print-hide, #sidebar2, .col-lg-3:has(#sidebar2) {
        display: none !important;
    }
    body, #main {
        background: #ffffff !important;
        color: #0f172a !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
    }
    .card-body {
        padding: 0 !important;
    }
    .invoice-container {
        border: 1px solid #e2e8f0 !important;
        border-radius: 0.5rem !important;
    }
    .badge {
        border: 1px solid currentColor !important;
    }
}