/* ==========================================
   PERSONAL FINANCE MANAGEMENT SYSTEM
   Unified Neumorphism Design System
   ========================================== */

/* CSS Variables */
:root {
    --bg-color: #e0e5ec;
    --text-color: #2d3748;
    --text-light: #6b7280;
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --shadow-dark: rgba(163, 177, 198, 0.6);
    --shadow-light: rgba(255, 255, 255, 0.5);
    --income-color: #10b981;
    --expense-color: #ef4444;
    --warning-color: #f59e0b;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a202c;
        --text-color: #e2e8f0;
        --text-light: #a0aec0;
        --shadow-dark: rgba(0, 0, 0, 0.5);
        --shadow-light: rgba(255, 255, 255, 0.05);
    }
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll; /* Force scrollbar to prevent layout shift */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 30px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Emoji Support */
.navbar h1,
.card h2,
.nav-link,
.user-name,
.category-icon,
.transaction-icon,
button,
a {
    font-family: 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
}

/* Container */
.container {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    width: 100%;
}

/* Navbar Neumorphism */
.navbar {
    background: var(--bg-color);
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 20px;
    box-shadow: 
        8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.navbar h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.user-name {
    background: var(--bg-color);
    padding: 10px 20px;
    border-radius: 15px;
    font-weight: 600;
    color: var(--text-color);
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

.nav-link {
    background: var(--bg-color);
    padding: 10px 18px;
    border-radius: 15px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-link:hover {
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    transform: translateY(-2px);
}

.nav-link:active {
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
    transform: translateY(0);
}

/* Fix emoji visibility in nav links */
.nav-link::before {
    content: attr(data-emoji);
    margin-right: 4px;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
}

/* Emoji span styling */
.emoji {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
    font-style: normal;
    font-weight: normal;
    display: inline-block;
    line-height: 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: inherit !important;
    background-clip: unset !important;
    color: inherit !important;
}

.nav-link .emoji {
    font-size: 16px;
    margin-right: 4px;
}

/* Specific fixes for emoji in gradients */
h1 .emoji,
h2 .emoji,
h3 .emoji {
    -webkit-text-fill-color: currentColor !important;
    color: var(--text-color) !important;
}

/* Menu Mobile */
.menu-toggle {
    display: none;
    background: var(--bg-color);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999;
}

.overlay.active {
    display: block;
}

/* Card */
.card {
    background: var(--bg-color);
    border-radius: 25px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 
        10px 10px 20px var(--shadow-dark),
        -10px -10px 20px var(--shadow-light);
}

.card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header h2 {
    margin-bottom: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-color);
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    box-shadow: 
        10px 10px 20px var(--shadow-dark),
        -10px -10px 20px var(--shadow-light);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.stat-card .amount {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.income {
    color: var(--income-color);
}

.expense {
    color: var(--expense-color);
}

.balance {
    color: var(--primary-color);
}

.stat-card small {
    color: var(--text-light);
    font-size: 13px;
}

/* Form Elements */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 15px;
}

input, select, textarea {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 15px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-color);
    box-shadow: 
        inset 6px 6px 10px var(--shadow-dark),
        inset -6px -6px 10px var(--shadow-light);
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 12px 24px;
    border-radius: 15px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #f97316);
}

.btn-danger {
    background: linear-gradient(135deg, var(--expense-color), #dc2626);
}

/* Filter Form */
.filter-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-form select {
    background: var(--bg-color);
    padding: 12px 18px;
    border: none;
    border-radius: 15px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

/* Transaction List */
.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.transaction-item {
    background: var(--bg-color);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: transform 0.3s;
}

.transaction-item:hover {
    transform: translateX(5px);
}

.transaction-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.transaction-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

.transaction-details h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

.transaction-details p {
    font-size: 13px;
    color: var(--text-light);
}

.transaction-amount {
    font-size: 18px;
    font-weight: 700;
    text-align: right;
}

/* Table */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

thead th {
    background: var(--bg-color);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 15px;
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

tbody tr {
    background: var(--bg-color);
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: transform 0.3s;
}

tbody tr:hover {
    transform: translateX(5px);
}

tbody td {
    padding: 15px;
    border: none;
}

tbody tr td:first-child {
    border-radius: 15px 0 0 15px;
}

tbody tr td:last-child {
    border-radius: 0 15px 15px 0;
}

.amount-income {
    color: var(--income-color);
    font-weight: 600;
}

.amount-expense {
    color: var(--expense-color);
    font-weight: 600;
}

/* Badge */
.badge {
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-income {
    background: var(--bg-color);
    color: var(--income-color);
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
}

.badge-expense {
    background: var(--bg-color);
    color: var(--expense-color);
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 500;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
}

.alert-error {
    background: var(--bg-color);
    color: var(--expense-color);
    box-shadow: 
        inset 4px 4px 8px rgba(239, 68, 68, 0.1),
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
}

.alert-success {
    background: var(--bg-color);
    color: var(--income-color);
    box-shadow: 
        inset 4px 4px 8px rgba(16, 185, 129, 0.1),
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.category-item {
    background: var(--bg-color);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: transform 0.3s;
}

.category-item:hover {
    transform: translateY(-5px);
}

.category-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    font-size: 28px;
}

.category-name {
    font-weight: 600;
    color: var(--text-color);
}

/* Type Selector */
.type-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.type-option {
    flex: 1;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-color);
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: all 0.3s ease;
}

.type-option input {
    display: none;
}

.type-option:hover {
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.type-option.selected {
    box-shadow: 
        inset 6px 6px 12px var(--shadow-dark),
        inset -6px -6px 12px var(--shadow-light);
}

.type-option.income.selected {
    color: var(--income-color);
}

.type-option.expense.selected {
    color: var(--expense-color);
}

.type-option label {
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
}

.type-option.selected label {
    font-weight: 700;
}

/* Reports */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--bg-color);
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    box-shadow: 
        10px 10px 20px var(--shadow-dark),
        -10px -10px 20px var(--shadow-light);
    transition: transform 0.3s;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card .icon {
    font-size: 42px;
    margin-bottom: 15px;
}

.summary-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 12px;
}

.summary-card .amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
}

.chart-container {
    padding: 20px 0;
}

.category-bar {
    margin-bottom: 20px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.category-name {
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-amount {
    font-weight: 600;
    color: var(--text-light);
    font-size: 14px;
}

.progress-bar {
    height: 35px;
    background: var(--bg-color);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

.progress-fill {
    height: 100%;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    transition: width 0.6s ease;
}

.progress-fill.income {
    background: linear-gradient(135deg, var(--income-color), #34d399);
}

.progress-fill.expense {
    background: linear-gradient(135deg, var(--expense-color), #f87171);
}

/* Auth Pages (Login/Register) */
.auth-container {
    background: var(--bg-color);
    border-radius: 40px;
    padding: 50px 45px;
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
    box-shadow: 
        20px 20px 60px var(--shadow-dark),
        -20px -20px 60px var(--shadow-light);
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    background: var(--bg-color);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    box-shadow: 
        8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    color: var(--primary-color);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo p {
    color: var(--text-light);
    font-size: 15px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
}

.auth-container input {
    padding-left: 55px;
}

.auth-link {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--shadow-dark);
    color: var(--text-light);
    font-size: 14px;
}

.auth-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.auth-link a:hover {
    color: var(--secondary-color);
}

/* Utility Classes */
.no-data {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}

.back-link {
    display: inline-block;
    margin-bottom: 25px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 12px 25px;
    border-radius: 12px;
    background: var(--bg-color);
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: all 0.3s ease;
}

.back-link:hover {
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    transform: translateY(-2px);
}

/* Emoji Picker */
.emoji-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 15px;
    margin-top: 15px;
    box-shadow: 
        inset 6px 6px 12px var(--shadow-dark),
        inset -6px -6px 12px var(--shadow-light);
    max-height: 300px;
    overflow-y: auto;
}

.emoji-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s;
    background: var(--bg-color);
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.emoji-option:hover {
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

.emoji-picker-toggle {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--bg-color);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    transition: all 0.3s;
}

.emoji-picker-toggle:hover {
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

/* Add Form (for categories) */
.add-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

/* Info Box */
.info-box {
    background: var(--bg-color);
    border-left: 5px solid var(--primary-color);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
}

.info-box h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.info-box ul {
    margin-left: 20px;
    color: var(--text-color);
}

.info-box li {
    margin-bottom: 8px;
}

/* Security Tips */
.security-tips {
    display: grid;
    gap: 20px;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    border-radius: 15px;
    background: var(--bg-color);
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: all 0.3s ease;
}

.tip-item:hover {
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.tip-icon {
    font-size: 28px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-color);
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
    flex-shrink: 0;
}

.tip-content h4 {
    color: var(--text-color);
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.tip-content p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    .navbar h1 {
        font-size: 18px;
    }

    .menu-toggle {
        display: flex;
    }

    .user-info {
        position: fixed;
        top: 90px;
        left: -100%;
        width: 280px;
        background: var(--bg-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 25px;
        border-radius: 0 25px 25px 0;
        box-shadow: 
            10px 10px 20px var(--shadow-dark),
            -5px -5px 10px var(--shadow-light);
        transition: left 0.4s ease;
        z-index: 1000;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
    }

    .user-info.active {
        left: 0;
    }

    .user-name,
    .nav-link {
        width: 100%;
        justify-content: flex-start;
    }

    .card {
        padding: 20px;
    }

    .card h2 {
        font-size: 20px;
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-card {
        padding: 25px 20px;
    }

    .stat-card .amount {
        font-size: 28px;
    }

    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .transaction-amount {
        align-self: flex-end;
    }

    .type-selector {
        flex-direction: column;
        gap: 15px;
    }

    .type-option {
        padding: 15px;
        font-size: 14px;
    }

    .btn {
        padding: 14px 20px;
        font-size: 14px;
        width: 100%;
    }

    .btn-sm {
        width: auto;
    }

    .filter-form {
        flex-direction: column;
    }

    .filter-form select {
        width: 100%;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .add-form {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 14px;
    }

    thead {
        display: none;
    }

    tbody tr {
        display: block;
        margin-bottom: 15px;
        border-radius: 15px;
        padding: 15px;
    }

    tbody td {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid var(--shadow-dark);
    }

    tbody td:last-child {
        border-bottom: none;
    }

    tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-light);
        text-transform: uppercase;
        font-size: 12px;
    }

    tbody tr td:first-child,
    tbody tr td:last-child {
        border-radius: 0;
    }

    .emoji-picker {
        grid-template-columns: repeat(6, 1fr);
    }

    .auth-container {
        padding: 40px 30px;
    }

    .logo-icon {
        width: 75px;
        height: 75px;
        font-size: 36px;
    }

    .logo h1 {
        font-size: 28px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .tip-item {
        padding: 15px;
    }

    .tip-icon {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }

    .tip-content h4 {
        font-size: 15px;
    }

    .tip-content p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 15px;
    }

    .card {
        padding: 15px;
        border-radius: 20px;
    }

    .stat-card {
        padding: 20px 15px;
    }

    .stats-grid,
    .summary-grid {
        gap: 15px;
    }

    .emoji-picker {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }

    .emoji-option {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .menu-toggle,
    .overlay,
    .btn,
    .back-link,
    .filter-form {
        display: none !important;
    }

    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--shadow-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}