/* Main style sheet for the application */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --transition: all 0.3s ease;
}

/* Dark mode variables */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #60a5fa;
    
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Dark mode adjustments for specific elements */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .budget-progress-container,
[data-theme="dark"] .info-box,
[data-theme="dark"] .search-container,
[data-theme="dark"] .table-container,
[data-theme="dark"] .record-card,
[data-theme="dark"] .empty-state,
[data-theme="dark"] .form-container,
[data-theme="dark"] .settings-section,
[data-theme="dark"] .about-section {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .info-box {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #334155;
}

[data-theme="dark"] #recordsTable thead {
    background: #0f172a;
}

[data-theme="dark"] #recordsTable tbody tr:hover {
    background: #334155;
}

[data-theme="dark"] .category-badge {
    background: #1e40af;
    color: #dbeafe;
}

[data-theme="dark"] .input-field,
[data-theme="dark"] .input-field-small {
    background: #0f172a;
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .input-field:focus {
    border-color: var(--primary);
    background: #1e293b;
}

[data-theme="dark"] .checkbox-label {
    background: #0f172a;
    color: var(--text-primary);
}

[data-theme="dark"] .checkbox-label:hover {
    background: #1e293b;
}

[data-theme="dark"] .currency-rates,
[data-theme="dark"] .conversion-display {
    background: #0f172a;
}

[data-theme="dark"] .regex-pattern {
    background: #0f172a;
}

[data-theme="dark"] mark {
    background-color: #fbbf24;
    color: #000;
}

[data-theme="dark"] .help-text code {
    background: #0f172a;
    color: var(--info);
}

/* Theme toggle button styles */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* Hide icons based on theme */
[data-theme="light"] .theme-toggle .moon-icon {
    display: inline;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: inline;
}

/* Smooth transition for theme changes */
body,
.stat-card,
.budget-progress-container,
.info-box,
.search-container,
.table-container,
.record-card,
.form-container,
.settings-section,
.about-section,
.input-field,
.checkbox-label {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-gradient);
    min-height: 100vh;
}

/* ACCESSIBILITY */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) 0;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

*:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* HEADER AND NAVIGATION */
header {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hamburger {
    display: block;
    width: 1.5rem;
    height: 0.125rem;
    background: currentColor;
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 0.125rem;
    background: currentColor;
    left: 0;
    transition: var(--transition);
}

.hamburger::before {
    top: -0.5rem;
}

.hamburger::after {
    bottom: -0.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-link.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

.reminder-icon {
    width: 20px;
    height: 20px; 
    object-fit: contain; 
    vertical-align: middle; 
    margin-right: 5px; 
}

/* STATUS MESSAGE */
.status-message {
    max-width: 1280px;
    margin: 1rem auto;
    padding: 1rem 1.5rem;
    background: #dbeafe;
    border-left: 4px solid var(--info);
    color: #1e40af;
    border-radius: var(--radius-md);
    animation: slideDown 0.3s ease-out;
}

.status-message.success {
    background: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

.status-message.error {
    background: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

.hidden {
    display: none !important;
}

/* MAIN CONTENT */

main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.page.active {
    display: block;
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* DASHBORD STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--secondary);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.stat-blue {
    border-color: var(--info);
}

.stat-card.stat-green {
    border-color: var(--success);
}

.stat-card.stat-purple {
    border-color: #7c3aed;
}

.stat-card.over-budget {
    border-color: var(--danger);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--text-primary);
}

.stat-value-small {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--text-primary);
}

.stat-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-value.text-danger {
    color: var(--danger);
}

.stat-value.text-success {
    color: var(--success);
}

/* BUDGET PROGRESS */
.budget-progress-container {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.budget-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 100%;
    height: 1rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--success);
    transition: width 0.5s ease, background-color 0.3s ease;
    border-radius: 9999px;
}

.progress-bar.over-budget {
    background: var(--danger);
}

.progress-percentage {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* INFO BOX  */
.info-box {
    background: linear-gradient(135deg, #eff6ff 0%, #f3e8ff 100%);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 2px solid #bfdbfe;
}

.info-box h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--info);
}

.info-box p {
    color: var(--text-primary);
    line-height: 1.6;
}

/* PAGE HEADER */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: #d1d5db;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* SEARCH CONTAINER */
.search-container {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.search-input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.checkbox-label:hover {
    background: #e5e7eb;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* TABLE STYLES */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

#recordsTable {
    width: 100%;
    border-collapse: collapse;
}

#recordsTable thead {
    background: #f9fafb;
    border-bottom: 2px solid var(--border-color);
}

#recordsTable th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

#recordsTable td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

#recordsTable tbody tr {
    transition: var(--transition);
}

#recordsTable tbody tr:hover {
    background: #f9fafb;
}

.sort-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.sort-btn:hover {
    color: var(--primary);
}

.sort-icon {
    font-size: 0.75rem;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.icon-btn:hover {
    background: #f3f4f6;
}

.icon-btn.edit:hover {
    color: var(--info);
    background: #dbeafe;
}

.icon-btn.delete:hover {
    color: var(--danger);
    background: #fee2e2;
}

/* MOBILE CARDS VIEW */
.cards-container {
    display: grid;
    gap: 1rem;
}

.record-card {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.record-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.record-card-title {
    flex: 1;
}

.record-card-description {
    font-weight: 600;
    color: var(--text-primary);
}

.record-card-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.record-card-amount {
    text-align: right;
}

.record-card-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.record-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.card-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}

.card-btn.edit {
    color: var(--info);
}

.card-btn.edit:hover {
    background: #dbeafe;
}

.card-btn.delete {
    color: var(--danger);
}

.card-btn.delete:hover {
    background: #fee2e2;
}

/* EMPTY STATES */
.empty-state {
    background: white;
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.empty-state svg {
    color: #9ca3af;
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--text-secondary);
}

/* FORM STYLES */
.form-container {
    max-width: 800px;
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.required {
    color: var(--danger);
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-field.error {
    border-color: var(--danger);
}

.input-field-small {
    width: 150px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.error-message {
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.help-text code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions .btn {
    flex: 1;
}

.expense-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    font-size: 0.875rem;
}

/* SETTINGS PAGE */
.settings-container {
    max-width: 800px;
}

.settings-section {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.currency-rates {
    background: #f9fafb;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.currency-rates h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.currency-rates .form-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.currency-rates label {
    font-weight: 500;
}

.conversion-display {
    background: #eff6ff;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.conversion-display h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.conversion-display p {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* ABOUT PAGE */
.about-container {
    max-width: 900px;
}

.about-section {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.about-section ul {
    list-style-position: inside;
    color: var(--text-primary);
}

.about-section li {
    margin-bottom: 0.5rem;
}

.about-section a {
    color: var(--primary);
    text-decoration: none;
}

.about-section a:hover {
    text-decoration: underline;
}

.regex-pattern {
    background: #f9fafb;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.regex-pattern code {
    color: var(--info);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
}

.regex-pattern p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
}

.shortcuts-table tr {
    border-bottom: 1px solid var(--border-color);
}

.shortcuts-table td {
    padding: 0.75rem 0;
}

.shortcuts-table td:first-child {
    width: 200px;
}

/* FOOTER */
footer {
    background: #1f2937;
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    margin-top: 3rem;
}

.footer-subtitle {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

/* ANIMATIONS */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* HIGHLIGHT FOR regex search */
mark {
    background-color: #fef08a;
    padding: 0 0.25rem;
    border-radius: 0.125rem;
}

/* RESPONSIVE STYLES */
/* Tablet (768px and up) */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
    
    .desktop-only {
        display: block !important;
    }
}

/* Mobile only */
@media (max-width: 767px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        display: none;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-link {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .button-group {
        width: 100%;
    }
    
    .button-group .btn {
        flex: 1;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-input-group .input-field {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .expense-grid {
        grid-template-columns: 1fr;
    }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.profile-image {
    width: 120px;      
    height: 120px;
    object-fit: cover;  
    border-radius: 50%; 
    border: 3px solid #007bff; 
    margin-bottom: 15px; 
}
/* Styling for the logo image */
.logo-image {
    width: 32px;
    height: 32px;
    object-fit: contain; 
    vertical-align: middle; 
    margin-right: 8px; 
}

.logo {
    display: flex; 
    align-items: center; 
}