:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #f43f5e;
    --accent: #10b981;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

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

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

select, input {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: white;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
}

select:focus, input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

button {
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

#btn-save:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

#btn-clear {
    background: #f3f4f6;
    color: var(--text-muted);
}

#btn-clear:hover {
    background: #e5e7eb;
}

.upload-btn {
    background: var(--accent);
    color: white;
    grid-column: span 2;
    margin-bottom: 10px;
}

.upload-btn:hover {
    filter: brightness(1.1);
}

.stats-container {
    margin-top: 40px;
    border-top: 1px solid #e5e7eb;
    padding-top: 30px;
}

.chart-wrapper {
    margin: 20px 0;
    padding: 15px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.record-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#record-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.record-item {
    background: white;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border: 1px solid #f3f4f6;
    animation: slideIn 0.3s ease-out;
}

.record-info {
    display: flex;
    flex-direction: column;
}

.record-detail {
    font-weight: 600;
}

.record-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.record-amount {
    font-weight: 800;
    color: var(--secondary);
    font-size: 1.1rem;
}

.category-badge {
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.cat-早餐 { background: #fef3c7; color: #d97706; }
.cat-午餐 { background: #dcfce7; color: #16a34a; }
.cat-晚餐 { background: #dbeafe; color: #2563eb; }
.cat-其他 { background: #f3f4f6; color: #4b5563; }

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

/* Scrollbar */
#record-list::-webkit-scrollbar {
    width: 6px;
}
#record-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 24px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
