/* Custom Styles */

/* Font Configuration - Commissioner */
* {
    font-family: 'Commissioner', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: 'Commissioner', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8fafc;
}

.dark body {
    background-color: #1e293b;
}

/* Smooth transitions for dark mode */
* {
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

/* Main container styles */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Card styles */
.card {
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.dark .card {
    background-color: #1f2937;
    border: 1px solid #374151;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark .card-header {
    background-color: #1f2937;
    border-bottom: 1px solid #374151;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.dark .card-footer {
    background-color: #1f2937;
    border-top: 1px solid #374151;
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-primary {
    background-color: #3b82f6;
    color: #fff;
    border: 1px solid transparent;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.dark .btn-primary {
    background-color: #3b82f6;
}

.dark .btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: #fff;
    border: 1px solid transparent;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-outline-primary {
    background-color: transparent;
    border: 1px solid #3b82f6;
    color: #3b82f6;
}

.btn-outline-primary:hover {
    background-color: #3b82f6;
    color: #fff;
}

.dark .btn-outline-primary {
    border: 1px solid #3b82f6;
    color: #3b82f6;
}

.dark .btn-outline-primary:hover {
    background-color: #3b82f6;
    color: #fff;
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid #6b7280;
    color: #6b7280;
}

.btn-outline-secondary:hover {
    background-color: #6b7280;
    color: #fff;
}

.dark .btn-outline-secondary {
    border: 1px solid #9ca3af;
    color: #9ca3af;
}

.dark .btn-outline-secondary:hover {
    background-color: #6b7280;
    color: #fff;
}

.btn-outline-danger {
    background-color: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
}

.btn-outline-danger:hover {
    background-color: #ef4444;
    color: #fff;
}

/* Form styles */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

.dark .form-label {
    color: #e5e7eb;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #374151;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #3b82f6;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.dark .form-control {
    color: #e5e7eb;
    background-color: #1f2937;
    border-color: #4b5563;
}

.dark .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #374151;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    appearance: none;
}

.form-select:focus {
    border-color: #3b82f6;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.dark .form-select {
    color: #e5e7eb;
    background-color: #1f2937;
    border-color: #4b5563;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e5e7eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.dark .form-text {
    color: #9ca3af;
}

/* Table styles */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #374151;
    border-collapse: collapse;
}

.dark .table {
    color: #e5e7eb;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #e5e7eb;
}

.dark .table th,
.dark .table td {
    border-top: 1px solid #374151;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    text-align: left;
}

.dark .table thead th {
    border-bottom: 2px solid #374151;
}

.table tbody + tbody {
    border-top: 2px solid #e5e7eb;
}

.dark .table tbody + tbody {
    border-top: 2px solid #374151;
}

.table-hover tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.dark .table-hover tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Modal styles */
.modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
}

.modal-lg {
    max-width: 800px;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    outline: 0;
}

.dark .modal-content {
    background-color: #1f2937;
    border-color: rgba(255, 255, 255, 0.2);
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    border-top-left-radius: calc(0.5rem - 1px);
    border-top-right-radius: calc(0.5rem - 1px);
}

.dark .modal-header {
    border-bottom: 1px solid #374151;
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
    border-bottom-right-radius: calc(0.5rem - 1px);
    border-bottom-left-radius: calc(0.5rem - 1px);
}

.dark .modal-footer {
    border-top: 1px solid #374151;
}

/* List group styles */
.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: 0.375rem;
    overflow: hidden;
}

.list-group-item {
    position: relative;
    display: block;
    padding: 0.75rem 1.25rem;
    background-color: #fff;
    border: 1px solid #e5e7eb;
}

.dark .list-group-item {
    background-color: #1f2937;
    border-color: #374151;
}

.list-group-item:first-child {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.list-group-item:last-child {
    border-bottom-right-radius: inherit;
    border-bottom-left-radius: inherit;
}

.list-group-item + .list-group-item {
    border-top-width: 0;
}

.list-group-item-action {
    width: 100%;
    color: #4b5563;
    text-align: inherit;
    text-decoration: none;
}

.dark .list-group-item-action {
    color: #e5e7eb;
}

.list-group-item-action:hover, .list-group-item-action:focus {
    z-index: 1;
    color: #374151;
    text-decoration: none;
    background-color: #f9fafb;
}

.dark .list-group-item-action:hover, .dark .list-group-item-action:focus {
    color: #f9fafb;
    background-color: #374151;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-end {
    text-align: right;
}

.text-muted {
    color: #6b7280;
}

.dark .text-muted {
    color: #9ca3af;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.me-1 {
    margin-right: 0.25rem;
}

.me-2 {
    margin-right: 0.5rem;
}

.me-3 {
    margin-right: 1rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-3 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

/* Invoice specific styles */
.item-row {
    display: flex;
    margin-bottom: 0.5rem;
}

.item-row .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

.item-row .col-md-2,
.item-row .col-md-3,
.item-row .col-md-5 {
    position: relative;
    width: 100%;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.item-row .col-md-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

.item-row .col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.item-row .col-md-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
}

@media (max-width: 767.98px) {
    .item-row .col-md-2,
    .item-row .col-md-3,
    .item-row .col-md-5 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .item-row {
        flex-direction: column;
    }
}

/* Header and navigation styles */
header {
    background-color: #fff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.dark header {
    background-color: #111827;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Scrollbar styling for Webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Animations */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes slideInRight {
    0% { transform: translateX(20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.animate-slide-in {
    animation: slideInRight 0.3s ease-out;
}

/* Fix for Bootstrap Icons */
.bi {
    display: inline-block;
    vertical-align: -0.125em;
}

/* Main page sections */
.section-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.dark .section-header {
    color: #f9fafb;
}

/* Bootstrap Icons CDN */
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css");

/* Tab styles */
.tab-button {
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #4b5563 !important;
    border-color: #9ca3af !important;
}

.tab-button.active {
    color: #2563eb !important;
    border-color: #2563eb !important;
}

.dark .tab-button:hover {
    color: #d1d5db !important;
    border-color: #6b7280 !important;
}

.dark .tab-button.active {
    color: #60a5fa !important;
    border-color: #60a5fa !important;
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none !important;
}

/* Enhanced modal styles for invoice forms */
.invoice-item-row {
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.dark .invoice-item-row {
    border-color: #374151;
    background-color: #1f2937;
}

.invoice-item-row:last-child {
    margin-bottom: 0;
}

/* Responsive table improvements */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .px-6 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .py-4 {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}