:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --accent-color: #06b6d4;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.3);
    --input-bg: #ffffff;
    --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.08);
    --shadow-md: 0 8px 24px rgba(99, 102, 241, 0.12);
    --shadow-lg: 0 20px 60px rgba(99, 102, 241, 0.15);
    --shadow-xl: 0 25px 80px rgba(99, 102, 241, 0.2);
    --font-family: 'Outfit', sans-serif;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-main);
    min-height: 100vh;
}

/* Background Shapes */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4), transparent);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.4), transparent);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.3), transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(30px, 30px);
    }

    50% {
        transform: translate(0, 60px);
    }

    75% {
        transform: translate(-30px, 30px);
    }
}

/* Login Card Overrides */
.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 28px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 90px rgba(99, 102, 241, 0.25);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    color: white;
    margin: 0 auto;
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.3);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-icon:hover {
    transform: rotate(10deg) scale(1.1);
    box-shadow: 0 20px 45px rgba(99, 102, 241, 0.4);
}

/* Bootstrap Form Overrides */
.form-control,
.input-group-text,
.form-select {
    border-color: #e2e8f0;
    padding: 0.85rem 1.1rem;
    transition: all 0.3s ease;
    background-color: var(--input-bg);
    box-shadow: var(--shadow-sm);
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), var(--shadow-md);
    border-color: var(--primary-color);
    background-color: #fff;
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary-color);
    color: var(--primary-color) !important;
    background-color: #f8fafc !important;
    box-shadow: var(--shadow-sm);
}

.input-group-text {
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

/* Dark Theme Inputs (For Dashboard) */
.form-control.bg-dark,
.form-select.bg-dark {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.form-control.bg-dark:focus,
.form-select.bg-dark:focus {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

.form-control.bg-dark:disabled,
.form-control.bg-dark[readonly] {
    background-color: rgba(15, 23, 42, 0.3) !important;
    opacity: 0.8;
    cursor: default;
    border-color: rgba(255, 255, 255, 0.05);
}

.form-control.bg-dark::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Hide Number Input Spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #db2777 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #10b981);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4);
}

/* Text color for links */
.text-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Sidebar Styles */
.bg-glass {
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.nav-pills .nav-link.active,
.nav-pills .show>.nav-link {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
    border-left: 4px solid var(--secondary-color);
    color: var(--secondary-color);
    font-weight: 600;
    border-radius: 0 8px 8px 0;
}

.nav-link {
    color: var(--text-muted);
    transition: all 0.3s;
    border-left: 4px solid transparent;
    margin-bottom: 4px;
}

.nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.logo-icon-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    color: white;
}

.w-25px {
    width: 25px;
    text-align: center;
}

.hover-danger:hover {
    background-color: rgba(220, 53, 69, 0.2) !important;
    color: #ff6b6b !important;
}

.transition-all {
    transition: all 0.3s ease;
}

/* Financial List Items */
.financial-list .border-bottom {
    border-color: rgba(255, 255, 255, 0.05) !important;
}

.hover-bg-light:hover {
    background-color: rgba(255, 255, 255, 0.03);
    transform: translateX(5px);
}

/* Modal Icon */
.modal-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    box-shadow: var(--shadow-md);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -40px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.fade-in-down {
    animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hover-scale {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-scale:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.15) !important;
}

/* Mobile Specific Adjustments */
@media (max-width: 767.98px) {
    .sidebar {
        background-color: #0f172a !important;
    }

    .input-group-text {
        background-color: #f8fafc;
    }

    /* Dark Theme Inputs (For Dashboard) */
    .form-control.bg-dark,
    .form-select.bg-dark {
        background-color: rgba(15, 23, 42, 0.6) !important;
        border-color: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .form-control.bg-dark:focus,
    .form-select.bg-dark:focus {
        background-color: rgba(15, 23, 42, 0.8) !important;
        border-color: var(--primary-color);
        color: white;
        box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
    }

    .form-control.bg-dark:disabled,
    .form-control.bg-dark[readonly] {
        background-color: rgba(15, 23, 42, 0.3) !important;
        opacity: 0.8;
        cursor: default;
        border-color: rgba(255, 255, 255, 0.05);
    }

    .form-control.bg-dark::placeholder {
        color: rgba(255, 255, 255, 0.3);
    }

    /* Buttons */
    .btn-primary {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        border: none;
        transition: all 0.3s;
        box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
    }

    .btn-primary:hover {
        background: linear-gradient(135deg, var(--primary-hover) 0%, #db2777 100%);
        transform: translateY(-2px);
        box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
    }

    .btn-success {
        background: linear-gradient(135deg, #10b981, #059669);
        border: none;
        transition: all 0.3s;
        box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
    }

    .btn-success:hover {
        background: linear-gradient(135deg, #059669, #10b981);
        transform: translateY(-2px);
        box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4);
    }

    /* Sidebar Styles */
    .bg-glass {
        background: rgba(15, 23, 42, 0.95);
        border-right: 1px solid var(--glass-border);
        backdrop-filter: blur(10px);
    }

    .nav-pills .nav-link.active,
    .nav-pills .show>.nav-link {
        background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
        border-left: 4px solid var(--secondary-color);
        color: var(--secondary-color);
        font-weight: 600;
        border-radius: 0 8px 8px 0;
    }

    .nav-link {
        color: var(--text-muted);
        transition: all 0.3s;
        border-left: 4px solid transparent;
        margin-bottom: 4px;
    }

    .nav-link:hover {
        color: white;
        background-color: rgba(255, 255, 255, 0.05);
        transform: translateX(5px);
    }

    .logo-icon-small {
        width: 32px;
        height: 32px;
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        border-radius: 8px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 16px;
        color: white;
    }

    .w-25px {
        width: 25px;
        text-align: center;
    }

    .hover-danger:hover {
        background-color: rgba(220, 53, 69, 0.2) !important;
        color: #ff6b6b !important;
    }

    .transition-all {
        transition: all 0.3s ease;
    }

    /* Financial List Items */
    .financial-list .border-bottom {
        border-color: rgba(255, 255, 255, 0.05) !important;
    }

    .hover-bg-light:hover {
        background-color: rgba(255, 255, 255, 0.03);
        transform: translateX(5px);
    }

    /* Modal Icon */
    .modal-icon {
        width: 60px;
        height: 60px;
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
        color: var(--primary-color);
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 28px;
        box-shadow: var(--shadow-md);
    }

    .content-wrapper {
        padding-top: 20px;
    }

    .login-card {
        margin: 0 15px;
    }
}

/* Desktop Sidebar Sticky */
@media (min-width: 768px) {
    .sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        z-index: 1020;
    }

    /* Custom Scrollbar for Sidebar */
    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-track {
        background: rgba(15, 23, 42, 0.5);
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(99, 102, 241, 0.3);
        border-radius: 3px;
    }

    .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(99, 102, 241, 0.5);
    }
}

/* Mobile Sidebar Fix - Make logout button accessible */
@media (max-width: 767.98px) {
    .offcanvas-body {
        overflow-y: auto !important;
        overflow-x: hidden;
        max-height: calc(100vh - 80px);
        padding-bottom: 0.5rem;
    }

    .offcanvas-body::-webkit-scrollbar {
        width: 4px;
    }

    .offcanvas-body::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
    }

    .offcanvas-body::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
    }
}


/* =========================================
   Custom Premium Sidebar Styles (Light/Glass)
   ========================================= */
.sidebar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.03);
}

.sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.sidebar .offcanvas-title {
    color: var(--text-main) !important;
}

.nav-link-custom {
    color: var(--text-muted) !important;
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    font-weight: 500;
    text-decoration: none;
}

.nav-link-custom:hover {
    background: rgba(99, 102, 241, 0.08);
    /* Primary color low opacity */
    color: var(--primary-color) !important;
    transform: translateX(5px);
    border-color: rgba(99, 102, 241, 0.1);
}

.nav-link-custom.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    border: none;
}

.nav-link-custom i {
    transition: transform 0.3s ease;
}

.nav-link-custom:hover i {
    transform: scale(1.1);
}

.nav-section-title {
    color: var(--text-muted);
    opacity: 0.8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-left: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

/* Scrollbar for sidebar */
.sidebar-body::-webkit-scrollbar {
    width: 5px;
}

.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.sidebar-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Logout Button */
.btn-logout-custom {
    background: #fff;
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.8rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-logout-custom:hover {
    background: #fff0f0;
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

/* Sidebar Accordion Animations */
.nav-link-custom[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

.nav-link-custom[aria-expanded="true"] {
    color: var(--primary-color) !important;
    background: rgba(99, 102, 241, 0.05);
}

.transition-transform {
    transition: transform 0.3s ease;
}

.nav-link-custom[data-bs-toggle="collapse"]::after {
    display: none;
}

/* Submenu indentation marker */
.collapse .nav-link-custom {
    position: relative;
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 0 12px 12px 0;
    margin-left: 12px;
    background: transparent;
}

.collapse .nav-link-custom:hover {
    border-left-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

/* =========================================
   Sidebar Collapsed State (Mini Mode)
   ========================================= */
@media (min-width: 768px) {
    .sidebar {
        transition: width 0.3s ease, flex 0.3s ease;
    }

    .sidebar.collapsed {
        width: 80px !important;
        flex: 0 0 80px !important;
    }

    .sidebar.collapsed .nav-link-custom span,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .logo-text,
    .sidebar.collapsed .fa-chevron-down,
    .sidebar.collapsed .btn-logout-custom span,
    .sidebar.collapsed .btn-logout-custom i.me-2 {
        display: none !important;
    }

    .sidebar.collapsed .btn-logout-custom i {
        margin-right: 0 !important;
    }

    .sidebar.collapsed .nav-link-custom {
        justify-content: center !important;
        padding-left: 0;
        padding-right: 0;
        text-align: center;
    }

    .sidebar.collapsed .nav-link-custom i {
        margin: 0 !important;
        font-size: 1.2rem;
    }

    .sidebar.collapsed .logo-link {
        justify-content: center !important;
    }

    .sidebar.collapsed .logo-icon-small {
        margin-right: 0 !important;
    }

    /* Center logout button content */
    .sidebar.collapsed .btn-logout-custom {
        padding: 0.8rem 0;
    }

    .sidebar.collapsed .nav-section-title {
        height: 10px;
        /* Keep some space but hide text */
        margin-top: 1rem;
        position: relative;
    }

    .sidebar.collapsed .nav-section-title::after {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 40px;
        height: 1px;
        background: rgba(0, 0, 0, 0.1);
        display: block;
    }
}