/* FinTrack Premium Financial Dashboard Stylesheet */
:root {
    --bg-dark: 224 25% 4.8%; /* Deep Dark Slate Navy */
    --card-bg: 224 20% 8% / 0.75;
    
    --primary: 217.2 91.2% 59.8%; /* Neon Finance Blue */
    --primary-glow: 217.2 91.2% 65% / 0.15;
    
    --green: 142.1 76.2% 45%;
    --green-glow: 142.1 76.2% 45% / 0.1;
    --red: 346.8 77.2% 49.8%;
    --red-glow: 346.8 77.2% 49.8% / 0.1;
    
    --border: 224 15% 15% / 0.8;
    --border-hover: 224 15% 25% / 0.9;
    --text-main: 210 20% 98%;
    --text-muted: 215 15% 65%;
    
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    background-color: hsl(var(--bg-dark));
    color: hsl(var(--text-main));
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Mesh Backdrop Glow */
.mesh-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(at 10% 20%, hsla(var(--primary), 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 80%, hsla(var(--green), 0.04) 0px, transparent 50%),
        radial-gradient(at 50% 50%, hsla(var(--red), 0.04) 0px, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    height: 70px;
    border-bottom: 1px solid hsl(var(--border));
    background-color: hsla(var(--bg-dark), 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: hsl(var(--text-main));
    text-decoration: none;
}

.logo-icon {
    color: hsl(var(--primary));
    width: 24px;
    height: 24px;
}

.accent-text {
    color: hsl(var(--primary));
}

.status-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    background-color: #0b0d11;
    border: 1px solid hsl(var(--border));
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: hsl(var(--green));
    box-shadow: 0 0 8px hsl(var(--green));
}

/* Stats Summary Row */
.summary-section {
    padding: 2.5rem 0 1.5rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background-color: hsl(var(--card-bg));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    padding: 1.75rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: hsl(var(--border-hover));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.stat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: hsl(var(--text-muted));
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-meta i {
    width: 20px;
    height: 20px;
}

.icon-balance { color: hsl(var(--primary)); }
.icon-income { color: hsl(var(--green)); }
.icon-expense { color: hsl(var(--red)); }

.stat-card h2 {
    font-family: var(--font-mono);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-desc {
    font-size: 0.8rem;
    color: hsl(var(--text-muted));
}

.text-green { color: hsl(var(--green)) !important; }
.text-red { color: hsl(var(--red)) !important; }

/* Workspace Grid Layout */
.workspace-section {
    padding-bottom: 4rem;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.workspace-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Dashboard Cards */
.dashboard-card {
    background-color: hsl(var(--card-bg));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.dashboard-card:hover {
    border-color: hsl(var(--border-hover));
}

.dashboard-card h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px dashed hsl(var(--border));
    padding-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Forms styling */
.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 1rem;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: hsl(var(--text-muted));
}

input, select {
    background-color: #0b0d11;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    padding: 0.75rem;
    color: hsl(var(--text-main));
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition);
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 10px hsla(var(--primary), 0.25);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), #1d4ed8);
    color: white;
    box-shadow: 0 4px 15px hsla(var(--primary), 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px hsla(var(--primary), 0.4);
}

/* Donut Chart components */
.chart-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.donut-chart-container {
    position: relative;
    width: 160px;
    height: 160px;
}

.donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-bg {
    fill: none;
    stroke: #0d0f14;
    stroke-width: 16;
}

.donut-segment {
    fill: none;
    stroke-width: 16;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease, stroke-dashoffset 0.5s ease;
}

.donut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 110px;
}

.donut-total-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--text-muted));
}

.donut-total-amount {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: hsl(var(--text-main));
    word-break: break-all;
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Ledger List Right Side */
.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed hsl(var(--border));
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.ledger-header h3 {
    border: none;
    padding: 0;
    margin: 0;
}

.ledger-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    position: relative;
    width: 200px;
}

.search-box input {
    padding: 0.5rem 0.5rem 0.5rem 2.2rem;
    font-size: 0.85rem;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: hsl(var(--text-muted));
}

.ledger-actions select {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    width: 150px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    max-height: 480px;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.ledger-table th {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: hsl(var(--text-muted));
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    letter-spacing: 0.05em;
}

.ledger-table td {
    padding: 1rem;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.9rem;
    vertical-align: middle;
}

.ledger-table tbody tr {
    transition: var(--transition);
}

.ledger-table tbody tr:hover {
    background-color: #0b0d11 / 0.5;
}

.cell-amount {
    font-family: var(--font-mono);
    font-weight: 600;
}

.badge-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background-color: #12151c;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    color: hsl(var(--text-muted));
    display: inline-block;
}

.badge-flow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-delete {
    background: none;
    border: none;
    color: hsl(var(--text-muted));
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-delete:hover {
    color: hsl(var(--red));
    background-color: hsla(var(--red), 0.15);
}

.btn-delete svg {
    width: 16px;
    height: 16px;
}

.ledger-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: hsl(var(--text-muted));
}

.empty-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.d-none {
    display: none !important;
}

/* Footer styling */
.footer {
    border-top: 1px solid hsl(var(--border));
    background-color: #05070a;
    padding: 2rem 0;
    margin-top: auto;
    font-size: 0.8rem;
    color: hsl(var(--text-muted));
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive */
@media (max-width: 968px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .workspace-grid {
        grid-template-columns: 1fr;
    }
    
    .ledger-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ledger-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box, .ledger-actions select {
        flex: 1;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* AI Advisor styles */
.ai-advisor-card h3 {
    position: relative;
}

.ai-status-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #60a5fa;
    box-shadow: 0 0 8px #60a5fa;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.ai-insights-list {
    background-color: #0b0d11;
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    max-height: 140px;
    overflow-y: auto;
}

.ai-insight-item {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    line-height: 1.4;
}

.ai-insight-item i {
    width: 14px;
    height: 14px;
    color: hsl(var(--primary-glow));
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-insight-item .insight-text {
    color: hsl(var(--text-muted));
}

.ai-insight-item .insight-text strong {
    color: hsl(var(--text-main));
}

.ai-chat-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-chat-thread {
    height: 160px;
    overflow-y: auto;
    border: 1px solid hsl(var(--border));
    background-color: #0b0d11;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    max-width: 85%;
    font-size: 0.8rem;
    line-height: 1.45;
}

.chat-message p {
    margin: 0;
}

.ai-message {
    background-color: hsl(var(--border) / 0.5);
    color: hsl(var(--text-main));
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.user-message {
    background-color: hsl(var(--primary));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chat-form {
    display: flex;
    gap: 0.5rem;
}

.ai-chat-form input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
}

.btn-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: linear-gradient(135deg, hsl(var(--primary)), #1d4ed8);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-chat-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px hsla(var(--primary), 0.35);
}

.typing-indicator {
    display: flex;
    gap: 3px;
    padding: 6px 0;
    align-items: center;
}

.typing-dot {
    width: 5px;
    height: 5px;
    background-color: hsl(var(--text-muted));
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
