/* HAMBIR - Dashboard Styles */

.dashboard-body {
    overflow: hidden; /* Prevent body scroll, handled by main-content */
}

.dashboard-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    z-index: 10;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item .icon {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: rgba(37, 99, 235, 0.1);
    color: white;
}

.nav-item:hover .icon {
    color: white;
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}
.nav-item.active .icon {
    color: white;
}

.sidebar-footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-color);
}

.nav-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    z-index: 5;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.search-input-wrap {
    position: relative;
    width: 300px;
    display: block;
}

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

.search-input-wrap input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-input-wrap input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.icon-btn .icon {
    width: 20px;
    height: 20px;
}

.user-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Hamburger + mobile sidebar toggle */
.hamburger-btn {
    display: none;
}

.sidebar-close {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 15;
}

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

/* Dropdown menus (notifications + account) */
.notif-wrap,
.user-avatar-wrap {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 300px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    display: none;
    z-index: 30;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-header {
    padding: 0.65rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.35rem;
}

.dropdown-header.account-id code {
    font-size: 0.7rem;
    color: var(--text-primary);
    word-break: break-all;
}

.dropdown-header button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.75rem;
    cursor: pointer;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.dropdown-item .icon {
    width: 18px;
    height: 18px;
}

.dropdown-item:hover {
    background: rgba(37, 99, 235, 0.08);
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--error-color);
}

.notif-list {
    max-height: 320px;
    overflow-y: auto;
}

.notif-empty {
    padding: 1rem 0.85rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.notif-item {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
}

.notif-item:hover {
    background: rgba(37, 99, 235, 0.06);
}

.notif-item.unread {
    background: rgba(37, 99, 235, 0.08);
}

.notif-item .notif-title {
    font-size: 0.85rem;
    font-weight: 600;
}

.notif-item .notif-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.notif-item .notif-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--error-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 999px;
}

/* Search suggestions */
.search-bar {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    overflow: hidden;
    z-index: 30;
}

.search-suggestions.active {
    display: block;
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: var(--text-primary);
}

.search-suggestion-item:hover {
    background: rgba(37, 99, 235, 0.08);
}

.search-suggestion-item img {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    object-fit: cover;
}

.search-suggestion-empty {
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Modals (Edit profile, Generate API key, etc.) */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h3 {
    font-size: 1.15rem;
    margin: 0;
}

.modal-header .icon-btn {
    font-size: 1.25rem;
    line-height: 1;
}


/* Responsive: tablets and phones */
@media (max-width: 1024px) {
    .hamburger-btn {
        display: flex;
    }

    .sidebar-close {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 20;
        width: 280px;
        max-width: 82vw;
    }

    /* "active" class toggled by JS when the hamburger icon is tapped */
    .sidebar.active {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .search-input-wrap {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        width: 250px;
        z-index: 40;
    }

    .search-input-wrap.active {
        display: block;
    }

    .search-toggle-btn {
        display: flex !important;
    }

    .mobile-topbar-name {
        display: none !important;
    }

    .topbar {
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .desktop-name {
        display: none;
    }

    .content-wrapper {
        padding: 1.25rem;
    }

    .dashboard-content,
    .profile-container {
        grid-template-columns: 1fr !important;
    }

    .dropdown-menu {
        right: -0.5rem;
        min-width: 220px;
    }
}

@media (max-width: 480px) {
    .search-input-wrap {
        width: 200px;
    }

    .modal-box {
        padding: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

