/**
 * Custom styles for Receipt Tracker application
 */

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

.card-header {
    border-bottom: none;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    border-top: none;
    background-color: transparent;
    padding: 1rem 1.5rem;
}

/* Table improvements */
.table th {
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.02);
}

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

/* Form improvements */
.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
}

/* Filter improvements */
.form-label small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.form-label i {
    opacity: 0.7;
}

.form-select-sm, .form-control-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.btn-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.form-check-input:checked {
    background-color: #198754;
    border-color: #198754;
}

.form-check-label small {
    font-size: 0.75rem;
    opacity: 0.9;
}

/* Filter card improvements */
.card.bg-dark .card-body {
    background-color: #212529;
    border-radius: 0.375rem;
}

/* Alert improvements */
.alert-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    border-color: rgba(13, 202, 240, 0.2);
    color: #0dcaf0;
}

.card.bg-dark .alert-info {
    background-color: rgba(13, 202, 240, 0.15);
    border-color: rgba(13, 202, 240, 0.3);
}

.card.bg-dark .form-control,
.card.bg-dark .form-select {
    border-color: #495057;
}

.card.bg-dark .form-control:focus,
.card.bg-dark .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Dashboard cards */
.dashboard-card {
    transition: transform 0.2s;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

/* Custom badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Receipt preview */
.receipt-preview-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

/* Custom nav styles */
.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    margin-right: 0.25rem;
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.nav-link.active {
    background-color: rgba(13, 110, 253, 0.2);
}

/* Footer styles */
.footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
}

/* Mobile transaction card styles - hidden by default */
.mobile-transactions {
    display: none;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    /* Filter improvements for mobile */
    .row.g-3 > .col-md-2,
    .row.g-3 > .col-md-3,
    .row.g-3 > .col-md-4 {
        margin-bottom: 1rem;
    }
    
    .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .d-flex.gap-2 .btn {
        width: 100%;
    }
    
    .text-end {
        text-align: center !important;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    /* Mobile transaction cards - hide table on mobile */
    .table-responsive {
        display: none;
    }
    
    .mobile-transactions {
        display: block;
    }
}

/* Desktop - hide mobile cards */
@media (min-width: 769px) {
    .mobile-transactions {
        display: none;
    }
}

.transaction-card {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    transition: all 0.2s ease;
}

.transaction-card:hover {
    background: #374151;
    border-color: #6b7280;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.transaction-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #4a5568;
}

.transaction-card-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.transaction-amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f7fafc;
}

.transaction-type {
    font-size: 0.875rem;
}

.transaction-description {
    color: #e2e8f0;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.transaction-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #a0aec0;
    margin-bottom: 0.75rem;
}

.transaction-detail-item {
    display: flex;
    flex-direction: column;
}

.transaction-detail-label {
    font-weight: 500;
    color: #718096;
    margin-bottom: 0.25rem;
}

.transaction-detail-value {
    color: #e2e8f0;
}

.transaction-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #4a5568;
}

.transaction-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-icon {
    font-size: 1.1rem;
}

.status-text {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Expandable details for mobile */
.transaction-expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.transaction-expandable.show {
    max-height: 200px;
}

.expand-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: #4a5568;
    color: #e2e8f0;
}

.expand-btn i {
    transition: transform 0.2s ease;
}

.expand-btn.expanded i {
    transform: rotate(180deg);
}

/* Custom Checkbox Dropdown Styles */
.checkbox-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

.checkbox-dropdown-toggle {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    background-color: #212529;
    border: 1px solid #495057;
    border-radius: 0.375rem;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.checkbox-dropdown-toggle:hover {
    background-color: #2c3034;
    border-color: #6c757d;
}

.checkbox-dropdown-toggle:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.checkbox-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #212529;
    border: 1px solid #495057;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
}

.checkbox-dropdown-menu.show {
    display: block;
}

.checkbox-dropdown-item {
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #495057;
}

.checkbox-dropdown-item:last-child {
    border-bottom: none;
}

.checkbox-dropdown-item:hover {
    background-color: #2c3034;
}

.checkbox-dropdown-item input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.checkbox-dropdown-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    color: #ffffff;
    font-size: 0.875rem;
}

.checkbox-dropdown-selected-count {
    font-size: 0.75rem;
    color: #6c757d;
    margin-left: 0.5rem;
}

.checkbox-dropdown-arrow {
    transition: transform 0.2s ease;
}

.checkbox-dropdown.open .checkbox-dropdown-arrow {
    transform: rotate(180deg);
}

/* Mobile Filter Container */
.mobile-filter-container {
    display: none;
}

.mobile-filter-toggle {
    display: none;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 0.375rem;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.mobile-filter-toggle:hover {
    background-color: #374151;
    border-color: #6b7280;
}

.mobile-filter-toggle i {
    transition: transform 0.2s ease;
    margin-right: 0.5rem;
}

.mobile-filter-toggle.expanded i {
    transform: rotate(180deg);
}

.mobile-filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #212529;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.mobile-filter-content.show {
    max-height: 1000px;
}

.mobile-filter-content .card-body {
    padding: 1rem;
}

/* Mobile-specific filter styles */
@media (max-width: 768px) {
    .mobile-filter-container {
        display: block;
    }
    
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Hide the original filter card on mobile */
    #desktop-filters {
        display: none;
    }
    
    /* Adjust filter form layout for mobile */
    .mobile-filter-content .row.g-3 > div {
        margin-bottom: 1rem;
    }
    
    .mobile-filter-content .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .mobile-filter-content .d-flex.gap-2 .btn {
        width: 100%;
    }
    
    /* Mobile receipt cards - hide table on mobile */
    #receipts-container .table-responsive {
        display: none !important;
    }
    
    #receipts-container .mobile-receipts {
        display: block !important;
    }
    
    /* Debug: Make sure mobile receipts are visible */
    .mobile-receipts {
        background: #f8f9fa !important;
        border: 2px solid #007bff !important;
        padding: 1rem !important;
    }
}

/* Desktop - hide mobile receipt cards */
@media (min-width: 769px) {
    #receipts-container .mobile-receipts {
        display: none;
    }
}

/* Mobile receipt card styles */
.mobile-receipts {
    display: block;
}

.receipt-card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 100px; /* Ensure cards have minimum height */
}

.receipt-card:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.receipt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.receipt-amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: #198754;
}

.receipt-card-main {
    margin-bottom: 0.75rem;
}

.receipt-description {
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.receipt-project {
    margin-bottom: 0.5rem;
}

.receipt-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.75rem;
}

.receipt-detail-item {
    display: flex;
    flex-direction: column;
}

.receipt-detail-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.25rem;
}

.receipt-detail-value {
    color: #6c757d;
}

.receipt-files {
    margin-bottom: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
}

.receipt-files-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.receipt-files-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.receipt-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
}

/* Drag and Drop Upload Zone Styles */
.drag-drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.drag-drop-zone:hover {
    border-color: #0d6efd;
    background-color: #f0f8ff;
}

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

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

.drag-drop-zone:hover .upload-icon,
.drag-drop-zone.drag-over .upload-icon {
    color: #0d6efd;
    transform: scale(1.1);
}

.drag-drop-zone .upload-text {
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.drag-drop-zone .upload-hint {
    color: #adb5bd;
    font-size: 0.875rem;
}

.drag-drop-zone .file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* File Preview Styles */
.file-preview {
    text-align: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.file-preview.image-preview img {
    max-height: 200px;
    max-width: 100%;
    object-fit: contain;
}

.file-preview.pdf-preview {
    background-color: #fff5f5;
    border-color: #fecaca;
}

.file-preview.pdf-preview i {
    color: #dc3545;
}

/* Upload Message Styles */
.upload-message {
    margin-top: 1rem;
    border-radius: 6px;
}

.upload-message .btn-close {
    font-size: 0.75rem;
}

/* Responsive adjustments for drag-drop */
@media (max-width: 768px) {
    .drag-drop-zone {
        padding: 1.5rem;
        min-height: 150px;
    }
    
    .drag-drop-zone .upload-icon {
        font-size: 2.5rem;
    }
    
    .file-preview.image-preview img {
        max-height: 150px;
    }
}
