/* ============================================================
   FinTrackGo - Main Stylesheet
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --fm-primary: #2c3e50;
    --fm-primary-light: #34495e;
    --fm-accent: #3498db;
    --fm-accent-hover: #2980b9;
    --fm-success: #27ae60;
    --fm-warning: #f39c12;
    --fm-danger: #e74c3c;
    --fm-purple: #6f42c1;
    --fm-purple-light: #8b5fd6;
    --fm-muted: #6c757d;
    --fm-bg: #f8f9fa;
    --fm-card-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    --fm-card-radius: 12px;
    --fm-sidebar-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    --fm-navbar-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* --- Base --- */
body {
    background-color: var(--fm-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Navbar --- */
.navbar {
    background: linear-gradient(135deg, var(--fm-primary) 0%, var(--fm-primary-light) 100%);
    box-shadow: var(--fm-navbar-shadow);
}

/* --- Sidebar --- */
.sidebar {
    background: white;
    min-height: calc(100vh - 56px);
    box-shadow: var(--fm-sidebar-shadow);
}

.sidebar .nav-link {
    color: var(--fm-muted);
    padding: 12px 20px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: var(--fm-accent);
    background: var(--fm-bg);
    border-left-color: var(--fm-accent);
}

.sidebar .nav-link i {
    width: 24px;
    margin-right: 10px;
}

/* --- Cards --- */
.card {
    border: none;
    border-radius: var(--fm-card-radius);
    box-shadow: var(--fm-card-shadow);
    transition: transform 0.2s;
}

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

/* Chevron rotation for collapse toggles */
[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.2s ease;
}
[data-bs-toggle="collapse"]:not(.collapsed) .bi-chevron-down {
    transform: rotate(180deg);
}

/* --- Sidebar "N more" toggles --- */
.nav-more-toggle {
    padding: 6px 20px !important;
    font-size: 0.8rem;
    border-left-color: transparent !important;
}
.nav-more-toggle:hover {
    background: transparent !important;
    border-left-color: transparent !important;
    color: var(--fm-accent) !important;
}
.nav-more-toggle .bi-three-dots {
    width: 24px;
    margin-right: 10px;
    font-size: 1rem;
}
.nav-more-label {
    font-style: italic;
    opacity: 0.7;
}
.nav-more-toggle[aria-expanded="true"] .nav-more-label {
    opacity: 0.4;
}

/* Card fade-in animation */
@keyframes fm-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fm-fade-in 0.3s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    .card {
        animation: none;
    }
}

/* Standardized card header styles */
.card-header {
    border-radius: var(--fm-card-radius) var(--fm-card-radius) 0 0 !important;
}

/* --- Stat Cards --- */
.stat-card {
    padding: 20px;
}

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

.stat-card .value {
    font-size: 28px;
    font-weight: 600;
    color: var(--fm-primary);
}

.stat-card .label {
    color: var(--fm-muted);
    font-size: 14px;
}

/* --- Buttons --- */
.btn-primary {
    background: var(--fm-accent);
    border: none;
}

.btn-primary:hover {
    background: var(--fm-accent-hover);
}

/* --- Purple Utility Classes --- */
.bg-fm-purple {
    background-color: var(--fm-purple) !important;
}

.text-fm-purple {
    color: var(--fm-purple) !important;
}

.btn-fm-purple {
    background-color: var(--fm-purple);
    color: white;
    border: none;
}

.btn-fm-purple:hover {
    background-color: var(--fm-purple-light);
    color: white;
}

.border-fm-purple {
    border-color: var(--fm-purple) !important;
}

.badge-fm-purple {
    background-color: var(--fm-purple);
    color: white;
}

/* --- Progress Bars --- */
.progress {
    height: 8px;
    border-radius: 4px;
}

/* --- Tables --- */
.table th {
    font-weight: 600;
    color: var(--fm-muted);
    border-bottom: 2px solid #dee2e6;
}

/* --- DTI Badge --- */
.badge-dti {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
}

/* --- Content Wrapper --- */
.content-wrapper {
    padding: 30px;
}

/* --- Toast Notifications --- */
.toast-container {
    z-index: 1090;
}

.toast-container .toast {
    min-width: 300px;
}

/* --- Mobile Hamburger Button --- */
.btn-sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.btn-sidebar-toggle:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* --- Offcanvas Sidebar (Mobile) --- */
.offcanvas-sidebar {
    max-width: 280px;
}

.offcanvas-sidebar .nav-link {
    color: var(--fm-muted);
    padding: 10px 16px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.offcanvas-sidebar .nav-link:hover,
.offcanvas-sidebar .nav-link.active {
    color: var(--fm-accent);
    background: var(--fm-bg);
    border-left-color: var(--fm-accent);
}

.offcanvas-sidebar .nav-link i {
    width: 24px;
    margin-right: 10px;
}

/* --- Responsive --- */
@media (max-width: 767.98px) {
    .sidebar {
        display: none;
    }

    .content-wrapper {
        padding: 15px;
    }
}

/* --- Mobile FAB Stacking --- */
@media (max-width: 767.98px) {
    .fab-receipt {
        bottom: 24px;
        right: 24px;
        z-index: 1050;
    }

    .fab-chat {
        bottom: 96px;
        right: 24px;
        z-index: 1060;
    }
}

@media (min-width: 768px) {
    .fab-chat {
        bottom: 24px;
        right: 96px;
        z-index: 1060;
    }
}
