/* Category Spending Specific Styles */
.category-spending-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Category Selector Section */
.category-selector-section {
    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);
}

.category-selector-section h2 {
    font-size: 1.5rem;
    margin-top: 0;
    color: #1e293b;
    text-align: left;
    padding-bottom: 0;
    margin-bottom: 20px;
}

.category-selector-section h2::after {
    display: none;
}

.category-selector {
    max-width: 400px;
}

.category-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4b5563;
}

.category-selector select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    color: #1e293b;
    background-color: white;
}

.category-selector select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Spending Graph Section */
.spending-graph-section {
    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);
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.graph-header h2 {
    font-size: 1.5rem;
    margin: 0;
    color: #1e293b;
    text-align: left;
    padding-bottom: 0;
}

.graph-header h2::after {
    display: none;
}

#selectedCategoryName {
    color: #6366f1;
    font-weight: 700;
}

.total-spending {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4b5563;
}

#totalCategorySpending {
    color: #6366f1;
    font-size: 1.4rem;
}

.graph-container {
    height: 400px;
    position: relative;
}

/* Spending Details Section */
.spending-details-section {
    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);
}

.spending-details-section h2 {
    font-size: 1.5rem;
    margin-top: 0;
    color: #1e293b;
    text-align: left;
    padding-bottom: 0;
    margin-bottom: 20px;
}

.spending-details-section h2::after {
    display: none;
}

/* Table styles */
.spending-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.spending-table th {
    background: #f8fafc;
    text-align: left;
    color: #4f46e5;
    font-weight: 600;
    border-bottom: 2px solid #4f46e5;
    white-space: nowrap;
}

.spending-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

.spending-table tr:hover td {
    background: #f8fafc;
}

.spending-table td.amount {
    font-family: 'Roboto Mono', monospace;
    text-align: right;
    font-weight: 500;
}

.spending-table td.percentage {
    text-align: right;
    color: #6b7280;
    font-weight: 500;
}

.spending-table td.count {
    text-align: center;
    color: #6b7280;
}

.text-center {
    text-align: center;
}

/* Empty state styling */
.empty-state {
    padding: 40px;
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
    color: #6b7280;
    margin: 20px 0;
}

/* Loading indicator */
.loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader-content {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    display: none;
    background: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}
.spending-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;  /* Match this size */
}

.spending-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    color: #4f46e5;
    font-weight: 600;
    border-bottom: 2px solid #4f46e5;
    white-space: nowrap;
    font-size: 0.875rem;  /* Consistent header size */
}

.spending-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;  /* Consistent cell size */
}

/* Specific style classes that can be added to cells */
.amount {
    font-family: 'Roboto Mono', monospace;
    text-align: right !important;
    font-weight: 500;
}

.percentage {
    text-align: right !important;
    color: #6b7280;
    font-weight: 500;
}

.count {
    text-align: center !important;
    color: #6b7280;
}

.text-center {
    text-align: center !important;
}

/* Align specific columns */
.spending-table th:nth-child(1),
.spending-table td:nth-child(1) {
    text-align: left;
}

.spending-table th:nth-child(2),
.spending-table td:nth-child(2) {
    text-align: right;
}

.spending-table th:nth-child(3),
.spending-table td:nth-child(3) {
    text-align: right;
}

.spending-table th:nth-child(4),
.spending-table td:nth-child(4) {
    text-align: center;
}

/* Improved Date Range Controls */
.date-controls {
    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-controls h2 {
    font-size: 1.5rem;
    margin-top: 0;
    color: #1e293b;
    text-align: left;
    padding-bottom: 0;
    margin-bottom: 20px;
}

.date-controls h2::after {
    display: none;
}

/* Preset filter buttons */
.preset-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.preset-filters button {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #4b5563;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-filters button:hover {
    background-color: #e2e8f0;
}

.preset-filters button.active {
    background-color: #6366f1;
    border-color: #4f46e5;
    color: white;
}

/* Custom date range section */
.custom-date-range {
    margin-top: 16px;
    padding: 20px;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.date-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.input-group {
    flex: 1;
    min-width: 200px;
    max-width: calc(50% - 60px); /* Prevent inputs from being too wide */
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
}

.input-group input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1e293b;
    background-color: white;
    transition: border-color 0.2s ease;
    box-sizing: border-box; /* Ensure padding doesn't increase width */
}

.input-group input[type="date"]:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Button container to ensure proper alignment */
.button-container {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
}

/* Apply button */
.button {
    padding: 10px 16px;
    background-color: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    height: 40px;
}

.button:hover {
    background-color: #4f46e5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .graph-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .total-spending {
        align-self: flex-end;
    }

    .graph-container {
        height: 300px;
    }

    .spending-table th,
    .spending-table td {
        padding: 10px;
    }

    .date-inputs {
        flex-direction: column;
    }

    .input-group {
        width: 100%;
        max-width: 100%;
    }

    .button-container {
        width: 100%;
        margin-top: 8px;
    }

    .button {
        width: 100%;
    }
}