/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1f2937;
    line-height: 1.5;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #f9fafb;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* ===== Header ===== */
.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header h1 {
    font-size: 2.4rem;
    color: #1f2937;
    margin-bottom: 6px;
}

.subtitle {
    color: #6b7280;
    font-size: 1rem;
}

/* ===== Summary Cards ===== */
.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #e5e7eb;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card h3 {
    font-size: 0.85rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.card p {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1f2937;
}

.balance-card {
    border-left-color: #4f46e5;
    background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
}

.income-card {
    border-left-color: #10b981;
}

.expense-card {
    border-left-color: #ef4444;
}

#balance {
    color: #4f46e5;
}

#total-income {
    color: #10b981;
}

#total-expense {
    color: #ef4444;
}

/* ===== Form ===== */
.form-section {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 28px;
}

.form-section h2,
.filters h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: #1f2937;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.form-row:last-child {
    grid-template-columns: 1fr auto;
}

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

.form-group label {
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    color: #1f2937;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-add {
    align-self: end;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

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

/* ===== Filters ===== */
.filters {
    margin-bottom: 16px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #6b7280;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: #4f46e5;
    color: #4f46e5;
}

.filter-btn.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

/* ===== Transaction List ===== */
.transaction-list ul {
    list-style: none;
}

.transaction-item {
    background: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    border-left: 4px solid #e5e7eb;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    animation: slideIn 0.3s ease;
}

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

.transaction-item:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.transaction-item.income {
    border-left-color: #10b981;
}

.transaction-item.expense {
    border-left-color: #ef4444;
}

.txn-info {
    flex: 1;
}

.txn-description {
    font-weight: 600;
    color: #1f2937;
    font-size: 1rem;
    margin-bottom: 4px;
}

.txn-meta {
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.txn-category {
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.txn-amount {
    font-size: 1.15rem;
    font-weight: 700;
    margin-right: 16px;
    white-space: nowrap;
}

.txn-amount.income {
    color: #10b981;
}

.txn-amount.expense {
    color: #ef4444;
}

.delete-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.empty-msg {
    text-align: center;
    color: #9ca3af;
    padding: 40px 20px;
    font-style: italic;
    display: none;
}

.empty-msg.show {
    display: block;
}

/* ===== Footer ===== */
.app-footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.btn-clear {
    background: transparent;
    color: #9ca3af;
    border: 1.5px solid #e5e7eb;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .container {
        padding: 24px 18px;
    }

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

    .form-row,
    .form-row:last-child {
        grid-template-columns: 1fr;
    }

    .app-header h1 {
        font-size: 1.8rem;
    }
}
