/* ========================================
   FINANCETRACKER STYLES
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Layout */
    --navbar-height: 50px;
    --sidebar-width: 180px;
    --sidebar-collapsed-width: 50px;

    /* Colors */
    --primary-color: #000;
    --secondary-color: #666;
    --border-color: #ddd;
    --bg-color: #fff;
    --text-color: #000;
    --hover-bg: #f5f5f5;

    /* Typography */
    --font-family: system-ui, -apple-system, sans-serif;
    --font-size-base: 12px;
    --font-size-sm: 0.75rem;    /* 9px */
    --font-size-md: 0.8rem;    /* 9.6px */
    --font-size-lg: 0.875rem;  /* 10.5px */
    --font-size-xl: 0.9rem;    /* 10.8px */
    --line-height-base: 1.4;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    margin: 0;
    padding: 0;
    padding-top: var(--navbar-height);
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.5rem 0;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-md); }

p {
    margin: 0 0 1rem 0;
}

small {
    font-size: var(--font-size-sm);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Spacing Utilities */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }

/* Color Utilities */
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-muted { color: var(--secondary-color); }

.bg-primary { background-color: var(--primary-color); }
.bg-secondary { background-color: var(--secondary-color); }
.bg-light { background-color: var(--bg-color); }
.bg-hover { background-color: var(--hover-bg); }

/* Typography Utilities */
.font-weight-normal { font-weight: 400; }
.font-weight-medium { font-weight: 500; }
.font-weight-semibold { font-weight: 600; }
.font-weight-bold { font-weight: 700; }

.text-sm { font-size: var(--font-size-sm); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Display Utilities */
.d-flex { display: flex; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-start { justify-content: flex-start; }
.justify-content-end { justify-content: flex-end; }

/* Border Utilities */
.border { border: 1px solid var(--border-color); }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.border-left { border-left: 1px solid var(--border-color); }
.border-right { border-right: 1px solid var(--border-color); }

.rounded { border-radius: 4px; }
.rounded-sm { border-radius: 2px; }
.rounded-lg { border-radius: 6px; }
.rounded-circle { border-radius: 50%; }

/* Shadow Utilities */
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }

/* ========================================
   REUSABLE COMPONENTS
   ========================================
   These are generic, reusable CSS classes that can be used throughout the application.
   They follow a consistent design system and can be combined for flexible layouts.
   ======================================== */

/* Card Component - Use for content containers with consistent styling */
.card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 6px 6px 0 0;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 0 0 6px 6px;
}

/* Button Components - Consistent button styling across the app */
.btn {
    font-family: var(--font-family);
    font-size: var(--font-size-lg);
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    text-decoration: none;
    display: inline-block;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: 1px solid;
    cursor: pointer;
    text-align: center;
}

.btn-sm {
    font-size: var(--font-size-md);
    padding: 0.25rem 0.5rem;
}

.btn-lg {
    font-size: var(--font-size-xl);
    padding: 0.5rem 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-color);
}

.btn-primary:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.btn-secondary {
    background-color: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: var(--hover-bg);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--bg-color);
}

/* Form Components - Standardized form styling */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Layout Components - Flexible grid system */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

.col {
    flex: 1;
    padding: 0 0.5rem;
}

.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }

/* ========================================
   NAVIGATION
   ======================================== */

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-color);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 0 3rem;
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
}

.sidebar-toggle {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: var(--text-color);
    font-size: 1.1rem;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sidebar-toggle:hover {
    background-color: var(--hover-bg);
}

.user-dropdown-toggle {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--bg-color);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 1020;
    transition: width 0.3s ease;
}

.sidebar-content {
    padding: 0.5rem 0;
}

.sidebar-nav {
    padding: 0;
}

/* ========================================
   SIDEBAR COMPONENTS
   ======================================== */

/* Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--secondary-color);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--text-color);
    background-color: var(--hover-bg);
}

.sidebar-link.active {
    border-left-color: var(--primary-color);
}

.sidebar-link i {
    font-size: 1rem;
    width: 1rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.sidebar-text {
    flex: 1;
}

/* Sidebar Dividers */
.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0.75rem;
}

/* Sidebar Groups */
.sidebar-group {
    margin-bottom: 0.25rem;
}

/* Sidebar Group Headers */
.sidebar-group-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--secondary-color);
    text-decoration: none;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: var(--font-size-md);
    border-radius: 4px;
    margin: 0.125rem 0.25rem;
}

.sidebar-group-header:hover {
    color: var(--text-color);
    background-color: var(--hover-bg);
}

.sidebar-group-header i:first-child {
    font-size: 1rem;
    width: 1rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.sidebar-group-header .sidebar-text {
    flex: 1;
}

/* Sidebar Home Link */
.sidebar-home-link {
    margin: 0.125rem 0.25rem;
    border-radius: 4px;
    text-decoration: none;
}

.sidebar-home-link.active {
    border-left-color: var(--primary-color);
    background-color: var(--hover-bg);
}

/* Sidebar Chevron */
.sidebar-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.sidebar-chevron.collapsed {
    transform: rotate(-90deg);
}

/* Sidebar Group Content */
.sidebar-group-content {
    padding-left: 0.5rem;
}

.sidebar-group-content .sidebar-link {
    padding-left: 1.25rem;
    margin: 0.125rem 0.25rem;
    border-radius: 4px;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    padding: 1rem;
    transition: margin-left 0.3s ease;
}

/* ========================================
   COMPONENTS
   ======================================== */

/* Cards */
.welcome-card,
.feature-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin-bottom: 1rem;
}

.feature-card {
    text-align: center;
}

.feature-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Buttons - Using reusable .btn classes above */

/* Form Elements - Using reusable .form-control classes above */

/* ========================================
   MESSAGES
   ======================================== */

.messages-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    left: 1rem;
    z-index: 1050;
    max-width: 500px;
    margin: 0 auto;
}

.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
    line-height: 1.5;
    backdrop-filter: blur(8px);
    background-color: var(--bg-color);
    transition: all 0.3s ease;
}

.alert:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.alert .btn-close {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert .btn-close:hover {
    opacity: 1;
}

.alert i {
    font-size: 1.1rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Message types */
.alert-danger {
    border-left: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

.alert-warning {
    border-left: 4px solid #ffc107;
    background-color: rgba(255, 193, 7, 0.05);
}

.alert-success {
    border-left: 4px solid #198754;
    background-color: rgba(25, 135, 84, 0.05);
}

.alert-info {
    border-left: 4px solid #0dcaf0;
    background-color: rgba(13, 202, 240, 0.05);
}

/* ========================================
   AUTHENTICATION PAGES
   ======================================== */

.auth-page body {
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.auth-container {
    max-width: 400px;
    width: 100%;
    padding: 0 1rem;
}

.auth-container.auth-container-lg {
    max-width: 500px;
}

.auth-card {
    border: 1px solid var(--border-color);
    background: var(--bg-color);
}

.auth-header {
    background: var(--bg-color);
    color: var(--text-color);
    padding: 1.5rem 1rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.auth-header.auth-header-error {
    background: #fee;
    color: #c33;
}

.auth-body {
    padding: 1.5rem 1rem;
    background: var(--bg-color);
}

.auth-header h4 {
    margin-bottom: 0;
    color: var(--text-color);
}

.user-info {
    background-color: #f9f9f9;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-left: 2px solid var(--primary-color);
}

/* ========================================
   PASSWORD CHANGE PAGES
   ======================================== */

.password-change-header {
    background: var(--bg-color);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Mobile responsive messages */
@media (max-width: 768px) {
    .messages-container {
        left: 0.5rem;
        right: 0.5rem;
        top: calc(var(--navbar-height) + 0.5rem);
        max-width: none;
    }

    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .alert i {
        font-size: 1rem;
        margin-right: 0.375rem;
    }
}

/* Mobile responsive sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        width: 100%;
        height: calc(100vh - var(--navbar-height));
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1010;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ========================================
   COLLAPSED SIDEBAR
   ======================================== */

:root.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

:root.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-link {
    padding: 0.5rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-link .sidebar-text {
    display: none;
}

.sidebar.collapsed .sidebar-group-header {
    padding: 0.5rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-group-header .sidebar-text {
    display: none;
}

.sidebar.collapsed .sidebar-group-header .sidebar-chevron {
    display: none;
}

.sidebar.collapsed .sidebar-group-content {
    display: none;
}

.sidebar.collapsed .sidebar-divider {
    margin: 0.25rem 0.25rem;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* ========================================
   SIDEBAR TOOLTIPS
   ======================================== */

/* Tooltip Container */
.sidebar-tooltip {
    position: fixed;
    left: var(--sidebar-collapsed-width);
    top: 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    min-width: 180px;
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.sidebar-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* Tooltip Title */
.sidebar-tooltip-title {
    padding: 0.5rem 1rem 0.25rem;
    font-weight: 500;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
    font-size: var(--font-size-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tooltip Items */
.sidebar-tooltip-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.sidebar-tooltip-item:hover,
.sidebar-tooltip-item.active {
    color: var(--text-color);
    background-color: var(--hover-bg);
    border-left-color: var(--primary-color);
}

.sidebar-tooltip-item i {
    font-size: var(--font-size-md);
    width: var(--font-size-md);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

