* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    color: white;
}

/* Header Section */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Stats Dashboard */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.stat-box {
    background: rgba(255,255,255,0.15);
    padding: 12px 24px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 5px;
}

/* Buttons */
.filter-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 12px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    margin-top: 20px;
    margin-bottom: 20px;
}

.filter-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* Common styles for receipt action buttons */
.receipt-action-btn {
    color: white;
    border: none; 
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

.view-btn {
    background: #3182ce;
}

.view-btn:hover {
    background: #2c5aa0;
}

.delete-btn {
    background: #ef4444;
}

.delete-btn:hover {
    background: #dc2626;
}

.view-image-btn {
    background: #a5dc86;
    color: white;
    border: none;
}

.view-image-btn:hover {
    background: #92c97c; /* Slightly darker green for hover */
}
.export-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
    margin-left: 10px;
}

.export-btn:hover {
    background: #38a169;
}

/* Filter Modal */
.filter-modal {
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-modal.show {
    opacity: 1;
    visibility: visible;
}

.filter-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.filter-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.filter-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #718096;
    transition: color 0.2s;
}

.filter-close:hover {
    color: #2d3748;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.filter-group input[type="date"],
.filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.filter-group input[type="date"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.filter-buttons button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.filter-apply {
    background: #667eea;
    color: white;
}

.filter-apply:hover {
    background: #5568d3;
}

.filter-reset {
    background: #e2e8f0;
    color: #2d3748;
}

.filter-reset:hover {
    background: #cbd5e0;
}

/* Daily Summary */
.daily-summary {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.daily-summary-date {
    font-weight: 700;
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 8px;
}

.daily-summary-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    font-size: 0.85rem;
}

.daily-summary-item {
    color: #4a5568;
}

.daily-summary-total {
    font-weight: 600;
    color: #667eea;
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin-bottom: 30px;
}

.drop-zone {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9ff;
}

.drop-zone:hover, .drop-zone.drag-over {
    background: #e8ebff;
    border-color: #764ba2;
    transform: scale(1.02);
}

.drop-zone svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    color: #667eea;
}

.drop-zone h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.drop-zone p {
    color: #666;
    font-size: 0.95rem;
}

input[type="file"] {
    display: none;
}

/* Queue Status */
.queue-status {
    display: none;
    background: #e6f7ff;
    border: 2px solid #1890ff;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.queue-status.show {
    display: block;
}

.queue-item {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #1890ff;
}

.queue-item.completed {
    border-left-color: #52c41a;
    background: #f6ffed;
}

.queue-item.failed {
    border-left-color: #ff4d4f;
    background: #fff1f0;
}

.queue-item-name {
    font-weight: 600;
    color: #2d3748;
}

.queue-item-status {
    font-size: 0.85rem;
    color: #718096;
}

.spinner-small {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Display */
.error {
    display: none;
    background: #fff5f5;
    border: 2px solid #fc8181;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: #c53030;
}

/* Receipts List */
.receipts-list {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.receipts-list h2 {
    color: #333;
    margin-bottom: 20px;
}

.receipt-card {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.receipt-card:hover {
    transform: translateX(5px);
}

.receipt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.merchant {
    font-weight: 700;
    font-size: 1.2rem;
    color: #2d3748;
}

.amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
}

.receipt-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
    color: #4a5568;
}

.receipt-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-category {
    background: #e6fffa;
    color: #047857;
}

.badge-payment {
    background: #fef3c7;
    color: #92400e;
}

.badge-construction {
    background: #fef3c7;
    color: #92400e;
}

.badge-fuel {
    background: #fce7f3;
    color: #831843;
}

/* Modal System */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #718096;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #2d3748;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.modal-section {
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
}

.modal-section h3 {
    font-size: 0.9rem;
    color: #667eea;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.modal-field {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-field:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.modal-value {
    font-size: 0.95rem;
    color: #2d3748;
    margin-top: 4px;
    word-break: break-word;
}

/* Items Table */
.items-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.items-table th {
    background: #667eea;
    color: white;
    padding: 10px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
}

.items-table td {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

/* OCR Text Display */
.ocr-text {
    font-family: monospace;
    font-size: 0.8rem;
    color: #2d3748;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    padding: 10px;
    border-radius: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .stats-container {
        gap: 15px;
    }

    .stat-box {
        padding: 10px 20px;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }

    .receipt-details {
        grid-template-columns: 1fr;
    }

    .filter-content {
        padding: 25px;
    }
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 5px;
}

.tab-link {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 8px;
}

.tab-link.active {
    background: white;
    color: #667eea;
}

.tab-content {
    display: none;
}

/* Mileage List */
.mileage-list {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.mileage-list h2 {
    color: #333;
    margin-bottom: 20px;
}

.mileage-card {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #764ba2;
    transition: transform 0.2s;
}

.mileage-card:hover {
    transform: translateX(5px);
}

.mileage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.vehicle-reg {
    font-weight: 700;
    font-size: 1.2rem;
    color: #2d3748;
}

.mileage {
    font-size: 1.3rem;
    font-weight: 700;
    color: #764ba2;
}

.mileage-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
    color: #4a5568;
}

.mileage-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

/* Enhanced Mileage Card Styles */
.mileage-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: white;
}

.mileage-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.3);
}

.mileage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.vehicle-reg {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.mileage {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
}

.mileage-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    opacity: 0.95;
}

.mileage-details > div {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 6px;
    backdrop-filter: blur(5px);
}

.mileage-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mileage-actions button,
.mileage-actions a {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.mileage-actions .view-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    flex: 1;
}

.mileage-actions .view-btn:hover {
    background: white;
    transform: scale(1.05);
}

.mileage-actions .delete-btn {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.mileage-actions .delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.05);
}

/* Mileage List Container */
.mileage-list {
    margin-top: 30px;
}

.mileage-list h2 {
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 1.5rem;
}

/* Export Button for Mileage */
.mileage-export-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 12px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    margin-left: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.mileage-export-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* Form styling for vehicle registration */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 1; /* Ensure consistent line height */
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="text"]::placeholder {
    text-transform: none;
    font-weight: normal;
    letter-spacing: normal;
    opacity: 0.5;
}

#projectAddress {
    margin-bottom: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mileage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .mileage-details {
        grid-template-columns: 1fr;
    }

    .mileage-actions {
        flex-direction: column;
    }

    .mileage-actions button,
    .mileage-actions a {
        width: 100%;
        text-align: center;
    }
}

.info-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    margin-left: 10px;
}
.info-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Instructions Modal Specific Styles */
#instructionsModal .modal-content {
    background: white;
    color: #333;
}

#instructionsModal .modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

#instructionsModal h2 {
    color: #667eea;
}

#instructionsModal .modal-body h3 {
    color: #764ba2;
    margin-bottom: 15px;
}

#instructionsModal .modal-body ul {
    list-style-type: none;
    padding-left: 0;
}

#instructionsModal .modal-body li {
    margin-bottom: 10px;
    line-height: 1.6;
    padding-left: 25px;
    position: relative;
}

#instructionsModal .modal-body li::before {
    content: '✓';
    color: #48bb78;
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* SweetAlert2 Customizations */
.swal-custom-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.swal-custom-title {
    color: white !important;
    font-size: 1.5rem !important;
}

.swal-custom-content {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 1rem !important;
}

.swal-custom-confirm-button {
    background-color: #48bb78 !important;
    color: white !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: background-color 0.2s !important;
}

.swal-custom-confirm-button:hover {
    background-color: #38a169 !important;
}

.swal-custom-cancel-button {
    background-color: #ef4444 !important;
    color: white !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: background-color 0.2s !important;
}

.swal-custom-cancel-button:hover {
    background-color: #dc2626 !important;
}

.view-image-btn {
    background: #a5dc86;
    color: white;
    border: none;
    padding: 8px 16px; /* Adjusted to match other buttons */
    border-radius: 6px; /* Adjusted to match other buttons */
    font-size: 0.85rem; /* Adjusted to match other buttons */
    font-weight: 600;
    transition: background 0.2s;
}

.view-image-btn:hover {
    background: #92c97c; /* Slightly darker green for hover */
}

.detail-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-with-clear {
    position: relative;
    width: 100%;
}

.input-with-clear #projectAddress {
    padding-right: 40px; /* Make space for the button */
}

.clear-input-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #a0aec0; /* Light gray color */
    cursor: pointer;
    font-size: 1.2rem;
    /* Removed padding and line-height */
    transition: color 0.2s;
}

.clear-input-btn:hover {
    color: #718096; /* Darker gray on hover */
}