/* Personal Expense Tracker - Minimal & Catchy Design */

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

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f5f7fa;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --white: #ffffff;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============ HEADER ============ */

header {
    background: linear-gradient(135deg, var(--primary) 0%, #4c51bf 100%);
    color: var(--white);
    padding: 35px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.header-text h1 {
    font-size: 2.5em;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: -0.8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-header {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.icon-sm {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

.subtitle {
    font-size: 1em;
    opacity: 0.9;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.currency-selector {
    display: flex;
    align-items: center;
}

.currency-dropdown {
    padding: 10px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 200px;
}

.currency-dropdown:hover {
    background: rgba(255, 255, 255, 0.2);
}

.currency-dropdown:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.currency-dropdown option {
    background: var(--primary);
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

.stat-label {
    font-size: 0.8em;
    opacity: 0.85;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* ============ MAIN CONTENT ============ */

main {
    padding: 35px 30px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 25px;
    flex: 1;
}

@media (max-width: 1200px) {
    main {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ============ BUDGET SECTION ============ */

.budget-section {
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.budget-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.budget-header h2 {
    font-size: 1.35em;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.btn-edit-budget {
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit-budget:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.budget-display {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.budget-amount {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.budget-amount .label {
    font-size: 0.75em;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.budget-amount .value {
    font-size: 1.4em;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.budget-amount .value.spent {
    color: var(--warning);
}

.budget-amount .value.remaining {
    color: var(--success);
}

.budget-divider {
    width: 1px;
    height: 55px;
    background: var(--border);
}

.budget-progress-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.budget-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.budget-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    width: 0%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.budget-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.budget-percentage {
    color: var(--primary);
}

.budget-status {
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    font-size: 0.8em;
}

.budget-status.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.budget-status.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.budget-breakdown {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--white);
    border-radius: 10px;
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breakdown-item .label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-light);
}

.month-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85em;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.month-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* ============ FORM SECTION ============ */

.add-expense {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.add-expense h2 {
    font-size: 1.35em;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95em;
    background: var(--white);
    color: var(--text);
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input::placeholder {
    color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.btn-add {
    padding: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #4c51bf 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.btn-add:active {
    transform: translateY(0);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-secondary {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

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

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

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

/* ============ EXPENSES LIST ============ */

.expenses-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.expenses-list h2 {
    font-size: 1.35em;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    width: 100%;
}

.filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9em;
    background: var(--white);
    transition: all 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.expenses-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 650px;
    overflow-y: auto;
    padding-right: 4px;
}

.empty-state {
    color: var(--text-light);
    text-align: center;
    padding: 60px 20px;
    font-style: italic;
    font-size: 0.95em;
}

/* ============ EXPENSE ITEMS ============ */

.expense-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--white);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

.expense-icon {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--primary);
    min-width: 24px;
    text-align: center;
    opacity: 0.8;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.expense-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateX(3px);
    border-left-color: var(--accent);
}

.expense-info {
    flex: 1;
}

.expense-description {
    font-weight: 600;
    color: var(--text);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.95em;
}

.expense-description span:first-child {
    font-size: 1.3em;
    flex-shrink: 0;
}

.expense-meta {
    font-size: 0.75em;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 500;
}

.expense-amount {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
    white-space: nowrap;
    min-width: 80px;
}

.btn-delete {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75em;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-delete:hover {
    background: #dc2626;
    transform: scale(1.08);
}

/* ============ SCROLLBAR ============ */

.expenses-container::-webkit-scrollbar {
    width: 6px;
}

.expenses-container::-webkit-scrollbar-track {
    background: transparent;
}

.expenses-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.expenses-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ============ MODAL ============ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    border-radius: 14px;
    padding: 28px;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideInDown 0.3s ease;
}

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

#modalTitle {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

#modalMessage {
    color: var(--text-light);
    margin-bottom: 22px;
    line-height: 1.5;
    font-size: 0.9em;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

#modalCancel {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

#modalCancel:hover {
    background: var(--white);
    border-color: var(--text-light);
}

#modalConfirm {
    background: var(--primary);
    color: white;
}

#modalConfirm:hover {
    background: var(--primary-dark);
}

/* Budget Modal */
.budget-modal {
    max-width: 360px;
}

.budget-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.currency-symbol {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--primary);
    min-width: 20px;
}

#budgetInput {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    background: var(--bg);
    transition: all 0.3s ease;
}

#budgetInput:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* ============ FOOTER ============ */

footer {
    background: var(--bg);
    padding: 18px 30px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.8em;
    border-top: 1px solid var(--border);
    font-weight: 500;
}

/* ============ RESPONSIVE DESIGN ============ */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 24px 20px;
    }

    .header-content {
        flex-direction: column;
        margin-bottom: 24px;
    }

    .header-text h1 {
        font-size: 2em;
    }

    .currency-dropdown {
        width: 100%;
        min-width: unset;
    }

    main {
        padding: 20px;
        gap: 20px;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.5em;
    }

    .budget-display {
        grid-template-columns: 1fr auto 1fr;
    }

    .budget-divider:last-child {
        display: none;
    }

    .expense-item {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
        padding: 12px;
    }

    .expense-icon {
        font-size: 1.1em;
    }

    .btn-delete {
        padding: 6px 10px;
        font-size: 0.7em;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header {
        padding: 18px 16px;
    }

    .header-text h1 {
        font-size: 1.6em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    main {
        padding: 16px;
        gap: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.4em;
    }

    .budget-amount .value {
        font-size: 1.2em;
    }

    .expense-item {
        grid-template-columns: auto 1fr;
        gap: 8px;
    }

    .expense-icon {
        grid-column: 1;
    }

    .expense-description {
        grid-column: 2;
    }

    .expense-amount {
        grid-column: 2;
        text-align: left;
        min-width: unset;
    }

    .btn-delete {
        grid-column: 2;
    }

    .modal-content {
        max-width: 90%;
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
    }

    header,
    footer,
    .actions,
    .currency-selector,
    .btn-delete,
    .filter-group {
        display: none;
    }

    .expenses-container {
        max-height: unset;
        overflow: visible;
    }

    .expense-item {
        page-break-inside: avoid;
    }
}
