@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
    /* Original Colors */
    --primary-color: #6366f1;
    /* Indigo-500 */
    --secondary-color: #a855f7;
    /* Purple-500 */
    --bg-color: #0f172a;
    /* Slate-900 */
    --card-bg: rgba(30, 41, 59, 0.7);
    /* Slate-800 with opacity */
    --text-color: #f8fafc;
    /* Slate-50 */
    --text-muted: #94a3b8;
    /* Slate-400 */

    /* Premium Effects */
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Original Background Gradient */
    background: radial-gradient(circle at top left, #1e293b, #0f172a);
    background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

h1,
h2,
h3,
h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    margin-bottom: 0.5rem;
}

/* Glass Card Premium - Structure from Overhaul, Colors from Original */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
    /* Enhanced radius */
    padding: 2rem;
    width: 100%;
    margin-bottom: 2rem;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Form Elements */
input,
select,
button {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.8);
    /* Darker input bg */
    color: white;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

button[type="submit"],
.logout-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

/* Filter Buttons */
.filter-container {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 0;
    width: auto;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: var(--glass-border);
    padding: 1.75rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
}

.stat-info p {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}

th,
td {
    padding: 1rem;
    text-align: left;
}

th {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

td {
    background: rgba(255, 255, 255, 0.03);
    border: none;
    transition: background 0.2s;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.06);
}

tr td:first-child {
    border-radius: 10px 0 0 10px;
}

tr td:last-child {
    border-radius: 0 10px 10px 0;
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.badge-warning {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

.badge-credit {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

/* Transaction type badge */

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    text-align: center;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Logout Override */
.logout-btn {
    width: auto !important;
    padding: 0.6rem 1.2rem !important;
    background: transparent !important;
    border: 1px solid rgba(239, 68, 68, 0.5) !important;
    color: #fca5a5 !important;
    box-shadow: none !important;
    margin-top: 0 !important;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
}

/* Layout */
.dashboard-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-container {
    height: 300px;
    position: relative;
    width: 100%;
}

.action-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

/* Entry Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-container>* {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.stats-grid {
    animation-delay: 0.1s;
}

.glass-card {
    animation-delay: 0.2s;
}

/* Layout Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 50% 50% split */
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Mobile */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
    }

    .action-section {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .logout-btn {
        align-self: flex-start;
        margin-top: 1rem !important;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

/* Dropdown */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #1e293b;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    top: 60px;
    /* Adjust based on button height */
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    margin: 0;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s;
}

.close-modal:hover {
    color: white;
}

/* Settings Grid */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.3s;
}

.setting-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.setting-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.setting-info h3 {
    font-size: 1rem;
    margin: 0;
}

.setting-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-left: auto;
}

.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.2);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* Items List */
.items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.items-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.items-list li:last-child {
    border-bottom: none;
}

.delete-item-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    width: auto;
    margin: 0;
}

.delete-item-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Light Mode Variables */
body.light-mode {
    --bg-color: #f1f5f9;
    /* Slate-100 */
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-color: #0f172a;
    /* Slate-900 */
    --text-muted: #64748b;
    /* Slate-500 */
    --glass-border: 1px solid rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    background: #f1f5f9;
}

body.light-mode input,
body.light-mode select,
body.light-mode button {
    background: white;
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .stat-info h3,
body.light-mode .setting-info p,
body.light-mode th {
    color: #64748b;
}

body.light-mode td {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode tr:hover td {
    background: rgba(0, 0, 0, 0.05);
}

/* Login Page Specifics */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #1e293b, #0f172a);
}

.login-card {
    max-width: 400px;
    /* Constrain on desktop */
    width: 100%;
    margin: 0;
    padding: 3rem 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: none !important;
    /* Disable hover effect */
}

.login-card:hover {
    transform: none !important;
}

/* Mobile Overrides to fix Full Width Issues */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 0.75rem;
        /* Reduce padding to give more space */
        width: 100%;
        max-width: 100%;
    }

    .header {
        margin-bottom: 1.5rem;
    }

    /* Force Grid to Stack */
    .content-grid,
    .stats-grid,
    .action-section {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* Full Width Cards on Mobile */
    .glass-card,
    .stat-card {
        width: 100%;
        margin-bottom: 0;
        /* Let flex gap handle spacing */
        max-width: 100%;
    }

    .chart-container {
        height: 250px;
    }

    /* Login on Mobile */
    .login-card {
        max-width: 100%;
        border-radius: 0;
        height: 100vh;
        /* Optional: Full screen login on mobile */
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin: 0;
    }

    .table-container {
        margin-top: 0.5rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
        /* Compact table */
        font-size: 0.85rem;
    }
}