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

/* Theme vars */
:root {
    --bg-color: #f4f4f4;
    --text-color: #333;
    --header-color: #007bff;
    --table-bg: white;
    --table-th-bg: #007bff;
    --table-th-text: white;
    --table-row-hover: #f1f1f1;
    --form-bg: white;
    --button-bg: #007bff;
    --button-text: white;
    --button-hover-bg: #0056b3;
    --shadow: rgba(0,0,0,0.1);
    --error-color: red;
    --footer-color: #777;
    --link-color: #007bff;
    --link-hover: #0056b3;
    --expense-bg: lightcoral;
    --income-bg: lightgreen;
}

.dark-mode {
    --bg-color: #333;
    --text-color: #f4f4f4;
    --header-color: #4da6ff;
    --table-bg: #444;
    --table-th-bg: #0056b3;
    --table-th-text: #f4f4f4;
    --table-row-hover: #555;
    --form-bg: #444;
    --button-bg: #4da6ff;
    --button-text: #333;
    --button-hover-bg: #3385ff;
    --shadow: rgba(0,0,0,0.5);
    --error-color: #ff6666;
    --footer-color: #aaa;
    --link-color: #4da6ff;
    --link-hover: #3385ff;
    --expense-bg: darkred;
    --income-bg: darkgreen;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    max-width: none; /* Removed limit for full-width expansion */
    margin: auto;
    padding: 20px;
}

/* Header */
h1 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--header-color);
}

h2 {
    margin-top: 30px;
    color: var(--header-color);
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    margin-right: 10px;
}
a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Buttons */
button, .btn {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
}
button:hover, .btn:hover {
    background: var(--button-hover-bg);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}
.btn-secondary:hover {
    background: #5a6268;
}

/* Forms */
form {
    background: var(--form-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow);
    max-width: 500px;
    margin: auto;
}

label {
    display: block;
    margin-bottom: 5px;
}

input, textarea, select {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

textarea {
    height: 100px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: var(--table-bg);
    box-shadow: 0 2px 5px var(--shadow);
}

th, td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

th {
    background: var(--table-th-bg);
    color: var(--table-th-text);
}

tr:hover {
    background: var(--table-row-hover);
}

.income {
    background: var(--income-bg);
}

.expense {
    background: var(--expense-bg);
}

/* Error messages */
.error {
    color: var(--error-color);
    font-weight: bold;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 20px;
    color: var(--footer-color);
}

/* Hero section */
.hero {
    text-align: center;
    padding: 50px 20px;
    background: linear-gradient(to right, #007bff, #6610f2);
    color: white;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.hero h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: white;
}

.hero p {
    font-size: 1.2em;
    margin-bottom: 25px;
}

/* Features section */
.features {
    display: flex;
    justify-content: space-around;
    gap: 25px;
    margin: 40px auto;
    max-width: 1200px;
}

.feature-card {
    flex: 1;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.15);
    padding: 35px 30px !important;
    border-radius: 18px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.feature-card img {
    width: 160px !important;
    height: 160px !important;
    max-width: 160px !important;
    border-radius: 12px;
    margin: 0 auto 25px auto;
    display: block;
}

.feature-card h3 {
    color: white;
    font-size: 1.8em;
    margin: 20px 0 12px 0;
    font-weight: bold;
    white-space: nowrap;
}

.feature-card p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.05em;
    margin: 0;
    line-height: 1.6;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.25);
}

/* Dark mode adjustments */
.dark-mode .feature-card {
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode .feature-card:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Responsive - stack on mobile */
@media (max-width: 1000px) {
    .features {
        flex-direction: column;
        align-items: center;
        gap: 35px !important;
    }
    .feature-card {
        max-width: 320px !important;
    }
}
ol {
    list-style-type: decimal;
    padding-left: 20px;
    margin-top: 10px;
}
ol li {
    margin-bottom: 5px;
}
.alert {
    text-align: center;
    font-size: 1.2em;
    padding: 15px;
    margin: 20px auto;
    max-width: 600px;
    border-radius: 5px;
}
.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Responsive Tables */
.table-responsive {
    overflow-x: auto;  /* Enables horizontal scroll only on table if needed */
    width: 100%;
    margin-bottom: 15px;
}

@media (max-width: 992px) {  /* Changed from 768px - Adjust to 1200px if still triggers on desktop */
    table {
        border: 0;  /* Removes outer border for cleaner mobile look */
    }
    
    table thead {
        display: none;  /* Hides headers on mobile; we'll use data labels instead */
    }
    
    table tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #ddd;  /* Adds border per row for separation */
        padding: 10px;
        background: var(--table-bg);  /* Keeps theme consistent */
    }
    
    table td {
        display: block;
        text-align: right;  /* Aligns values right, labels left */
        font-size: 0.9em;
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;  /* Space for labels */
    }
    
    table td::before {
        content: attr(data-label);  /* Pulls label from HTML data-label */
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }
    
    table td:last-child {
        border-bottom: 0;  /* No border on last cell */
    }
    
    /* Debug: Add this temporarily to highlight on mobile */
    /* body::after { content: "Mobile Mode Active"; position: fixed; top: 10px; left: 10px; background: yellow; padding: 5px; z-index: 999; } */
}

/* Table column fixes - Easy to adjust widths here */
table th, table td {
    word-wrap: break-word;  /* Wraps long text (e.g., descriptions) */
    hyphens: auto;  /* Better wrapping with hyphens */
    padding: 8px;  /* Optional: Adds spacing for readability */
}

table th:nth-child(1), table td:nth-child(1) {  /* Select */
    min-width: 50px;
}

table th:nth-child(2), table td:nth-child(2) {  /* Date */
    min-width: 100px;
}

table th:nth-child(3), table td:nth-child(3) {  /* Description - Fallback if no class */
    min-width: 200px;  /* Narrower to balance; adjust up to 300px if needed */
}

table td.description {  /* Targets Description via class - More reliable */
    /*max-width: 250px; */ /* Caps max to prevent stretch; adjust for your data */
	max-width: 350px;  /* Bump up from 250px - adjust as needed */
    background: none !important;  /* Force-override any yellow debug */
}

table th:nth-child(4), table td:nth-child(4) {  /* Amount */
    min-width: 100px;
}

table th:nth-child(5), table td:nth-child(5) {  /* Type */
    min-width: 80px;
}

table th:nth-child(6), table td:nth-child(6) {  /* Category */
    min-width: 150px;
}

table th:nth-child(7), table td:nth-child(7) {  /* Actions */
    min-width: 100px;
}