:root {
    --bg-dark: #101820;
    --card-bg: rgba(24, 34, 43, 0.82);
    --accent-primary: #0f766e;
    --accent-secondary: #22c55e;
    --income: #10b981;
    --expense: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

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

/* Background Animation */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(15, 118, 110, 0.08) 0%, transparent 50%);
    z-index: -1;
    animation: move-bg 20s linear infinite;
}

@keyframes move-bg {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.app-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: calc(100vh - 4rem);
    position: sticky;
    top: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.nav-item.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-main);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.summary-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.card-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.card-value.income { color: var(--income); }
.card-value.expense { color: var(--expense); }

/* Table Container */
.section-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h2 { font-size: 1.5rem; font-weight: 700; }

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 500px;
    max-width: 90vw;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: white;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-top: 1rem;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-income { background: rgba(16, 185, 129, 0.1); color: var(--income); }
.badge-expense { background: rgba(239, 68, 68, 0.1); color: var(--expense); }

.status-paid { color: var(--income); }
.status-pending { color: #f59e0b; }

.daily-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.daily-panel {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem;
}

.daily-panel.urgent {
    border-color: rgba(244, 63, 94, 0.28);
}

.daily-panel.today {
    border-color: rgba(245, 158, 11, 0.28);
}

.daily-panel.upcoming {
    border-color: rgba(16, 185, 129, 0.22);
}

.daily-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: .65rem;
}

.daily-panel-header h3 {
    font-size: 1rem;
}

.daily-panel-header strong {
    font-size: .95rem;
}

.report-grid,
.report-alerts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.report-grid > div,
.report-alerts > div {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
}

.report-grid h4,
.report-alerts h4 {
    margin-bottom: .75rem;
    color: var(--text-main);
}

.report-row,
.quick-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.quick-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(16, 185, 129, 0.28);
    background: rgba(16, 185, 129, 0.12);
    color: var(--income);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.security-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.report-row:last-child,
.quick-row:last-child {
    border-bottom: none;
}

.report-row span,
.quick-row span {
    display: block;
    color: var(--text-muted);
    font-size: .75rem;
    margin-top: .25rem;
}

.income { color: var(--income); }
.expense { color: var(--expense); }
.empty-state {
    color: var(--text-muted);
    font-size: .9rem;
    padding: .75rem 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.credit-card {
    background: linear-gradient(135deg, rgba(15, 118, 110, .32), rgba(15, 23, 42, .88));
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 1.2rem;
    min-height: 230px;
}

.credit-card.inactive {
    opacity: .58;
}

.credit-card-top,
.limit-row,
.limit-meta,
.card-details,
.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.credit-card-top span,
.limit-row span,
.limit-meta,
.card-details {
    color: var(--text-muted);
    font-size: .78rem;
}

.credit-card-top {
    margin-bottom: 2rem;
}

.credit-card-top i {
    color: var(--accent-secondary);
}

.limit-track {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,.1);
    border-radius: 999px;
    overflow: hidden;
    margin: .7rem 0;
}

.limit-track > div {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), #f59e0b);
}

.card-details {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.card-actions {
    justify-content: flex-start;
    margin-top: 1.25rem;
}

.btn.danger {
    background: rgba(239,68,68,.12);
    color: var(--expense);
}

.danger-zone {
    margin-top: 2rem;
    padding: 1.25rem;
    border: 1px solid rgba(239,68,68,.28);
    border-radius: 12px;
    background: rgba(239,68,68,.07);
}

.danger-zone p {
    color: var(--text-muted);
    margin: .5rem 0 1rem;
    font-size: .9rem;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        flex-direction: row;
        justify-content: space-around;
        padding: 0.5rem 1rem;
        border-radius: 0;
        border-top: 1px solid var(--glass-border);
        z-index: 1000;
        top: auto;
    }

    .logo {
        display: none; /* Hide logo on mobile bottom nav */
    }

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

    .nav-item {
        flex-direction: column;
        padding: 0.35rem;
        gap: 4px;
        font-size: 0.66rem;
        min-width: 48px;
    }

    .nav-item i {
        width: 20px;
        height: 20px;
    }

    .sidebar button {
        position: fixed;
        bottom: 85px;
        right: 20px;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
    }

    .sidebar button i {
        width: 28px;
        height: 28px;
    }

    .sidebar button span {
        display: none;
    }

    .main-content {
        padding-bottom: 80px;
    }

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

    .daily-board {
        grid-template-columns: 1fr;
    }

    .report-grid,
    .report-alerts {
        grid-template-columns: 1fr;
    }

    .grid {
        grid-template-columns: 1fr !important;
    }

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

    /* Table to Cards */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        background: rgba(255, 255, 255, 0.03);
        border-radius: 16px;
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid var(--glass-border);
    }

    td {
        border: none;
        padding: 0.5rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.875rem;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
        padding: 2rem 1.5rem;
    }
}
