/* Base color variables */
:root{
    --primary: #00a6a0;
    --primary-dark: #007b77;
    --accent: #d1007a;
    --accent-glow: #ff33b5;
    --background: #f8f9fb;
    --panel-bg: rgba(255,255,255,0.95);
    --text: #0a0a0f;
    --muted: #6b7280;
    --success: #00b35a;
    --danger: #ff3366;
    --surface-shadow: 0 6px 20px rgba(0,0,0,0.08);
    --radius: 12px;
    --gap: 14px;
    --max-width: 520px;
}

/* Dark theme override */
body.dark-mode{
    --primary: #00fff0;
    --primary-dark: #00ffe1;
    --accent: #ff00aa;
    --accent-glow: #ff33cc;
    --background: #0b0b0f;
    --panel-bg: rgba(15,15,25,0.92);
    --text: #ffffff;
    --muted: #b3b3b3;
    --surface-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

/* Layout */
*
{
    box-sizing:border-box;
}

html,body{
    height:auto; 
    margin:0; 
    font-family:"Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

body{
    background:var(--background);
    color:var(--text);
    display:flex;
    align-items:flex-start;
    justify-content:center;
    padding:28px;
    transition:background .35s ease,color .35s ease;
}

/* Main tracker container */
.tracker{
    width:100%;
    max-width:var(--max-width);
    display:grid;
    gap:var(--gap);
    grid-template-columns:1fr;
}

/* Cards */
.card{
    background:var(--panel-bg);
    border-radius:var(--radius);
    padding:18px;
    box-shadow:var(--surface-shadow);
    border: 1px solid rgba(0,0,0,0.04);
    transition:transform .18s ease, box-shadow .18s ease;
}

.card:hover{
    transform:translateY(-4px);
}

.header h1{
    margin:0;
    font-size:1.6rem;
    color:var(--primary);
    letter-spacing:0.2px;
}

.header h1 span{
    font-weight:600;
    color:var(--accent);
}

.subtitle{
    color:var(--muted);
    margin-top:6px;
    font-size:.92rem;
}

/* Theme toggle */
.theme-toggle{
    position:fixed;
    right:22px;
    top:22px;
    cursor:pointer;
    background:transparent;
    border-radius:10px;
    padding:8px;
    color:var(--primary);
    font-size:1.05rem;
    z-index:40;
}

.theme-toggle i{
    transition:transform .25s ease;
}

.theme-toggle:hover i{
    transform:rotate(20deg);
}

/* Summary */
.summary{
    display:flex;
    gap:12px;
    align-items:center;
    justify-content:space-between;
}

.balance h3{
    margin:0;color:var(--muted);
    font-weight:600;
}

.balance p{
    margin-top:6px;
    font-size:1.4rem;
    font-weight:800;
    color:var(--text);
}

.mini{
    display:flex;
    gap:10px;
}

.mini > div{
    background:transparent;
    padding:8px;
    border-radius:8px;
    min-width:110px;
    text-align:center;
}

.income h4,.expense h4{
    margin:0;
    font-size:.82rem;
    color:var(--muted);
}

.income p{
    margin-top:6px;
    font-weight:700;
    color:var(--success);
}

.expense p{
    margin-top:6px;
    font-weight:700;
    color:var(--danger);
}

/* Add transaction form */
.add-transaction h3{
    margin-bottom:8px;
}

.form-row{
    margin-bottom:10px;
}

.split{
    display:flex;
    gap:10px;
}

.split input{
    flex:1;
}

input, select{
    width:100%;
    padding:10px 12px;
    border-radius:8px;
    border:1px solid rgba(0,0,0,0.06);
    background:transparent;
    color:var(--text);
    font-size:0.95rem;
    outline:none;
    transition:border .15s ease, box-shadow .15s ease;
}

input:focus, select:focus{
    border-color:var(--primary-dark); 
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}

select{
    max-width:150px; 
    background:var(--panel-bg); 
    color:var(--text);
}

/* Buttons */
.btn{
    padding:9px 14px;
    border-radius:10px;
    border:none;
    cursor:pointer;
    font-weight:700;
    font-size:.95rem;
}

.btn.primary{
    background:var(--primary);
    color:#000;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.btn.ghost{
    background:transparent;
    color:var(--muted);
    border:1px solid rgba(0,0,0,0.05);
}

/* History list */
.history h3{
    margin-bottom:8px;
}

.transactions{
    list-style:none;
    margin:0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.transaction{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px;
    border-radius:8px;
    border:1px solid rgba(0,0,0,0.03);
}

.tx-left{
    display:flex;
    gap:12px;
    align-items:center;
}

.tx-icon{
    width:44px;
    height:44px;
    border-radius:8px;
    display:grid;
    place-items:center;
    font-weight:700;
}

.tx-desc{
    font-weight:600;
}

.tx-time{
    font-size:.8rem;
    color:var(--muted);
}

.tx-amount{
    font-weight:800;
}

.tx-income{
    background:linear-gradient(90deg, rgba(0,163,136,0.12), rgba(0,163,136,0.06));
    color:var(--success);
}

.tx-expense{
    background:linear-gradient(90deg, rgba(220,0,51,0.06), rgba(220,0,51,0.03));
    color:var(--danger);
}

/* delete button */
.del{
    background:transparent;
    border:none;
    color:var(--muted);
    cursor:pointer;
    padding:6px;
    border-radius:8px;
}

.del:hover{
    color:var(--danger);
}

/* Modal */
.modal{
    position:fixed;
    inset:0;
    display:grid;
    place-items:center;
    background:rgba(0,0,0,0.45);
    z-index:60;
}

.modal.hidden{
    display:none;
}

.modal-content{
    background:var(--panel-bg);
    padding:20px;
    border-radius:12px;
    min-width:280px;
    text-align:center;
    box-shadow:var(--surface-shadow);
}

.modal-content h3{
    margin:0 0 8px;
    color:var(--danger);
}

.modal-content p{
    color:var(--muted);
    margin-bottom:14px;
}

/* Small screens */
@media (max-width:520px){
    .tracker{
        padding:8px;
    }

    .theme-toggle{
        right:12px;
        top:12px;
    }

    .split{
        flex-direction:column;
    }
}
