:root {
    --primary: #00d2ff;
    --primary-dark: #0099cc;
    --secondary: #9d50bb;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f1f5f9;
    --text-dim: #94a3b8;
    --accent-income: #22c55e;
    --accent-expense: #ef4444;
    --sidebar-width: 260px;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 210, 255, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(157, 80, 187, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

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

.hidden { display: none !important; }

/* Screens */
.screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
}

/* Login */
#login-screen {
    justify-content: center;
    align-items: center;
}

.login-card {
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.logo i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.5));
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.logo h1 span {
    color: var(--primary);
}

.login-card p {
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

.input-group input, 
.input-group select {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--primary);
}

/* Sidebar - Desktop Default */
.sidebar {
    width: var(--sidebar-width);
    height: calc(100vh - 40px);
    margin: 20px;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    z-index: 100;
}

.logo-small {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3rem;
}

.logo-small i {
    color: var(--primary);
    font-size: 1.5rem;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.nav-links li {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-dim);
    transition: all 0.3s;
}

.nav-links li:hover, .nav-links li.active {
    background: rgba(0, 210, 255, 0.1);
    color: var(--primary);
}

.nav-links li i { font-size: 1.2rem; }

.logout {
    padding: 1rem;
    margin-top: auto;
    cursor: pointer;
    color: var(--text-dim);
    text-align: center;
}

/* Main Content */
.content {
    margin-left: calc(var(--sidebar-width) + 60px);
    padding: 2rem 2rem 2rem 0;
    width: 100%;
    max-width: 1200px;
}

header {
    margin-bottom: 2rem;
}

header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
header p { color: var(--text-dim); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.income { background: rgba(34, 197, 94, 0.1); color: var(--accent-income); }
.stat-icon.monthly { background: rgba(157, 80, 187, 0.1); color: var(--secondary); }
.stat-icon.count { background: rgba(0, 210, 255, 0.1); color: var(--primary); }

.stat-info .label { font-size: 0.85rem; color: var(--text-dim); }
.stat-info h2 { font-size: 1.5rem; font-weight: 700; }

/* Dashboard Detail Grid */
.dashboard-details {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
}

.chart-container, .recent-list {
    padding: 1.5rem;
}

.chart-container h3, .recent-list h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-dim);
}

.chart-placeholder {
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* List Items */
.txn-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.txn-item:last-child { border-bottom: none; }

.txn-left h4 { font-size: 0.95rem; margin-bottom: 2px; }
.txn-left span { font-size: 0.8rem; color: var(--text-dim); }

.txn-right { text-align: right; }
.txn-amount { font-weight: 600; display: block; }
.txn-amount.pos { color: var(--accent-income); }

/* Forms */
.form-container {
    padding: 2.5rem;
    max-width: 800px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-grid .input-group i { display: none; }
.form-grid .input-group input, 
.form-grid .input-group select { padding-left: 1rem; }

/* OCR Section */
.upload-zone {
    padding: 4rem;
    text-align: center;
    cursor: pointer;
    border: 2px dashed var(--glass-border);
    transition: all 0.3s;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(0, 210, 255, 0.05);
}

.upload-zone i { font-size: 4rem; color: var(--primary); margin-bottom: 1rem; }

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.img-preview-container img {
    width: 100%;
    border-radius: 12px;
}

.ocr-results { padding: 1.5rem; }
.result-item { margin-bottom: 1rem; }
.result-item label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 5px; }
.result-item input {
    width: 100%;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
}

/* Tables */
.table-container { padding: 1.5rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 1rem; color: var(--text-dim); font-size: 0.85rem; border-bottom: 1px solid var(--glass-border); }
td { padding: 1.2rem 1rem; border-bottom: 1px solid var(--glass-border); font-size: 0.9rem; }
.delete-btn { color: var(--accent-expense); cursor: pointer; border: none; background: none; }

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 210, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* Responsive Adjustments */
@media (max-width: 900px) {
    body {
        padding-bottom: 80px; /* Space for bottom nav */
    }

    .sidebar {
        width: 100%;
        height: 70px;
        margin: 0;
        bottom: 0;
        left: 0;
        top: auto;
        flex-direction: row;
        padding: 0 10px;
        border-radius: 20px 20px 0 0;
        border-top: 1px solid var(--glass-border);
        border-left: none;
        border-right: none;
        border-bottom: none;
        justify-content: space-around;
        align-items: center;
    }

    .logo-small, .logout, .nav-links li span {
        display: none;
    }

    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        margin: 0;
    }

    .nav-links li {
        margin-bottom: 0;
        padding: 12px;
    }

    .content {
        margin-left: 0;
        padding: 1.5rem;
        padding-bottom: 100px;
    }

    .stats-grid { 
        grid-template-columns: 1fr; 
        gap: 1rem;
    }

    .dashboard-details { 
        grid-template-columns: 1fr; 
    }

    .form-container {
        padding: 1.5rem;
    }

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

    .preview-grid { 
        grid-template-columns: 1fr; 
    }

    header h1 {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .upload-zone {
        padding: 2rem;
    }
}
