:root {
    /* Color Palette - Wally Edition */
    --bg-dark: #0A0A0A; 
    --bg-card: rgba(26, 26, 26, 0.8); 
    --text-primary: #FAFAFA;
    --text-secondary: rgba(250, 250, 250, 0.6);
    --accent-blue: #FF6B00; /* Replaced Blue with Wally Orange */
    --accent-green: #25D366; /* WhatsApp Green */
    --accent-red: #ef4444;
    --glass-border: rgba(255, 107, 0, 0.2);
    --glass-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.6);
    --nav-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-bottom-color: #ff6b00;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden; /* App acts like a native app */
    width: 100vw;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Utilities */
.hidden { display: none !important; }
.v-stack { display: flex; flex-direction: column; gap: 1rem; }
.h-stack { display: flex; flex-direction: row; gap: 1rem; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-20 { margin-top: 20px; }

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: transparent;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.5rem;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.date-header {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Base Glass Effect */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

/* Main Content Area */
#content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px 100px 20px; /* Padding bottom for nav */
}

/* Sections */
.view-section {
    animation: fadeIn 0.4s ease forwards;
}

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

.section-title {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 20px 0 10px 5px;
    font-weight: 400;
}

/* Total View: Net Worth Card */
.net-worth-card {
    padding: 24px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.15), rgba(26, 26, 26, 0.9));
    margin-bottom: 24px;
}

.net-worth-card h2 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 8px;
}

.net-worth-card h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(to right, #FF6B00, #FFB800);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.net-worth-card .subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Accounts Grid */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.account-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

.account-card:active {
    transform: scale(0.96);
}

.acc-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    word-wrap: break-word;
}

.acc-balance {
    font-size: 1.2rem;
    font-weight: 600;
}

.vault-card {
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.1), rgba(10, 10, 10, 0.95));
    padding: 20px;
    margin-bottom: 30px;
}

/* Transaction Lists */
.header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header-action h2 {
    font-size: 1.2rem;
}

.month-selector {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}

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

.tx-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tx-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tx-desc {
    font-weight: 600;
    font-size: 1rem;
}

.tx-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tx-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.tx-amount.ingreso { color: var(--accent-green); }
.tx-amount.egreso { color: var(--accent-red); }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
}

/* Statistics View */
.chart-container {
    padding: 16px;
    margin-top: 16px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
}

.stat-card h4 {
    font-size: 1.2rem;
    color: var(--accent-blue);
}

/* Alerts */
.alert {
    margin: 0 20px 10px 20px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fca5a5;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Privacy Masking */
.privacy-active .mask-target {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* Specific small list for modal */
.transaction-list.small .tx-item {
    padding: 10px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.transaction-list.small .tx-amount {
    font-size: 0.9rem;
}

.transaction-list.small .tx-meta {
    font-size: 0.7rem;
}

/* Botones Iconos */
.icon-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 10px); /* For iPhone X+ */
    z-index: 100;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    flex: 1;
    padding: 10px 0;
    transition: var(--transition);
}

.nav-icon {
    font-size: 1.4rem;
    transition: var(--transition);
}

.nav-btn.active {
    color: var(--text-primary);
}

.nav-btn.active .nav-icon {
    transform: translateY(-4px);
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.4));
}

/* Center ADD Button */
.nav-center-action {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    top: -20px;
}

.add-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), #FF8C00);
    border: none;
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(255, 107, 0, 0.4);
    transition: var(--transition);
    cursor: pointer;
}

.add-btn:active {
    transform: scale(0.9);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end; /* Slide up from bottom */
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: #111111;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-bottom: none;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.3rem;
}

/* Form Styles */
.input-mode-switcher {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.mode-btn.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Input common styles */
.glass-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.glass-input:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.amount-group {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 16px;
    font-size: 1.4rem;
    color: var(--text-secondary);
}

.amount-input {
    padding-left: 36px;
    font-size: 1.5rem;
    font-weight: 700;
}

.type-selector option, #reg-account option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Voice Mode specific */
.mic-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--accent-blue);
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    transition: all 0.3s ease;
}

.mic-button.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-instruction {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.voice-feedback {
    min-height: 40px;
    font-weight: 600;
    color: var(--accent-blue);
}
