/* Container for the records section */
.records-section {
    width: 100%;
}

/* Message for when there are no records */
.no-records-message {
    text-align: center;
    padding: 3rem;
    background-color: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 0.75rem;
    color: #64748b;
}

/* -- DESKTOP TABLE STYLES -- */
.records-table {
    width: 100%;
    border-collapse: collapse;
    display: none; /* Hidden by default, shown on larger screens */
}

.records-table thead {
    background-color: #f1f5f9;
}

.records-table th, .records-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.records-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.records-table tbody tr:hover {
    background-color: #f8fafc;
}

.record-description {
    font-weight: 500;
    color: #1e293b;
}

.record-category {
    background-color: #e2e8f0;
    color: #475569;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px; /* Pill shape */
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.record-amount.income {
    color: #16a34a; /* Green */
    font-weight: 600;
}

.record-amount.expense {
    color: #dc2626; /* Red */
    font-weight: 600;
}

.record-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.record-actions button:hover {
    background-color: #e2e8f0;
}

.record-actions svg {
    width: 16px;
    height: 16px;
    color: #64748b;
}

/* -- MOBILE CARD STYLES -- */
.records-cards {
    display: grid;
    gap: 1rem;
}

.record-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.5rem 1rem;
    align-items: center;
}

.record-card .record-description {
    grid-column: 1 / 2;
    font-size: 1rem;
}

.record-card .record-amount {
    grid-column: 2 / 3;
    grid-row: 1 / 3; /* Span both rows */
    font-size: 1.25rem;
    text-align: right;
}

.record-card-details {
    grid-column: 1 / 2;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #64748b;
}

.record-card-actions {
    grid-column: 1 / 3; /* Span full width */
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* -- RESPONSIVE LOGIC -- */
@media (min-width: 768px) {
    .records-table {
        display: table; /* Show table on screens 768px and wider */
    }

    .records-cards {
        display: none; /* Hide cards on screens 768px and wider */
    }
}

/* For the search options */
/* This makes the header cell itself the container for our button */
.records-table th {
    padding: 0; 
}

/* This styles the button to be clean and fill the header cell */
.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    padding: 1rem; 
    text-align: left;
    transition: background-color 0.2s;
}

.sort-btn:hover {
    background-color: #f8fafc;
}

/* This styles the little arrow icon */
.sort-btn svg {
    width: 16px;
    height: 16px;
    opacity: 0.5;
    transition: transform 0.2s, opacity 0.2s;
}

/* This makes the currently active sort button darker */
.sort-btn.active {
    color: #0f172a;
}

.sort-btn.active svg {
    opacity: 1;
}

/* This is the magic rule that flips the arrow when sorting A-Z */
.sort-btn[data-order="asc"] svg {
    transform: rotate(180deg);
}




.search-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap; /* Allows controls to wrap on small screens */
}

.search-controls .form-input {
    flex-grow: 1; /* Make the input take up available space */
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.search-error {
    color: #dc2626; /* Red */
    font-size: 0.875rem;
    margin-bottom: 1rem;
    min-height: 1.25em; /* Prevent layout shift when error message appears/disappears */
}

/* This is the style for the yellow highlight on matched text */
mark {
    background-color: #fef08a; /* A nice yellow highlight color */
    color: #713f12; /* A dark brown text color for contrast */
    padding: 0.1em;
    border-radius: 3px;
}