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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.upload-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.file-input-wrapper {
    margin-bottom: 10px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

input[type="file"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
}

input[type="date"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin: 0 5px;
}

.date-range-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f7ff;
    border-radius: 4px;
    display: none;
}

.date-range-section.show {
    display: block;
}

.date-range-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.summary-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f7ff;
    border-radius: 4px;
    display: none;
}

.summary-section.show {
    display: block;
}

.summary-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.summary-stat {
    display: flex;
    flex-direction: column;
}

.summary-stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.summary-stat-value {
    font-size: 24px;
    font-weight: 600;
}

.summary-stat-value.income {
    color: #2e7d32;
}

.summary-stat-value.spent {
    color: #d32f2f;
}

.file-errors {
    margin-top: 10px;
    padding: 10px;
    background-color: #fff3cd;
    border-radius: 4px;
    display: none;
}

.file-errors.show {
    display: block;
}

.file-error-item {
    margin: 5px 0;
    color: #856404;
    font-size: 14px;
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.error-message {
    color: #d32f2f;
    margin-top: 10px;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: #2e7d32;
    margin-top: 10px;
    padding: 10px;
    background-color: #e8f5e9;
    border-radius: 4px;
    display: none;
}

.success-message.show {
    display: block;
}

.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

thead {
    background-color: #f8f9fa;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

th.amount-header {
    text-align: right;
}

th.sortable {
    cursor: pointer;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #dee2e6;
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

tbody tr:hover {
    background-color: #e9ecef;
}

.amount-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.amount-positive {
    color: #2e7d32;
}

.amount-negative {
    color: #d32f2f;
}

.info-text {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

.dismiss-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s;
}

.dismiss-btn:hover {
    background-color: #f0f0f0;
    color: #d32f2f;
}

.dismiss-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1000;
    max-width: 300px;
}

.toast.show {
    display: block;
}

.toast-undo {
    margin-left: 12px;
    color: #4CAF50;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.toast-undo:hover {
    color: #66BB6A;
}

.dropzone {
    border: 2px dashed #ccc;
    border-radius: 4px;
    padding: 40px;
    text-align: center;
    background-color: #fafafa;
    margin-bottom: 20px;
    transition: all 0.2s;
    cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #007bff;
    background-color: #f0f7ff;
}

.dropzone.error {
    border-color: #d32f2f;
    background-color: #ffebee;
}

.dropzone-text {
    color: #666;
    font-size: 14px;
}

.dropzone.dragover .dropzone-text {
    color: #007bff;
    font-weight: 500;
}

.clear-data-btn {
    background-color: #dc3545;
    margin-left: 10px;
}

.clear-data-btn:hover {
    background-color: #c82333;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.date-error {
    color: #d32f2f;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.date-error.show {
    display: block;
}

.editable-description {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.editable-description:hover {
    background-color: #f0f0f0;
}

.editable-description.editing {
    background-color: white;
    border: 2px solid #007bff;
    outline: none;
}

.description-input {
    width: 100%;
    padding: 4px 8px;
    border: 2px solid #007bff;
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
}

.category-cell {
    position: relative;
}

.category-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    background-color: white;
    cursor: pointer;
}

.category-select:focus {
    border-color: #007bff;
    outline: none;
}

.category-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

.category-input:focus {
    border-color: #007bff;
    outline: none;
}

.category-input::placeholder {
    color: #999;
    font-style: italic;
}

.category-filter-section {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.category-filter-section label {
    margin-right: 10px;
}

.category-filter-section select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.bulk-actions {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    display: none;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.bulk-actions.show {
    display: flex;
}

.bulk-actions-count {
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.bulk-actions-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.bulk-actions select,
.bulk-actions input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.bulk-actions button {
    margin-top: 0;
}

.clear-selection-btn {
    background-color: #6c757d;
}

.clear-selection-btn:hover {
    background-color: #5a6268;
}

.select-column {
    width: 36px;
}

.row-select,
#selectAllCheckbox {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .summary-stats {
        flex-direction: column;
        gap: 15px;
    }

    .date-range-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    input[type="date"] {
        width: 100%;
        margin: 5px 0;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px;
    }
}
