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

:root {
    /* Color Palette - Light Mode */
    --primary-color: #4F46E5;
    /* Indigo */
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    /* Emerald */
    --bg-color: #F9FAFB;
    /* Light background */
    --surface-color: #FFFFFF;
    /* White surface */
    --text-main: #1F2937;
    /* Dark gray */
    --text-muted: #6B7280;
    --sidebar-bg: #111827;
    /* Dark sidebar */
    --sidebar-text: #9CA3AF;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active: rgba(79, 70, 229, 0.2);
    /* Transparent indigo for active */

    /* Layout & Shadows */
    --border-radius: 12px;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* Layout Wrapper */
.app-wrapper {
    display: flex;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: var(--transition);
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Custom Webkit Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.75rem;
    white-space: normal;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 1rem;
}

.sidebar .nav-link .nav-left {
    display: flex;
    align-items: center;
    word-break: break-word;
}

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

.sidebar .nav-link.active {
    background-color: var(--sidebar-active);
    color: var(--primary-color);
    font-weight: 600;
}

/* Authentication Page Styles */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-color) 0%, #e2e8f0 100%);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--surface-color);
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Base resets or miscellaneous */
a {
    color: var(--primary-color);
    text-decoration: none;
}

.sidebar .collapse .nav-link {
    padding-left: 2.5rem;
    font-size: 0.625rem;
    margin-top: 0.1rem;
}

.caret-icon {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.nav-link[aria-expanded="true"] .caret-icon {
    transform: rotate(180deg);
}

/* Main Content Wrapper */
.main-content-wrapper {
    flex-grow: 1;
    min-width: 0;
    margin-left: 280px;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar.collapsed~.main-content-wrapper {
    margin-left: 0;
}

.main-content {
    background-color: var(--bg-color);
    flex-grow: 1;
    margin-top: 70px;
    /* Space for fixed header */
    overflow-x: hidden;
}

/* Top Navbar */
.top-navbar {
    background-color: var(--surface-color);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    position: fixed;
    top: 0;
    right: 0;
    left: 280px;
    z-index: 1030;
    transition: left 0.3s ease;
}

.sidebar.collapsed~.main-content-wrapper .top-navbar {
    left: 0;
}

.burger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 0;
    margin-right: 1.25rem;
}

.search-bar {
    max-width: 320px;
    width: 100%;
    position: relative;
    margin-right: auto;
}

.search-bar input {
    width: 100%;
    padding: 0.4rem 1rem 0.4rem 2.2rem !important;
    font-size: 0.9rem;
    border-radius: 6px;
    background-color: var(--bg-color);
    border: 1px solid #E5E7EB;
    transition: all 0.2s ease;
}

.search-bar input:focus {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
    outline: none;
}

.search-bar .bi-search {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content-wrapper {
        margin-left: 0 !important;
    }
}

/* Cards */
.card {
    background-color: var(--surface-color);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #E5E7EB;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text-main);
}

.card-body {
    padding: 1.5rem;
}

/* Tables */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background: var(--surface-color);
}

.table {
    margin-bottom: 0;
    color: var(--text-main);
}

.table thead th {
    background-color: #F3F4F6;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: none;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid #E5E7EB;
}

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

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #D1D5DB;
    background-color: var(--surface-color);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--text-main);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Dashboard Stats */
.stat-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
}

.stat-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 2rem;
    margin-right: 1.5rem;
}

.stat-icon.primary {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.stat-icon.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.stat-icon.info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

.stat-details h3 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-details p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Badges */
.badge {
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 600;
}

/* Premium AG Grid UI Enhancements */
.premium-grid-card {
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #f3f4f6;
    overflow: hidden;
}
.ag-theme-quartz {
    --ag-font-family: 'Inter', system-ui, sans-serif;
    --ag-font-size: 13.5px;
    --ag-header-background-color: #ffffff;
    --ag-header-text-color: #64748B;
    --ag-data-color: #334155;
    --ag-borders: solid 1px;
    --ag-border-color: #F1F5F9;
    --ag-row-border-color: #F1F5F9;
    --ag-row-hover-color: #F8FAFC;
    --ag-selected-row-background-color: #F3F0FF;
    --ag-header-column-separator-display: block;
    --ag-header-column-separator-color: #F1F5F9;
    --ag-header-column-resize-handle-display: none;
    --ag-checkbox-background-color: #FFFFFF;
    --ag-checkbox-border-radius: 6px;
    --ag-checkbox-checked-color: #6D28D9;
    border: none !important;
}
.ag-theme-quartz .ag-row.ag-row-selected,
.ag-theme-quartz .ag-row.ag-row-selected .ag-cell {
    background-color: #F3F0FF !important;
}
.ag-theme-quartz .ag-row.ag-row-selected::before {
    background-color: transparent !important;
}
.ag-theme-quartz .ag-root-wrapper {
    border: none !important;
    box-shadow: none !important;
}
.ag-theme-quartz .ag-header {
    border-bottom: 1px solid #f3f4f6 !important;
}
.ag-theme-quartz .ag-header-cell {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-weight: 600 !important;
    color: #64748B !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 12px;
}
.ag-theme-quartz .ag-cell {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
.ag-theme-quartz .ag-header-cell-label {
    justify-content: flex-start;
    align-items: center !important;
    height: 100%;
    margin-top: 0 !important;
}
/* Floating filter input styling */
.ag-theme-quartz .ag-input-field-input {
    background-color: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    height: 28px !important;
    transition: all 0.2s;
}
.ag-theme-quartz .ag-input-field-input:focus {
    border-color: #94A3B8 !important;
    background-color: #FFFFFF !important;
    box-shadow: 0 0 0 2px #F1F5F9 !important;
}
.ag-theme-quartz .ag-floating-filter {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}
/* Hide the AG Grid internal search/filter icon inside the floating filter input so it doesn't overlap text */
.ag-theme-quartz .ag-floating-filter-body .ag-icon,
.ag-theme-quartz .ag-floating-filter-body .ag-input-field-icon,
.ag-theme-quartz .ag-floating-filter-body .ag-wrapper::before,
.ag-theme-quartz .ag-floating-filter-body [class^="ag-icon-"],
.ag-theme-quartz .ag-floating-filter-body svg {
    display: none !important;
}

/* =========================================
   Form Customizations & Premium UI
   ========================================= */

/* Make form controls smaller globally */
.form-control, .form-select {
    font-size: 0.85rem !important;
    padding: 0.35rem 0.75rem !important;
    border-color: #E2E8F0;
    box-shadow: none !important;
    border-radius: 6px;
}
.form-control:focus, .form-select:focus {
    border-color: #94A3B8;
}

/* Make labels smaller and bolder */
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748B; /* Muted Tailwind gray */
    margin-bottom: 0.25rem;
}

/* Premium Form Card */
.card {
    border-radius: 12px;
    border: 1px solid #f3f4f6;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Line Items Table Enhancements */
table#lineitem-table {
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}
table#lineitem-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 0.5rem;
}
table#lineitem-table tbody td {
    padding: 0.25rem 0.5rem;
    vertical-align: middle;
}
table#lineitem-table tbody td input,
table#lineitem-table tbody td select {
    margin: 0;
}
table#lineitem-table tbody tr {
    transition: background-color 0.2s ease;
}
table#lineitem-table tbody tr:hover {
    background-color: #F8FAFC;
}

/* Make help text and errors smaller */
.form-text {
    font-size: 0.75rem;
    color: #9CA3AF;
}
.text-danger.small {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Premium Nav Tabs for Forms */
.nav-tabs {
    border-bottom: 2px solid #F1F5F9;
}
.nav-tabs .nav-link {
    border: none;
    color: #64748B;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: #334155;
}
.nav-tabs .nav-link.active {
    color: #4F46E5;
    background: transparent;
    border-bottom: 2px solid #4F46E5;
}
.tab-content {
    padding-top: 1.5rem;
}

/* Global Action Icons styling */
.action-icon {
    transition: opacity 0.2s, transform 0.1s;
    font-size: 0.85rem;
}
.action-icon.view {
    color: #2563EB !important; /* Blue */
}
.action-icon.view:hover {
    opacity: 0.7;
    transform: scale(1.1);
    color: #1D4ED8 !important;
}
.action-icon.edit {
    color: #059669 !important; /* Green */
}
.action-icon.edit:hover {
    opacity: 0.7;
    transform: scale(1.1);
    color: #047857 !important;
}
.action-icon.delete {
    color: #DC2626 !important; /* Red */
}
.action-icon.delete:hover {
    opacity: 0.7;
    transform: scale(1.1);
    color: #B91C1C !important;
}

/* Ensure the AG Grid parent card constraints width so grid scrollbar is inside */
.premium-grid-card {
    max-width: 100%;
    overflow: hidden;
}. a g - p a g i n g - p a n e l   {   f l e x - w r a p :   n o w r a p   ! i m p o r t a n t ;   }   . a g - p a g i n g - r o w - s u m m a r y - p a n e l   {   d i s p l a y :   i n l i n e - b l o c k   ! i m p o r t a n t ;   w h i t e - s p a c e :   n o w r a p   ! i m p o r t a n t ;   }   . a g - p a g i n g - r o w - s u m m a r y - p a n e l   s p a n   {   d i s p l a y :   i n l i n e   ! i m p o r t a n t ;   }  
 
/* Fix AG Grid Pagination Wrapping */
.ag-paging-panel {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    white-space: nowrap !important;
}
.ag-paging-row-summary-panel {
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    flex-direction: row !important;
    gap: 4px;
}
.ag-paging-row-summary-panel span {
    display: inline-block !important;
    visibility: visible !important;
}
