/* styles/style.css */

/* 1. Global Setup and Colors (White, Blue, Red) */
:root {
    --color-primary: #0033A0; /* ALU Blue */
    --color-accent: #E03C31;  /* ALU Red */
    --color-white: #FFFFFF;
    --color-dark: #333333;
    --color-light-bg: #F4F4F9; 
    --color-success: #28a745; /* Green for success */
    --color-warning: #ffc107; /* Yellow for mark highlighting */
}

/* Base Reset and Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--color-dark);
    background-color: var(--color-light-bg);
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

/* 2. Accessibility (A11y) */
.skip-link {
    position: absolute;
    top: -9999px; 
    left: 0;
    background-color: var(--color-accent);
    color: var(--color-white);
    padding: 8px;
    z-index: 1000;
}
.skip-link:focus {
    top: 0;
    /* OVERRIDE default focus */
    outline: none; 
    box-shadow: 0 0 0 3px var(--color-primary); 
}

/* REQUIRED: Visible Focus Style */
*:focus {
    outline: 3px solid var(--color-accent); /* ALU Red focus ring */
    outline-offset: 2px;
}

/* REQUIRED: Regex Search Highlight */
mark {
    background-color: var(--color-warning); /* Yellow highlight */
    color: var(--color-dark);
    padding: 2px 0;
    /* Minimal animation on load */
    transition: background-color 0.3s ease;
}

/* 3. Header and Navigation */
.main-header {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 10px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo img {
    height: 40px; 
    transition: transform 0.3s ease;
}
.logo img:hover {
    transform: scale(1.05);
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}
.nav-link {
    color: var(--color-white);
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}
.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--color-white);
}

/* 4. Buttons and Forms */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.1s ease;
}
.btn-primary {
    background-color: var(--color-accent); /* Red */
    color: var(--color-white);
}
.btn-primary:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
}
.btn-secondary {
    background-color: #ccc;
    color: var(--color-dark);
}
.btn-secondary:hover {
    background-color: #bbb;
}
.btn-danger {
    background-color: var(--color-accent);
    color: var(--color-white);
}
.btn-danger:hover {
    background-color: #a02d23;
}
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    color: var(--color-primary);
}
.btn-icon:hover {
    color: var(--color-accent);
}

.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.error-message {
    color: var(--color-accent);
    font-size: 0.9em;
    display: block;
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* 5. Dashboard and Stats */
main {
    padding: 30px 0;
}
.content-section h2 {
    color: var(--color-primary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--color-light-bg);
    padding-bottom: 5px;
}

/* Mobile-First Grid (Default: Single Column) */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--color-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05); 
    transition: all 0.3s ease; /* Animation/Transition requirement */
}
.stat-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); 
    transform: translateY(-2px);
}
.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}
.stat-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--color-primary); 
}
.stat-card.bg-red .stat-value {
    color: var(--color-accent);
}
.stat-card.bg-green .stat-value {
    color: var(--color-success);
}

/* 6. Table Styles */
.controls-section {
    display: flex;
    flex-direction: column; 
    gap: 15px;
    margin-bottom: 20px;
}
.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
.table-wrapper {
    overflow-x: auto; 
    width: 100%;
    margin-top: 10px;
}
#records-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
#records-table th, #records-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
#records-table th {
    background-color: var(--color-light-bg);
    color: var(--color-dark);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
}
#records-table tbody tr:last-child td {
    border-bottom: none;
}
#records-table td:nth-child(4) { /* Amount column */
    font-weight: bold;
}


/* 7. Settings Page Styles */
.settings-group {
    background-color: var(--color-white);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.settings-group h3 {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: var(--color-primary);
}
.budget-status {
    font-weight: bold;
    color: var(--color-success);
    margin-bottom: 10px;
}
.data-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}
.import-label {
    display: inline-block;
    cursor: pointer;
    width: 100%;
}
#settings-status {
    margin-top: 15px;
    font-weight: bold;
}

/* 8. Footer */
footer {
    background-color: var(--color-dark);
    color: #bbb;
    padding: 15px 0;
    text-align: center;
    font-size: 0.9rem;
}

/* 9. Utility Classes (ARIA Live Status) */
.status-message {
    padding: 10px;
    margin-top: 15px;
    border-radius: 5px;
    font-weight: bold;
}
.status-message.success {
    background-color: #d4edda;
    color: var(--color-success);
    border: 1px solid #c3e6cb;
}
.status-message.error {
    background-color: #f8d7da;
    color: var(--color-accent);
    border: 1px solid #f5c6cb;
}
.status-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* --- RESPONSIVE DESIGN (Media Queries) --- */

/* Tablet View (768px and up) */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr); /* Two columns on tablet */
    }
    .controls-section {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .data-actions {
        flex-direction: row;
        gap: 15px;
    }
    .import-label {
        width: auto;
    }
}

/* Desktop View (1024px and up) */
@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr); /* Four columns on desktop */
    }
    .header-actions {
        display: flex;
        gap: 15px;
    }
}

/* Mobile Table Card View (767px and down) */
@media (max-width: 767px) {
    /* Table to Card Conversion */
    #records-table {
        border: none;
        box-shadow: none;
    }
    #records-table, #records-tbody, #records-table tr, #records-table th, #records-table td {
        display: block;
        width: 100%;
    }
    #records-table thead {
        display: none; /* Hide header row */
    }
    #records-table tr {
        margin-bottom: 15px;
        border: 1px solid #ccc;
        border-radius: 8px;
        padding: 10px;
        display: flex;
        flex-direction: column;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    #records-table td {
        text-align: right;
        padding: 8px 10px;
        padding-left: 50%; /* Space for label */
        position: relative;
        border: none;
        font-size: 0.95rem;
    }
    /* REQUIRED: Use data-label for a11y on mobile tables */
    #records-table td::before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 10px;
        width: calc(50% - 20px);
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--color-primary);
    }
    .stat-card:hover {
        transform: none; /* Disable hover animation on tiny screens */
    }
        /* About Page Contact Form */
    .contact-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    .contact-form textarea,
    #send-email-link {
        grid-column: 1 / -1;
    }
}
