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

:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --dark-color: #1a1c23;
    --light-color: #f8f9fc;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    --border-radius: 8px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
    color: #4e5e6a;
}

h1, h2, h3, h4, h5, h6, .navbar-brand, .sidebar-heading {
    font-family: 'Outfit', sans-serif;
}

/* Sidebar structure */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar-wrapper {
    min-height: 100vh;
    width: 260px;
    min-width: 260px;
    margin-left: -260px;
    transition: margin 0.25s ease-out;
    z-index: 1000;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

#sidebar-wrapper .list-group-item {
    border: none;
    padding: 0.85rem 1.5rem;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s;
    background-color: transparent;
}

#sidebar-wrapper.bg-dark .list-group-item,
#sidebar-wrapper.bg-dark .list-group-item-action,
#sidebar-wrapper.bg-dark .list-group-item-action.text-muted {
    color: rgba(255, 255, 255, 0.75) !important;
}

#sidebar-wrapper.bg-dark .list-group-item:hover,
#sidebar-wrapper.bg-dark .list-group-item-action:hover,
#sidebar-wrapper.bg-dark .list-group-item-action.text-muted:hover,
#sidebar-wrapper.bg-dark .list-group-item[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

#sidebar-wrapper.bg-white .list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--primary-color);
}

#sidebar-wrapper .list-group-item.active {
    background-color: var(--primary-color) !important;
    color: #white !important;
    border-radius: 4px;
}

#page-content-wrapper {
    min-width: 100vw;
    display: flex;
    flex-direction: column;
}

body.sb-sidenav-toggled #sidebar-wrapper {
    margin-left: 0;
}

@media (min-width: 992px) {
    #sidebar-wrapper {
        margin-left: 0;
    }
    #page-content-wrapper {
        min-width: 0;
        width: 100%;
    }
    body.sb-sidenav-toggled #sidebar-wrapper {
        margin-left: -260px;
    }
}

.scrollable-sidebar {
    max-height: calc(100vh - 75px);
    overflow-y: auto;
}

/* Custom scrollbars */
.scrollable-sidebar::-webkit-scrollbar {
    width: 6px;
}
.scrollable-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}

/* Header & Navbar */
.navbar {
    z-index: 999;
}

/* Cards & ERP Components */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    background-color: #fff;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #f1f3f9;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-title {
    margin: 0;
    font-weight: 600;
    color: #333;
}

/* Glassmorphism accent */
.card-accent-primary {
    border-top: 4px solid var(--primary-color);
}
.card-accent-success {
    border-top: 4px solid var(--success-color);
}
.card-accent-danger {
    border-top: 4px solid var(--danger-color);
}

/* Buttons & Inputs */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.45rem 1.2rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover {
    filter: brightness(0.92);
}

.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 0.45rem 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

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

/* Tables styling */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background-color: #f8f9fc;
    color: #5a5c69;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e3e6f0;
    padding: 0.75rem 1rem;
}

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e3e6f0;
    font-size: 0.88rem;
}

/* Badges for Invoice Statuses */
.badge-status {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 4px;
}

.badge-draft { background-color: #e2e8f0; color: #475569; }
.badge-validating { background-color: #dbeafe; color: #1d4ed8; }
.badge-valid { background-color: #dcfce7; color: #15803d; }
.badge-invalid { background-color: #fee2e2; color: #b91c1c; }
.badge-submitted { background-color: #faf5ff; color: #6b21a8; }
.badge-accepted { background-color: #ecfdf5; color: #047857; }
.badge-rejected { background-color: #fff1f2; color: #be123c; }
.badge-cancelled { background-color: #f1f5f9; color: #64748b; }

/* Dashboard Widgets */
.stat-card-title {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #4a5568;
}

.stat-card-icon {
    font-size: 2.2rem;
    color: #cbd5e0;
}

/* Chevron rotates on sidebar collapse */
.menu-item-dropdown a[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.chevron-icon {
    transition: transform 0.2s ease-in-out;
}

/* Custom grid properties for sticky panels */
.sticky-summary {
    position: sticky;
    top: 1.5rem;
}

/* Invoice Line Items Grid Styles */
#invoice-items-table input.form-control,
#invoice-items-table select.form-select {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.82rem !important;
    height: auto !important;
    min-height: 31px !important;
    border-radius: 4px;
}

#invoice-items-table th {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    color: #495057;
    white-space: nowrap;
    border-bottom: 2px solid #dee2e6;
    padding: 0.5rem 0.3rem !important;
}

#invoice-items-table td {
    padding: 0.4rem 0.3rem !important;
    white-space: nowrap;
}

#invoice-items-table .form-control:focus,
#invoice-items-table .form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.2) !important;
}