/**
 * Loan Management System (loan-mgt) - Professional Business Stylesheet
 * Strict Phase 1: Pure Solid Colors, Zero Gradients, Minimalist & Enterprise Look
 */

:root {
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-border: #334155;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 76px;
    
    --topbar-height: 64px;
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;
    
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-active: #1e40af;
}

/* Base resets & typography */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
#app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

/* ----------------------------------------------------
   SIDEBAR
---------------------------------------------------- */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: width 0.25s ease-in-out, transform 0.25s ease-in-out;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid #1e293b;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.025em;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-menu {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.sidebar-menu::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.brand-icon {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #64748b;
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
    white-space: nowrap;
}

.sidebar-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.85rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.925rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.sidebar-link i {
    font-size: 1.2rem;
    margin-right: 0.85rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

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

.sidebar-item.active .sidebar-link {
    background-color: var(--primary-color);
    color: #ffffff;
}

.sidebar-link.disabled {
    opacity: 0.6;
    cursor: default;
    pointer-events: auto; /* allows tooltips */
}

.sidebar-link.disabled:hover {
    background-color: transparent;
    color: var(--sidebar-text);
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    background-color: #334155;
    color: #cbd5e1;
}

.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid #1e293b;
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
}

/* ----------------------------------------------------
   COLLAPSED SIDEBAR (DESKTOP)
---------------------------------------------------- */
body.sidebar-collapsed #sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand span,
body.sidebar-collapsed .sidebar-heading,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .sidebar-badge,
body.sidebar-collapsed .sidebar-footer {
    display: none !important;
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem 0;
}

body.sidebar-collapsed .sidebar-link i {
    margin-right: 0;
}

body.sidebar-collapsed #main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* ----------------------------------------------------
   MAIN WRAPPER & TOPBAR
---------------------------------------------------- */
#main-wrapper {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s ease-in-out;
    background-color: var(--body-bg);
}

#top-navbar {
    height: var(--topbar-height);
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--card-border);
    background-color: #f1f5f9;
}

.avatar-img-lg {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
    background-color: #f1f5f9;
}

.user-nav-dropdown {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text-main);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.user-nav-dropdown:hover,
.user-nav-dropdown:focus {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.user-nav-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.user-nav-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-nav-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ----------------------------------------------------
   CONTENT AREA & CARDS
---------------------------------------------------- */
#content-area {
    padding: 1.75rem 1.5rem;
    flex-grow: 1;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

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

.card-body {
    padding: 1.25rem;
}

/* Solid Professional Buttons */
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
    font-weight: 500;
    border-radius: 6px;
    padding: 0.55rem 1.25rem;
    box-shadow: none !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

.btn-primary:active {
    background-color: var(--primary-active) !important;
    border-color: var(--primary-active) !important;
}

.btn-outline-secondary {
    border-color: #cbd5e1;
    color: #475569;
    font-weight: 500;
    border-radius: 6px;
}

.btn-outline-secondary:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

.btn-danger {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    border-radius: 6px;
    font-weight: 500;
}

.btn-danger:hover {
    background-color: #b91c1c !important;
    border-color: #b91c1c !important;
}

/* Badges */
.badge-role {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 600;
    border-radius: 4px;
    text-transform: capitalize;
}

.badge-role-admin {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-role-manager {
    background-color: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.badge-role-loan_officer {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.badge-role-collector {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-status-active {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-status-completed {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.badge-status-paid {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-status-partial {
    background-color: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.badge-status-overdue {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-status-inactive {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.badge-status-draft {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.badge-status-pending {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-status-approved {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-status-rejected {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-status-cancelled {
    background-color: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* Form Controls */
.form-control, .form-select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    color: #1e293b;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 0.35rem;
}

/* Auth Cards (Login / Forgot Password) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    padding: 2.25rem 2rem;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.75rem;
    text-align: center;
}

.auth-brand-icon {
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

/* Footer */
#main-footer {
    border-top: 1px solid var(--topbar-border);
    background-color: #ffffff;
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    color: #64748b;
    margin-top: auto;
}

/* ----------------------------------------------------
   MOBILE & RESPONSIVE BEHAVIOR
---------------------------------------------------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}

@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    
    body.sidebar-mobile-open #sidebar {
        transform: translateX(0);
    }
    
    body.sidebar-mobile-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }
    
    #main-wrapper {
        margin-left: 0 !important;
    }
    
    .navbar-page-title {
        font-size: 1rem;
    }
}
.card{
    box-shadow: inset -2px -3px 10px #242424a1 !important;
}