/* Pagination styles for transaction page */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: white;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    margin-top: auto;
    border-radius: 0 0 12px 12px;
}

.pagination-info {
    color: #6b7280;
    font-size: 0.9rem;
}

#page-info {
    font-weight: 600;
    color: #4b5563;
}

.pagination-buttons {
    display: flex;
    gap: 10px;
}

.page-button {
    background-color: #f3f4f6;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    color: #4b5563;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-button:hover:not(:disabled) {
    background-color: #e5e7eb;
    color: #1f2937;
}

.page-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-button.active {
    background-color: #6366f1;
    color: white;
}

/* Make sure pagination controls are visible */
#pagination-controls {
    display: flex !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }

    .pagination-info, .pagination-buttons {
        width: 100%;
        text-align: center;
    }

    .pagination-buttons {
        justify-content: center;
    }
}

/* Transaction Table Sorting Styles */
#transactionsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#transactionsTable th {
    padding: 14px 16px;
    text-align: left;
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    white-space: nowrap;
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-right: 25px !important; /* Make room for the sort indicator */
    transition: background-color 0.2s;
}

#transactionsTable th:hover {
    background-color: rgba(99, 102, 241, 0.05);
}

/* Sort indicators using pseudo-elements */
#transactionsTable th:after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.3;
    transition: opacity 0.2s;
}

#transactionsTable th:hover:after {
    opacity: 0.6;
}

#transactionsTable th.sort-asc:after {
    border-bottom: 5px solid var(--primary-color);
    border-top: none;
    opacity: 1;
}

#transactionsTable th.sort-desc:after {
    border-top: 5px solid var(--primary-color);
    border-bottom: none;
    opacity: 1;
}

#transactionsTable td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

#transactionsTable tr:hover {
    background-color: rgba(99, 102, 241, 0.02);
}

/* Better styling for the amount column */
#transactionsTable td:nth-child(3) {
    text-align: right;
    font-family: 'Roboto Mono', monospace, sans-serif;
    font-weight: 500;
}

/* Better styling for the category column */
#transactionsTable td:nth-child(4) {
    font-weight: 500;
}

/* Sticky header for better usability with long lists */
#transactionsTable thead {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
}

/* Table container styles */
.transactions-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    border-radius: 8px 8px 0 0;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Remove the arrow symbols from header text */
#transactionsTable th.sort-header {
    position: relative;
}

/* Ensure the loading state is centered and visible */
#transactionsTable tbody tr td.text-center {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

/* Time Period Selector Styles */
.date-filter-container {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.date-filter-container h2 {
    font-size: 1.5rem;
    margin-top: 0;
    color: #1e293b;
    text-align: left;
    padding-bottom: 0;
    margin-bottom: 20px;
}

.date-filter-container h2::after {
    display: none;
}

.period-selector {
    margin-top: 10px;
}

.preset-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.preset-filters button {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4b5563;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.preset-filters button.active {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.preset-filters button:hover:not(.active) {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.custom-date-range {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    margin-top: 16px;
    border: 1px solid #e2e8f0;
}

.date-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end; /* Align items at the bottom */
}

.input-group {
    flex: 1;
    min-width: 180px; /* Reduced from 200px for better spacing */
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4b5563;
}

.input-group input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
}

.input-group input[type="date"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

input[type="date"] {
    height: 42px;
    box-sizing: border-box;
}

button.button {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

button.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .date-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .input-group {
        width: 100%;
    }

    .button-group {
        width: 100%;
        margin-top: 16px;
    }

    .button {
        width: 100%;
    }
}

/* Additional fine-tuning for medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
    .input-group {
        min-width: 160px; /* Even smaller on medium screens */
    }
}


.button-group {
    display: flex;
    align-items: flex-end;
    margin-top: 8px; /* Give some space from the inputs on mobile */
}

/* Apply button styles */
.button {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
    white-space: nowrap; /* Prevent button text from wrapping */
    height: 42px; /* Fixed height to match inputs */
}