/* ERP System - Main Stylesheet */

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100vh;
    background-color: #212529;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    overflow-y: scroll !important;
    overflow-x: hidden;
    transition: width 0.3s ease;
    padding-bottom: 1rem;
}

/* Override Bootstrap col behavior */
.col-md-2.sidebar {
    flex: 0 0 250px;
    max-width: 250px;
}

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

.sidebar::-webkit-scrollbar-track {
    background: #1a1e21;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #495057;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

.sidebar .nav-link {
    color: #adb5bd;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: #0d6efd;
}

.sidebar .nav-section {
    color: #6c757d;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1rem 0.5rem;
    font-weight: 600;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 1.5rem;
    min-height: 100vh;
    background-color: #f8f9fa;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1rem;
}

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

/* Tables */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #495057;
    border-bottom-width: 2px;
}

.table td {
    vertical-align: middle;
}

/* Badges */
.badge-status-draft { background-color: #6c757d; }
.badge-status-posted { background-color: #198754; }
.badge-status-partial { background-color: #ffc107; color: #000; }
.badge-status-paid { background-color: #198754; }
.badge-status-void { background-color: #dc3545; }
.badge-status-overdue { background-color: #dc3545; }

/* Form Styles */
.form-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1rem;
}

/* Line Items Table */
.line-items-table input,
.line-items-table select {
    font-size: 0.875rem;
}

.line-items-table .form-control-sm {
    padding: 0.25rem 0.5rem;
}

/* Report Styles */
.report-header {
    border-bottom: 3px double #dee2e6;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.report-table th {
    background-color: #e9ecef;
}

.report-total {
    font-weight: 700;
    border-top: 2px solid #000;
}

/* Dashboard Stats */
.stat-card {
    border-left: 4px solid;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.border-primary { border-left-color: #0d6efd !important; }
.stat-card.border-danger { border-left-color: #dc3545 !important; }
.stat-card.border-success { border-left-color: #198754 !important; }
.stat-card.border-warning { border-left-color: #ffc107 !important; }

/* HTMX Styles */
.htmx-request {
    opacity: 0.5;
    transition: opacity 200ms ease-in;
}

.htmx-settling {
    opacity: 1;
    transition: opacity 200ms ease-in;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar .nav-link span,
    .sidebar .nav-section {
        display: none;
    }
    
    .sidebar .nav-link {
        justify-content: center;
        padding: 0.75rem;
    }
    
    .main-content {
        margin-left: 60px;
    }
}
