:root {
    --primary-color: #007BFF;
    --secondary-color: #5b6b8c;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f2f5fc;
    --dark-color: #343a40;
    --bg-light: #ffffff;
    --text-light: #1f2737;
    --border-light: #d7deeb;
    --sidebar-width: 260px;
    --topbar-height: 60px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: var(--text-light);
    transition: background-color 0.3s, color 0.3s;
}

/* Dark Mode */
body.dark-mode {
    --bg-light: #1a1a1a;
    --text-light: #ffffff;
    --border-light: #444;
    --light-color: #2d2d2d;
    background-color: #0f1419;
}

body.dark-mode .navbar {
    background-color: #1f3a5f !important;
}

body.dark-mode .navbar-page-title {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-mode .sidebar {
    background-color: #1a1a1a;
    border-right-color: #333;
}

body.dark-mode .sidebar-menu li a {
    color: #b0b0b0;
}

body.dark-mode .sidebar-menu li a:hover,
body.dark-mode .sidebar-menu li a.active {
    background-color: #2d2d2d;
    color: #ffffff;
}

body.dark-mode .main-wrapper {
    background-color: #0f1419;
}

body.dark-mode .card {
    background-color: #1a1a1a;
    border-color: #333;
}

body.dark-mode .metric-tile {
    background-color: rgba(0, 123, 255, 0.12);
    border-color: #333;
}

body.dark-mode .metric-tile .metric-value {
    color: #ffffff;
}

body.dark-mode .table {
    color: #ffffff;
}

body.dark-mode .modal-content {
    background-color: #1a1a1a;
    color: #ffffff;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #2d2d2d;
    color: #ffffff;
    border-color: #444;
}

body.dark-mode .breadcrumb {
    background-color: #1a1a1a;
}

/* Top Navigation Bar */
.navbar {
    height: var(--topbar-height);
    padding: 0 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1030;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.3rem;
}

.navbar-page-title {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 1rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .navbar-page-title {
        display: none !important;
    }
}

#themeToggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding-inline: 0.9rem;
}

#themeToggleLabel {
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

#themeToggle:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.35);
}

@media (max-width: 576px) {
    #themeToggleLabel {
        display: none;
    }
}

body.dark-mode #themeToggle {
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background-color: #ffffff;
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease-in-out;
    z-index: 1020;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem 1rem 1rem;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.sidebar-menu li a i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
}

.sidebar-menu li a:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.sidebar-menu li a.active {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    font-weight: 600;
}

.sidebar-divider {
    border-top: 1px solid var(--border-light);
    margin: 0.5rem 0;
}

.sidebar-heading {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #a0aec0;
    letter-spacing: 0.5px;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

/* Main Content Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    background-color: #f5f7fa;
    transition: margin-left 0.3s ease-in-out;
}

/* Breadcrumb */
.breadcrumb-container {
    background-color: #ffffff;
    padding: 1rem 1.5rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-light);
}

.breadcrumb {
    margin-bottom: 0;
    background-color: transparent;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
}

/* Main Content */
.main-content {
    padding: 1.5rem;
}

.main-content > * + * {
    margin-top: 1.5rem;
}

/* Sidebar Toggle States */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: 0;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--topbar-height));
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1015;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .breadcrumb-container {
        padding: 0.75rem 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
}

/* Cards */
.card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-light);
    background-color: var(--bg-light);
    margin-bottom: 0;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: 12px;
    color: white;
}

.content-section + .content-section {
    margin-top: 1.5rem;
}

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

.metric-tile {
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1rem;
    background-color: rgba(0, 123, 255, 0.04);
}

.metric-tile h6 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.metric-tile .metric-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-light);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Budget Progress */
.budget-progress {
    position: relative;
    height: 30px;
    background-color: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
}

.budget-progress-bar {
    height: 100%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.85rem;
}

/* Transaction Item */
.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s;
}

.transaction-item:hover {
    background-color: #f8f9fa;
}

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

.transaction-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.transaction-info {
    flex: 1;
}

.transaction-amount {
    font-size: 1.2rem;
    font-weight: bold;
}

.transaction-amount.income {
    color: var(--success-color);
}

.transaction-amount.expense {
    color: var(--danger-color);
}

/* Insight Cards */
.insight-card {
    padding: 1rem;
    border-left: 4px solid;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.insight-card.success {
    border-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.insight-card.warning {
    border-color: var(--warning-color);
    background-color: rgba(255, 193, 7, 0.1);
}

.insight-card.danger {
    border-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Floating Action Button */
.btn-floating {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    z-index: 1000;
    transition: all 0.3s;
}

.btn-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.5);
}

/* Category Badge */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Table */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid var(--border-light);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.empty-state i {
    font-size: 3.5rem;
    opacity: 0.25;
}

.empty-state p {
    margin: 0;
    max-width: 320px;
}

.empty-state .empty-action {
    margin-top: 0.5rem;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 0;
}

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

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Notification Badge */
.badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* Notification Item */
.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s;
    cursor: pointer;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: rgba(0, 123, 255, 0.05);
    font-weight: 500;
}

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

/* Responsive Adjustments */
@media (max-width: 992px) {
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .stat-icon {
        font-size: 2rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
    
    .btn-floating {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Family Member Card */
.member-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.member-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.member-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    margin-right: 1rem;
}

/* Export Page Styles */
.export-option {
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.export-option:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.export-option i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Activity Log Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-light);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.timeline-content {
    background-color: #ffffff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}
