/* Custom styles for the PHP Invoice System */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Sidebar styles */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar .nav-link {
    color: #333;
    border-radius: 0.25rem;
    margin: 0.25rem 0.5rem;
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1);
    font-weight: 500;
}

/* Cards with colored borders */
.border-left-primary {
    border-left: 0.25rem solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 0.25rem solid var(--success-color) !important;
}

.border-left-warning {
    border-left: 0.25rem solid var(--warning-color) !important;
}

.border-left-info {
    border-left: 0.25rem solid var(--info-color) !important;
}

/* Invoice container */
.invoice-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Product item styling */
.product-item {
    background-color: #f8f9fa;
    transition: all 0.2s ease-in-out;
}

.product-item:hover {
    background-color: #e9ecef;
}

/* Table improvements */
.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Button improvements */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-group-sm > .btn, .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

/* Alert improvements */
.alert {
    border: none;
    border-radius: 0.5rem;
    border-left: 4px solid;
}

.alert-primary {
    border-left-color: var(--primary-color);
}

.alert-success {
    border-left-color: var(--success-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* Card improvements */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Form improvements */
.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Modal improvements */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

/* Badge improvements */
.badge {
    font-weight: 500;
    font-size: 0.75em;
    border-radius: 0.375rem;
}

/* Navigation improvements */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Text utilities */
.text-xs {
    font-size: 0.75rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

/* Mobile navigation styles */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile navbar toggler styles */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    background: transparent;
    color: white;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler i {
    font-size: 1.2rem;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100vh;
        z-index: 100;
        background-color: white;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        padding-top: 1rem;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0;
        margin: 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
    }
    
    .invoice-container {
        margin: 1rem;
    }
    
    .btn-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group {
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (min-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 100;
        padding: 48px 0 0;
        box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    }
    
    .main-content {
        margin-left: 250px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .navbar,
    .btn-toolbar,
    .border-bottom,
    .card-header,
    .alert {
        display: none !important;
    }
    
    .invoice-container {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    
    .card-body {
        padding: 0 !important;
    }
    
    body {
        background: white !important;
        font-size: 12pt;
    }
    
    .table {
        font-size: 11pt;
    }
    
    .btn {
        display: none !important;
    }
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Empty state styling */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state i {
    opacity: 0.5;
}

/* Status badges */
.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-paid {
    background-color: #d1edff;
    color: #0c5460;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

/* Invoice specific styles */
.company-info {
    font-size: 0.9rem;
    line-height: 1.4;
}

.customer-info {
    font-size: 0.9rem;
    line-height: 1.4;
}

.creator-info {
    font-size: 0.9rem;
    color: #6c757d;
}

.invoice-details table {
    font-size: 0.9rem;
}

/* Animation for smooth transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Focus styles for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

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

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

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

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

/* Chart styling */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-card .card-body {
    padding: 1.5rem;
    height: 350px;
}

.chart-card canvas {
    max-height: 280px;
}

/* Border styling for chart cards */
.border-left-secondary {
    border-left: 0.25rem solid var(--secondary-color) !important;
}

/* Avatar circles for sales metrics */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Enhanced progress bars */
.progress {
    background-color: #f1f3f4;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Sales metrics table enhancements */
#salesMetricsTable {
    font-size: 0.9rem;
}

#salesMetricsTable th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
    white-space: nowrap;
}

#salesMetricsTable tbody tr {
    transition: all 0.2s ease;
}

#salesMetricsTable tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#salesMetricsTable tfoot tr {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-top: 2px solid var(--primary-color);
}

#salesMetricsTable .badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
}

/* Date filter form styling */
#dateFilterForm .btn-group {
    width: 100%;
}

#dateFilterForm .btn-group .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
}

/* Export dropdown styling */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
}

.dropdown-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
}

/* Responsive enhancements for sales table */
@media (max-width: 992px) {
    #salesMetricsTable {
        font-size: 0.8rem;
    }
    
    #salesMetricsTable th,
    #salesMetricsTable td {
        padding: 0.5rem 0.25rem;
    }
    
    .avatar-circle {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    #dateFilterForm .col-md-3 {
        margin-bottom: 1rem;
    }
}