/* Layout System (Sidebar and Topbar) - Refined SaaS Style */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--background);
}

/* Sidebar Styling - Fintech Elite */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: 100px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    font-family: 'Poppins', sans-serif;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.sidebar-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.sidebar-group-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 32px 16px 12px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav-item:hover {
    background-color: var(--sidebar-hover);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text) !important;
}

.sidebar-nav-item.active .sidebar-nav-label {
    color: var(--sidebar-active-text) !important;
}

.sidebar-nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.active .sidebar-nav-icon {
    opacity: 1;
    color: var(--sidebar-active-text) !important;
}

.sidebar-footer {
    padding: 24px 16px;
    border-top: 1px solid var(--border);
}

.logout-link {
    color: var(--danger) !important;
}

.logout-link:hover {
    background-color: #FEF2F2 !important;
}

/* Main Area Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar Styling - Fintech Elite */
.topbar {
    height: 100px;
    background-color: var(--surface);
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 48px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.topbar-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.03em;
}

.topbar-search {
    flex: 1;
    max-width: 520px;
    padding: 0 var(--sp-6);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    height: 48px;
    background-color: var(--background);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 0 20px 0 48px;
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-input:focus {
    background-color: var(--surface);
    box-shadow: 0 0 0 4px rgba(79, 106, 246, 0.1);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

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

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: var(--danger);
    border: 2px solid var(--surface);
    border-radius: 50%;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 6px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.user-menu:hover {
    background-color: var(--background);
}

.user-avatar-modern {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.user-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.user-role {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.dropdown-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* Page Content */
.dashboard-container {
    padding: var(--sp-8);
    flex: 1;
}

/* Mobile Adjustments */
.mobile-toggle {
    display: none;
    padding: 8px;
    border-radius: var(--radius-md);
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-101%);
    }

    .sidebar.open,
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar-search {
        display: none;
    }

    .hide-mobile {
        display: none !important;
    }

    .topbar {
        height: 82px;
        padding: 0 20px;
    }

    .topbar-title {
        font-size: 22px;
    }

    .dashboard-container {
        padding: var(--sp-5);
    }
}

@media (max-width: 640px) {
    .topbar {
        height: 72px;
        padding: 0 12px;
    }

    .topbar-left {
        gap: 12px;
    }

    .topbar-title {
        font-size: 18px;
    }

    .user-menu {
        gap: 8px;
        padding: 4px 6px;
    }

    .user-avatar-modern {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 13px;
    }

    .dashboard-container {
        padding: var(--sp-4);
    }
}

/* Modern Dropdown Menus */
.quick-create-wrapper,
.user-menu-wrapper {
    position: relative;
}

.dropdown-menu-modern {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-premium), 0 0 0 1px var(--border);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.dropdown-menu-modern.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 12px 16px 8px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: var(--background);
    color: var(--primary);
    transform: translateX(4px);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border);
    margin: 8px;
}

.dropdown-item i {
    opacity: 0.7;
}

.dropdown-item:hover i {
    opacity: 1;
    color: var(--primary);
}

.user-dropdown {
    width: 260px;
}

[data-theme='dark'] .dropdown-menu-modern {
    background: #0f172a;
    border: 1px solid #334155;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

[data-theme='dark'] .dropdown-item:hover {
    background-color: rgba(51, 65, 85, 0.55);
    color: #a5b4fc;
}

[data-theme='dark'] .dropdown-divider {
    background-color: #334155;
}