:root {
    /* Ljust Tema (Standard) */
    --bg-color: #f4f6f9;
    --surface-color: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --primary-color: #6c5ce7;
    --primary-light: #a29bfe;
    --expense-color: #ff7675;
    --income-color: #00b894;
    --border-color: #dfe6e9;
    --card-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

body.dark-mode {
    /* Mörkt Tema */
    --bg-color: #1e1e24;
    --surface-color: #2b2b36;
    --text-main: #f5f6fa;
    --text-muted: #a4b0be;
    --primary-color: #8c7ae6;
    --primary-light: #4a4a5c;
    --expense-color: #ff5252;
    --income-color: #10ac84;
    --border-color: #3d3d4e;
    --card-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Skärmar & Animationer */
.screen {
    display: none;
    padding: 20px 20px 100px 20px;
    animation: fadeIn 0.4s ease;
}
.screen.active {
    display: block;
}

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

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-top: 10px;
}
.greeting { font-size: 24px; font-weight: 600; }
.date-text { color: var(--text-muted); font-size: 14px; }
.header-icon {
    background: var(--surface-color);
    width: 45px; height: 45px;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    box-shadow: var(--card-shadow);
    color: var(--text-main);
    font-size: 18px;
}

/* Budget Card */
.budget-card {
    background: var(--surface-color);
    border-radius: 24px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}
.budget-header {
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-muted); font-size: 14px; font-weight: 500;
}
.currency-badge {
    background: var(--primary-light); color: #fff;
    padding: 4px 10px; border-radius: 12px; font-size: 12px;
}
.budget-amount {
    font-size: 36px; font-weight: 700; margin: 10px 0 20px 0; color: var(--text-main);
}
.progress-container {
    height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden; margin-bottom: 20px;
}
.progress-bar {
    height: 100%; background: var(--primary-color); width: 0%; border-radius: 4px; transition: width 0.5s ease, background 0.3s;
}
.budget-details {
    display: flex; justify-content: space-between; border-top: 1px solid var(--border-color); padding-top: 15px;
}
.detail-item { display: flex; align-items: center; gap: 10px; }
.expense-icon { color: var(--expense-color); background: rgba(255, 118, 117, 0.1); padding: 10px; border-radius: 50%; }
.income-icon { color: var(--income-color); background: rgba(0, 184, 148, 0.1); padding: 10px; border-radius: 50%; }
.detail-item p { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.detail-item h4 { font-size: 16px; font-weight: 600; }

/* Listor & Titlar */
.section-title { margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.section-title h3 { font-size: 18px; font-weight: 600; }

.transaction-list, .category-list { display: flex; flex-direction: column; gap: 12px; }

.transaction-item, .cat-progress-item {
    background: var(--surface-color); padding: 15px; border-radius: 16px;
    display: flex; align-items: center; justify-content: space-between; box-shadow: var(--card-shadow);
}
.t-info { display: flex; align-items: center; gap: 15px; }
.t-icon { width: 45px; height: 45px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 20px; }
.t-details h4 { font-size: 15px; margin-bottom: 3px; }
.t-details p { font-size: 12px; color: var(--text-muted); }
.t-amount { font-weight: 600; font-size: 16px; }
.t-amount.expense { color: var(--expense-color); }
.t-amount.income { color: var(--income-color); }
.delete-btn { color: var(--expense-color); background: none; border: none; font-size: 16px; padding: 10px; cursor: pointer;}

/* Kategori Progress */
.cat-progress-item { flex-direction: column; align-items: flex-start; gap: 10px; }
.cat-header { display: flex; justify-content: space-between; width: 100%; font-size: 14px; font-weight: 500; }
.cat-bar-bg { width: 100%; height: 6px; background: var(--border-color); border-radius: 3px; }
.cat-bar-fill { height: 100%; border-radius: 3px; background: var(--primary-color); }

/* Form (Lägg till transaktion) */
.form-container { background: var(--surface-color); padding: 25px; border-radius: 24px; box-shadow: var(--card-shadow); }
.type-toggle { display: flex; background: var(--bg-color); border-radius: 12px; pdding: 5px; margin-bottom: 25px; }
.toggle-btn { flex: 1; padding: 12px; border: none; background: transparent; color: var(--text-muted); font-weight: 600; border-radius: 10px; transition: 0.3s; }
.toggle-btn.active { background: var(--primary-color); color: #fff; box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3); }

.input-group { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.input-group label { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.input-group input, .input-group select {
    padding: 15px; border-radius: 12px; border: 1px solid var(--border-color);
    background: var(--bg-color); color: var(--text-main); font-size: 16px; outline: none;
}
.amount-group { flex-direction: row; align-items: center; border-bottom: 2px solid var(--primary-color); padding-bottom: 5px; margin-bottom: 30px; }
.amount-group span { font-size: 28px; font-weight: 600; color: var(--text-muted); }
.amount-group input { border: none; background: transparent; font-size: 36px; font-weight: 700; width: 100%; padding: 0 10px; text-align: right;}

.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat-option {
    display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 5px;
    background: var(--bg-color); border-radius: 12px; border: 2px solid transparent; transition: 0.2s; cursor: pointer;
}
.cat-option.selected { border-color: var(--primary-color); background: rgba(108, 92, 231, 0.1); color: var(--primary-color);}
.cat-option i { font-size: 24px; }
.cat-option span { font-size: 12px; font-weight: 500;}

.btn-primary {
    width: 100%; padding: 16px; background: var(--primary-color); color: #fff;
    border: none; border-radius: 16px; font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 15px rgba(108, 92, 231, 0.3);
}

/* Inställningar */
.settings-container { display: flex; flex-direction: column; gap: 20px; }
.settings-card { background: var(--surface-color); padding: 20px; border-radius: 20px; box-shadow: var(--card-shadow); }
.settings-card h3 { font-size: 16px; margin-bottom: 15px; color: var(--primary-color); }
.setting-item { margin-bottom: 15px; display: flex; flex-direction: column; gap: 8px; }
.setting-item.row { flex-direction: row; justify-content: space-between; align-items: center; font-weight: 500; margin-bottom: 0;}
.setting-item input[type="number"], .setting-item select { padding: 12px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-main); font-size: 16px;}

.danger-zone { border: 1px solid var(--expense-color); }
.danger-zone h3 { color: var(--expense-color); }
.danger-zone p { font-size: 13px; color: var(--text-muted); margin-bottom: 15px; }
.btn-danger { width: 100%; padding: 14px; background: rgba(255, 82, 82, 0.1); color: var(--expense-color); border: 1px solid var(--expense-color); border-radius: 12px; font-weight: 600; cursor: pointer; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border-color); transition: .4s; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(22px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 600px; height: 75px;
    background: var(--surface-color); box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    display: flex; justify-content: space-around; align-items: center;
    border-top-left-radius: 24px; border-top-right-radius: 24px; z-index: 100;
}
.nav-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-muted); font-size: 12px; gap: 5px; transition: 0.3s; width: 60px; }
.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--primary-color); font-weight: 600; }
.nav-fab .fab {
    background: var(--primary-color); color: white; width: 55px; height: 55px;
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    transform: translateY(-20px); box-shadow: 0 8px 20px rgba(108, 92, 231, 0.4); border: 4px solid var(--bg-color); transition: transform 0.2s;
}
.nav-fab:active .fab { transform: translateY(-15px); }
