/* --- VARIABLES --- */
:root {
    --bg-dark: #0f111a;
    --bg-panel: #1a1d2d;
    --glass-bg: rgba(30, 35, 50, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #00e5ff; 
    --primary-dim: rgba(0, 229, 255, 0.42);
    --accent: #00e5ff; 
    --accent-dim: rgba(255, 64, 129, 0.15);
    --text-main: #ffffff;
    --text-muted: #a0a3bd;
    --danger: #00e5ff;
    --radius-lg: 20px;
    --radius-md: 12px;
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.5);
    --font-main: 'Poppins', sans-serif;
    --header-height: 150px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding-top: var(--header-height);
    overflow-x: hidden;
}

/* --- BUG FIX: NEW INPUT GROUP STYLING --- */
/* Ito ang solusyon sa bug. Flexbox ang gamit kaya hindi magpapatong. */
.input-group-row {
    display: flex;
    align-items: stretch;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden; /* Ensures rounded corners are kept */
    transition: all 0.3s ease;
}

.input-group-row:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.currency-prefix {
    width: 90px;
    background: rgba(51, 51, 51, 0.68);
    border: none;
    border-right: 1px solid var(--glass-border);
    color: var(--primary);
    font-weight: 600;
    padding: 0 10px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 1rem;
    outline: none;
    flex-shrink: 0; /* Huwag liliit */
}

.amount-field {
    flex-grow: 1; /* Sasakupin ang natitirang space */
    border: none !important; /* Remove default input border */
    background: transparent !important;
    padding: 14px 18px;
    font-size: 1rem;
    color: var(--text-main);
    outline: none !important;
    box-shadow: none !important;
}

/* --- OTHER FORM STYLES --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }

input[type="text"], select:not(.currency-prefix, #display-currency-select) {
    width: 100%; padding: 14px 18px;
    background: var(--bg-dark); border: 1px solid var(--glass-border);
    border-radius: var(--radius-md); color: var(--text-main);
    font-family: var(--font-main); font-size: 1rem;
    transition: all 0.3s ease;
}
input:focus, select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-dim); }

/* --- HEADER --- */
#header {
    position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
    background: rgba(15, 17, 26, 0.95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border); z-index: 1000;
    display: flex; flex-direction: column; justify-content: center;
}
.header-container { max-width: 1000px; margin: 0 auto; width: 100%; padding: 0 20px; }
.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.brand { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.display-currency-wrapper {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.05); padding: 5px 12px;
    border-radius: 20px; border: 1px solid var(--glass-border);
}
#display-currency-select { background: transparent; border: none; color: var(--text-main); font-weight: 600; cursor: pointer; }

#main-nav { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 5px; }
#main-nav::-webkit-scrollbar { display: none; }
.nav-pill {
    background: transparent; border: 1px solid var(--glass-border); color: var(--text-muted);
    padding: 10px 20px; border-radius: 50px; font-weight: 500; font-size: 0.9rem; cursor: pointer;
    white-space: nowrap; transition: 0.3s; display: flex; align-items: center; gap: 8px;
}
.nav-pill.active { background: var(--primary); color: #000; border-color: var(--primary); box-shadow: 0 4px 15px var(--primary-dim); }
.nav-pill[data-page="savings"].active { background: var(--accent); box-shadow: 0 4px 15px var(--accent-dim); }

/* --- MAIN & CARDS --- */
#app-container { max-width: 1000px; margin: 0 auto; padding: 20px; }
.page { display: none; }
.page.active { display: block; animation: fadeInPage 0.5s ease; }
@keyframes fadeInPage { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.glass-panel {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: 25px; margin-bottom: 25px; box-shadow: var(--shadow-soft);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.badge { font-size: 0.75rem; background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 12px; color: var(--primary); }

.total-display h1 { font-size: 2.5rem; color: var(--text-main); line-height: 1.2; margin-bottom: 20px; }
.savings-total h1 { color: var(--accent); }
.chart-wrapper { height: 300px; position: relative; }

/* --- BUTTONS --- */
.btn-primary, .btn-accent {
    width: 100%; padding: 16px; border: none; border-radius: var(--radius-md);
    font-weight: 600; font-size: 1rem; color: #000; transition: 0.2s;
}
.btn-primary { background: var(--primary); }
.btn-accent { background: var(--accent); }
.btn-danger-outline {
    width: 100%; padding: 12px; margin-top: 20px; background: transparent;
    border: 1px solid var(--danger); color: var(--danger); border-radius: var(--radius-md);
}

/* --- LISTS & HISTORY --- */
.styled-list { list-style: none; }
.list-item {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.03); padding: 16px; border-radius: var(--radius-md);
    margin-bottom: 10px; border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}
.list-item:hover { background: rgba(255,255,255,0.06); transform: translateX(5px); }

/* Category Tag Style in List */
.category-tag {
    display: inline-block; font-size: 0.75rem; background: rgba(0, 229, 255, 0.1);
    color: var(--primary); padding: 2px 8px; border-radius: 4px; margin-right: 8px;
}
.item-date { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 4px; }
.item-name { font-weight: 600; font-size: 1rem; }
.item-amount { font-weight: 700; font-size: 1.1rem; color: var(--primary); }

.full-list { max-height: 60vh; overflow-y: auto; }
.history-header { font-size: 1rem; color: var(--text-muted); margin-bottom: 15px; }

/* --- TABS --- */
.tabs-container { display: flex; gap: 10px; padding: 10px !important; }
.tab-btn {
    flex: 1; padding: 12px; border: none; background: transparent; color: var(--text-muted);
    border-radius: var(--radius-md); font-weight: 600; transition: 0.3s;
}
.tab-btn.active { background: rgba(255,255,255,0.1); color: var(--text-main); }
.history-content { display: none; }
.history-content.active { display: block; animation: fadeInPage 0.3s ease; }

/* --- SPLASH SCREEN --- */
#splash-screen {
    position: fixed; inset: 0; background-color: var(--bg-dark); z-index: 9999;
    display: flex; align-items: center; justify-content: center; transition: opacity 0.6s ease;
}
.splash-content { text-align: center; }
.logo-large { font-size: 3rem; font-weight: 700; color: var(--text-main); margin-bottom: 20px; }
.loading-bar-container { width: 200px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin: 0 auto; overflow: hidden; }
.loading-bar { width: 0%; height: 100%; background: var(--primary); animation: loadBar 1.5s ease-in-out forwards; }
@keyframes loadBar { to { width: 100%; } }
.hidden-element { opacity: 0; visibility: hidden; }

/* Animations */
.fade-in-up { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }