/* Custom Styles for Expense Tracking App */

:root {
    --success-color: #198754;
    --danger-color: #dc3545;
    --secondary-color: #6c757d;
}

body {
    background-color: #f8f9fa;
}

/* Summary Cards */
.summary-card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.summary-card .card-title {
    font-weight: 600;
    color: #212529;
}

/* Status Badges */
.badge.bg-success {
    background-color: var(--success-color) !important;
}

.badge.bg-danger {
    background-color: var(--danger-color) !important;
}

.badge.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.status-badge {
    font-size: 0.875rem;
    padding: 0.35em 0.65em;
    transition: opacity 0.2s;
}

.status-badge:hover {
    opacity: 0.85;
}

/* Editable Balance Due */
.balance-due-cell {
    display: inline-block;
    padding: 2px 6px;
    min-width: 80px;
    border-bottom: 2px dotted transparent;
    transition: border-color 0.2s;
}

.balance-due-cell:hover {
    border-bottom-color: #0d6efd;
    cursor: text;
}

.balance-due-cell:focus {
    outline: none;
    border-bottom-color: #0d6efd;
    background-color: #e7f1ff;
}

/* Table Styling */
.table {
    font-size: 0.95rem;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.table tbody tr {
    transition: background-color 0.2s;
}

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

/* Card Styling */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

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

/* Button Styling */
.btn {
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Toast Notifications */
.toast {
    min-width: 250px;
}

.toast-header {
    background-color: #0d6efd;
    color: white;
}

.toast-success .toast-header {
    background-color: var(--success-color);
}

.toast-error .toast-header {
    background-color: var(--danger-color);
}

/* DataTables Custom Styling */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_info {
    padding-top: 0.85em;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .summary-card {
        margin-bottom: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .btn {
        margin-bottom: 0.5rem;
    }
}

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

/* Alert Styling */
.alert {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Date Filter Styling */
.filter-preset {
    text-align: left;
    font-weight: 500;
    border-width: 2px;
}

.filter-preset:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.filter-preset.active {
    font-weight: 600;
}

.filter-preset i {
    margin-right: 0.5rem;
}

/* Collapsible Filter Header */
.card-header[data-bs-toggle="collapse"] {
    user-select: none;
    transition: background-color 0.2s;
    position: relative;
}

.card-header[data-bs-toggle="collapse"]:hover {
    background-color: #f8f9fa !important;
}

.card-header[data-bs-toggle="collapse"]:hover .collapse-icon {
    color: #0d6efd;
    transform: scale(1.2);
}

.collapse-icon {
    transition: all 0.3s ease;
    font-size: 1.5rem;
    font-weight: bold;
    color: #495057;
    background-color: #e9ecef;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
    background-color: #0d6efd;
    color: white;
}

#active-filter-badge {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #0d6efd !important;
    font-weight: 500;
}

#active-filter-badge i {
    font-size: 0.75rem;
}

#active-filter-display {
    margin-top: 1rem;
    animation: fadeIn 0.3s ease-in;
}

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

#year-select,
#from-date,
#to-date {
    transition: border-color 0.2s, box-shadow 0.2s;
}

#year-select:focus,
#from-date:focus,
#to-date:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

#apply-custom-filter {
    font-weight: 500;
}

#clear-filter {
    font-weight: 500;
    border-width: 2px;
}

/* Paid Row Styling */
table.dataTable tbody tr.paid-row,
table.dataTable.table-striped tbody tr.paid-row,
.table-striped tbody tr.paid-row,
tr.paid-row {
    background-color: #d4edda !important;
    transition: background-color 0.3s ease;
}

table.dataTable tbody tr.paid-row:hover,
table.dataTable.table-striped tbody tr.paid-row:hover,
.table-striped tbody tr.paid-row:hover,
tr.paid-row:hover {
    background-color: #c3e6cb !important;
}

/* Override DataTables even/odd row coloring for paid rows */
table.dataTable.stripe tbody tr.paid-row.odd,
table.dataTable.display tbody tr.paid-row.odd {
    background-color: #d4edda !important;
}

table.dataTable.stripe tbody tr.paid-row.even,
table.dataTable.display tbody tr.paid-row.even {
    background-color: #d4edda !important;
}

/* Prevent checkbox click from triggering row click */
.paid-checkbox {
    z-index: 10;
}

/* Notifications Dropdown Styles */
.notifications-dropdown {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.notifications-dropdown .dropdown-header {
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-bottom: 0;
}

.notification-list-item {
    border-bottom: 1px solid #e9ecef;
}

.notification-list-item:last-child {
    border-bottom: none;
}

.notification-item-wrapper {
    display: flex;
    align-items: stretch;
    transition: background-color 0.2s;
}

.notification-item-wrapper:hover {
    background-color: #f8f9fa;
}

.notification-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    flex: 1;
    display: block;
    text-decoration: none;
    color: inherit;
}

.notification-check-btn {
    padding: 0.75rem 0.75rem;
    border: none;
    background: transparent;
    color: #6c757d;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid #e9ecef;
}

.notification-check-btn:hover {
    background-color: #28a745;
    color: white;
    transform: scale(1.1);
}

.notification-check-btn i {
    font-size: 1.25rem;
}

.notification-item .notification-title {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.notification-item .notification-vendor {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.notification-item .notification-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #6c757d;
}

.notification-source-badge {
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
}

#notification-badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

#notificationsDropdown {
    transition: opacity 0.2s;
}

#notificationsDropdown:hover {
    opacity: 0.8;
}

#mark-all-read-btn {
    color: #0d6efd;
    font-weight: 500;
}

#mark-all-read-btn:hover {
    color: #0a58ca;
    text-decoration: underline !important;
}

/* Status Filter Buttons */
.status-filter-btn {
    font-weight: 500;
    border-width: 2px;
    transition: all 0.3s ease;
}

.status-filter-btn.active {
    font-weight: 600;
    transform: none !important;
    box-shadow: inset 0 0 0 2px currentColor;
}

.status-filter-btn:not(.active):hover {
    transform: translateY(-2px);
}

.status-filter-btn[data-status="all"].active {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.status-filter-btn[data-status="DRAFT"].active {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.status-filter-btn[data-status="OVERDUE"].active {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.status-filter-btn[data-status="PAID"].active {
    background-color: #198754;
    border-color: #198754;
    color: white;
}

/* Notes Button Styling */
.notes-btn {
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #6c757d;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.notes-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
    transform: scale(1.05);
}

.notes-btn.has-content {
    background-color: #ffc107;
    border-color: #ffca2c;
    color: #000;
    font-weight: 600;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.3);
    animation: pulse-notes 2s infinite;
}

.notes-btn.has-content:hover {
    background-color: #ffca2c;
    border-color: #ffc720;
    transform: scale(1.1);
}

@keyframes pulse-notes {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.5);
    }
    50% {
        box-shadow: 0 0 0 0.4rem rgba(255, 193, 7, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

/* Attachments List Styling */
.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.attachment-item:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.attachment-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.attachment-icon {
    font-size: 1.5rem;
    color: #6c757d;
    margin-right: 0.75rem;
}

.attachment-details {
    flex: 1;
}

.attachment-name {
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.25rem;
}

.attachment-meta {
    font-size: 0.875rem;
    color: #6c757d;
}

.attachment-actions {
    display: flex;
    gap: 0.5rem;
}

.attachment-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Notes and Files Modal */
#notes-content textarea {
    border: 2px solid #dee2e6;
    transition: border-color 0.2s ease;
}

#notes-content textarea:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Drag and Drop Zone */
.drop-zone {
    border: 3px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #adb5bd;
    background-color: #e9ecef;
}

.drop-zone.drag-over {
    border-color: #0d6efd;
    background-color: #e7f1ff;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(13, 110, 253, 0.2);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-icon {
    font-size: 3rem;
    color: #6c757d;
    display: block;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon {
    color: #0d6efd;
    transform: translateY(-5px);
}

.drop-zone-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.drop-zone-subtext {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.drop-zone label.btn {
    pointer-events: all;
    cursor: pointer;
}

/* File Upload Progress */
.upload-progress {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #e7f1ff;
    border: 1px solid #0d6efd;
    border-radius: 0.375rem;
}

.upload-progress-text {
    font-size: 0.875rem;
    color: #0d6efd;
    font-weight: 500;
}

/* Company Filter Styling */
#company-filter-select {
    min-width: 250px;
}

#company-count {
    font-weight: 500;
    color: #0d6efd;
}

/* Select2 Custom Styling */
.select2-container--bootstrap-5 .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px) !important;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.select2-container--bootstrap-5 .select2-selection--single:focus,
.select2-container--bootstrap-5.select2-container--open .select2-selection--single {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    line-height: calc(1.5em + 0.75rem) !important;
    padding: 0 !important;
    color: #212529;
}

.select2-container--bootstrap-5 .select2-selection__arrow {
    height: calc(1.5em + 0.75rem) !important;
    top: 1px !important;
    right: 8px !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 2px;
    z-index: 9999 !important;
}

.select2-container--bootstrap-5 .select2-search--dropdown {
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    width: 100%;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: background-color 0.15s ease;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #0d6efd !important;
    color: white !important;
}

.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: #e7f1ff;
    color: #0d6efd;
    font-weight: 500;
}

.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
    background-color: #e7f1ff;
}

.select2-container--bootstrap-5 .select2-selection__placeholder {
    color: #6c757d;
}

/* Ensure Select2 dropdown appears below modals but above normal content */
.select2-container {
    z-index: 1000 !important;
}

.select2-dropdown {
    z-index: 1040 !important;
}

/* Bootstrap modals have z-index 1055, so this ensures modals appear on top */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

/* Duplicate Warning Styling */
.notification-list-item.duplicate-warning {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.notification-list-item.duplicate-warning:hover {
    background-color: #ffe69c;
}

.notification-list-item.duplicate-warning .notification-item-wrapper {
    background-color: transparent;
}

.notification-list-item.duplicate-warning .notification-item-wrapper:hover {
    background-color: rgba(255, 193, 7, 0.1);
}

.notification-item.duplicate-item .notification-title {
    color: #cc8800;
    font-weight: 700;
}

.notification-item.duplicate-item .notification-title i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
    animation: shake 2s infinite;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

.notification-item.duplicate-item .notification-vendor {
    color: #212529;
    font-weight: 500;
}

.notification-item.duplicate-item .notification-meta {
    color: #dc3545;
    font-weight: 600;
}

/* Total Sum Footer Row */
#invoices-table tfoot tr {
    background-color: #cfe2ff !important;
    border-top: 3px solid #0d6efd;
}

#invoices-table tfoot td {
    background-color: #cfe2ff !important;
    padding: 0.75rem;
    font-size: 1.05rem;
}

#total-amount-display {
    font-size: 1.15rem;
    color: #0a58ca;
}

/* Ensure footer stays visible with DataTables */
.dataTables_wrapper tfoot {
    display: table-footer-group !important;
}

