:root {
    --primary: #06b6d4;
    --secondary: #10b981;
    --accent: #f59e0b;
    --income: #10b981;
    --expense: #ef4444;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #d1fae5 100%);
    min-height: 100vh;
    color: var(--text);
}

.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--background);
    position: relative;
}

.hidden {
    display: none !important;
}

.auth-card {
    background: var(--card-bg);
    padding: 40px 30px;
    margin: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.5s ease;
}

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

.app-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-toggle {
    display: flex;
    margin-bottom: 30px;
    background: var(--background);
    border-radius: 10px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: var(--text-light);
}

.auth-tab.active {
    background: var(--card-bg);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

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

.btn-secondary {
    padding: 12px 24px;
    background: var(--background);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.error-message {
    color: var(--expense);
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    min-height: 20px;
}

.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 20px;
    padding-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
}

.summary-card,
.chart-card,
.saving-progress-card,
.settings-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.5s ease;
}

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

.summary-card h3,
.chart-card h3,
.saving-progress-card h3 {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.summary-stats {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 16px 8px;
    background: var(--background);
    border-radius: 12px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

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

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

.stat-value.balance {
    color: var(--primary);
}

.empty-text {
    text-align: center;
    color: var(--text-light);
    padding: 40px;
}

.records-list,
.plans-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-item,
.plan-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.4s ease;
}

.record-item:hover,
.plan-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.record-info,
.plan-info {
    flex: 1;
}

.record-category,
.plan-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.record-description,
.plan-date {
    font-size: 13px;
    color: var(--text-light);
}

.record-amount.income {
    color: var(--income);
    font-weight: 700;
    font-size: 18px;
}

.record-amount.expense {
    color: var(--expense);
    font-weight: 700;
    font-size: 18px;
}

.plan-amount {
    text-align: right;
}

.plan-current {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
}

.plan-target {
    font-size: 13px;
    color: var(--text-light);
}

.progress-bar-container {
    margin-top: 12px;
}

.progress-bar {
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.8s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
    text-align: right;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 20px 20px 0 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    color: var(--text-light);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(6, 182, 212, 0.1);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
    border-radius: 24px 24px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUpModal 0.3s ease;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--background);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: var(--border);
}

.modal-body {
    padding: 20px;
}

.type-toggle {
    display: flex;
    margin-bottom: 20px;
    background: var(--background);
    border-radius: 12px;
    padding: 4px;
}

.type-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.type-btn.active.income-type {
    background: var(--income);
    color: white;
}

.type-btn.active.expense-type {
    background: var(--expense);
    color: white;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-item:hover {
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.05);
}

.category-item.selected {
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.1);
}

.category-icon {
    font-size: 28px;
}

.category-name {
    font-size: 12px;
    color: var(--text-light);
}

.ocr-upload {
    margin-bottom: 20px;
}

.ocr-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ocr-label:hover {
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.05);
}

.ocr-icon {
    font-size: 32px;
}

.ocr-text {
    font-size: 14px;
    color: var(--text-light);
}

.plan-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

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

.btn-small:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.user-info {
    padding: 16px;
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 16px;
}

.user-info p {
    font-size: 16px;
    color: var(--text);
}

.settings-item {
    text-align: center;
}

.record-date {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.toast-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.toast {
    background: var(--card-bg);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideDown 0.3s ease;
    max-width: 320px;
}

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

.toast-icon {
    font-size: 24px;
}

.toast-message {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}
