/* Base CSS Variables for Theme */
:root {
    --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #151b2e 100%);
    --panel-bg: rgba(26, 32, 53, 0.55);
    --panel-border: rgba(255, 255, 255, 0.06);
    --text-primary: #e6edf3;
    --text-secondary: #8b9bb4;
    
    /* Neon Colors */
    --accent: #9d4edd;
    --accent-glow: rgba(157, 78, 221, 0.4);
    --primary: #00d4ff;
    --primary-glow: rgba(0, 212, 255, 0.3);
    
    /* Status Colors */
    --green: #00e676;
    --green-glow: rgba(0, 230, 118, 0.2);
    --orange: #ff9100;
    --red: #ff1744;
    --red-glow: rgba(255, 23, 68, 0.2);
    
    /* Layout Sizes */
    --sidebar-width: 280px;
    --transition-speed: 0.25s;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Glassmorphism Card Style */
.glass-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red { color: var(--red); }
.text-accent { color: var(--accent); }

.w-100 { width: 100%; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 24px; }
.flex-col {
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Auth Screen Details */
#auth-screen {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    animation: fadeIn 0.4s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    margin-bottom: 20px;
}

.auth-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: border-color var(--transition-speed);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.auth-hint {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Button Configurations */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-speed) ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, #0099ff 100%);
    color: #050505;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.accent-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #7209b7 100%);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}
.accent-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(157, 78, 221, 0.6);
}

.danger-btn {
    background: rgba(255, 23, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(255, 23, 68, 0.25);
}
.danger-btn:hover {
    background: rgba(255, 23, 68, 0.25);
}

.btn:active {
    transform: translateY(0);
}

/* Dashboard Page Layout */
.layout {
    width: 100%;
    max-width: 1400px;
    height: calc(100vh - 40px);
    display: flex;
    gap: 24px;
    animation: fadeIn 0.5s ease-out;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.logo h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    text-transform: capitalize;
}

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-speed);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(157, 78, 221, 0.15);
    color: var(--text-primary);
    font-weight: 600;
    border-left: 3px solid var(--accent);
}

.nav-icon {
    font-size: 16px;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-right: 4px; /* for scrollbar */
}

/* Top Navigation Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--panel-border);
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.top-actions {
    display: flex;
    gap: 12px;
}

/* Content Sections */
.content-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.3s ease-out;
}

/* Metrics Row */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.metric-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.metric-card.border-accent::before {
    background: var(--accent);
}

.metric-card h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.metric-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Dashboard Split Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

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

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-action {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.card-action:hover {
    text-decoration: underline;
}

.placeholder-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 40px 0;
    font-style: italic;
}

/* Dashboard Budgets Progress Lists */
.budget-progress-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 380px;
    overflow-y: auto;
}

.budget-progress-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.progress-label {
    font-weight: 500;
}

.progress-stats {
    color: var(--text-secondary);
}

.progress-stats-highlight {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

/* Dashboard Transactions lists */
.recent-transactions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255, 255, 255, 0.015);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.tx-main {
    display: flex;
    flex-direction: column;
}

.tx-title {
    font-weight: 500;
    font-size: 14px;
}

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

.tx-amount {
    font-weight: 600;
    font-size: 14px;
}

/* Table styling for budgets & transactions */
.table-header {
    padding: 24px;
    border-bottom: 1px solid var(--panel-border);
}

.table-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.table-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.pricing-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
    background: rgba(0, 212, 255, 0.03);
    border: 1px solid rgba(0, 212, 255, 0.08);
    padding: 8px 12px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--panel-border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.08);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Dynamic Inline Budget Inputs */
.budget-input {
    width: 90px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    text-align: right;
}

.budget-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Dynamic Dropdown Select Elements */
.category-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.category-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Bank Accounts Grid Component */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 24px;
}

.account-card {
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    height: auto;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.account-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
}

.account-card.private-card::after {
    background: var(--accent);
}

.account-card.private-card {
    border-color: rgba(157, 78, 221, 0.2);
    background: linear-gradient(135deg, rgba(157, 78, 221, 0.03) 0%, rgba(157, 78, 221, 0.01) 100%);
}

.account-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.bank-name {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.account-name-label {
    font-size: 16px;
    font-weight: 600;
    margin-top: 2px;
}

.account-mask {
    font-size: 12px;
    color: var(--text-secondary);
}

.account-card-body {
    margin: 16px 0;
}

.account-balance-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.account-balance-val {
    font-size: 26px;
    font-weight: 700;
}

.account-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 10px;
}

.account-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.badge-shared {
    background: rgba(0, 230, 118, 0.1);
    color: var(--green);
}

.badge-private {
    background: rgba(157, 78, 221, 0.2);
    color: var(--accent);
}

/* Credit Card Payment Helper Styles */
.cc-helper-section {
    margin-top: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.cc-helper-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.cc-helper-row.target-row {
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
    margin-top: 8px;
    margin-bottom: 0;
}

.account-card.private-card .cc-helper-row.target-row {
    color: var(--accent);
}

/* Toggle Switch Styling */
.switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 18px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--accent);
}

input:checked + .slider:before {
    transform: translateX(14px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .app-container {
        padding: 10px;
    }
}

/* Hero Metric Card (Giant Number Display) */
.hero-metric-card {
    padding: 40px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 230, 118, 0.15);
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.04) 0%, rgba(26, 32, 53, 0.6) 100%);
    box-shadow: 0 10px 40px rgba(0, 230, 118, 0.06);
}

.hero-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--green), var(--primary));
}

.hero-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.hero-value {
    font-size: 64px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid var(--panel-border);
}

.hero-stat-divider {
    color: rgba(255, 255, 255, 0.1);
    font-weight: 300;
}

.hero-stat-lbl strong {
    color: var(--text-primary);
    font-weight: 600;
}

.text-center {
    text-align: center;
}

/* Sidebar Net Worth Widget */
.sidebar-net-worth {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0, 230, 118, 0.03);
    border: 1px solid rgba(0, 230, 118, 0.08);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.net-worth-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-net-worth .net-worth-val {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 0 10px rgba(0, 230, 118, 0.15);
}

/* Categories inline form and custom management styles */
.inline-form {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.inline-form .form-group {
    margin-bottom: 0;
}

.align-self-end {
    align-self: flex-end;
}

.flex-1 {
    flex: 1;
}

/* Category edits inside table */
.inline-name-edit {
    font-weight: 600;
    width: 100%;
    max-width: 200px;
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-speed);
}

.inline-name-edit[readonly] {
    pointer-events: none;
}

.inline-name-edit:not([readonly]):focus, .inline-name-edit:not([readonly]):hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--panel-border);
}

.inline-type-edit {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-speed);
}

.inline-type-edit:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background var(--transition-speed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon.delete-category-btn {
    color: var(--red);
}

.btn-icon.delete-category-btn:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Ignored transactions table row styling */
.ignored-row {
    opacity: 0.45;
    text-decoration: line-through var(--text-secondary);
}

.ignored-row select, .ignored-row input {
    text-decoration: none !important;
}

.transaction-ignore-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}
