/*
|--------------------------------------------------------------------------
| RentalAjay - Desktop Navigation Clean V4
|--------------------------------------------------------------------------
| Customer desktop:
| - Menu utama dibuat ringkas dan terkelompok.
| - Notifikasi, tema dan install menjadi action compact.
| - Keranjang + Pesan berdampingan.
| - Profil menjadi pill yang rapi, logout menjadi icon kecil.
|
| Seller/Admin desktop:
| - Tombol Pesan menyatu di topbar, tepat di samping profil seller.
| - Tidak ada floating chat.
*/

.admin-desktop-chat-label {
    display: none;
}

@media (min-width: 781px) {
    /* ================================================================
       CUSTOMER DESKTOP
       ================================================================ */
    body.customer-body .customer-header .container.nav-wrap {
        width: min(1500px, calc(100% - 40px));
        min-height: 72px;
        gap: 18px;
    }

    body.customer-body .customer-header .brand {
        flex: 0 0 auto;
        gap: 10px;
        white-space: nowrap;
    }

    body.customer-body .customer-header .brand-mark {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        border-radius: 12px;
    }

    body.customer-body .customer-header .main-nav {
        flex: 1 1 auto;
        min-width: 0;
        display: block;
    }

    body.customer-body .desktop-customer-nav {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 14px;
        min-width: 0;
    }

    body.customer-body .desktop-customer-primary {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        min-width: 0;
        padding: 4px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
    }

    body.customer-body .desktop-customer-primary > a {
        position: relative;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 8px 11px;
        border-radius: 10px;
        color: var(--muted);
        font-size: .84rem;
        font-weight: 780;
        line-height: 1;
        white-space: nowrap;
        text-decoration: none;
        transition: background .16s ease, color .16s ease, transform .16s ease;
    }

    body.customer-body .desktop-customer-primary > a:hover {
        color: var(--text);
        background: var(--surface-2);
        text-decoration: none;
    }

    body.customer-body .desktop-customer-primary > a.active {
        color: #fff;
        background: linear-gradient(135deg, #315ffd, #5b50e8);
        box-shadow: 0 6px 16px rgba(49, 95, 253, .18);
    }

    /* Hilangkan underline active lama dari style.css. */
    body.customer-body .customer-header .desktop-customer-primary > a.active::after {
        display: none !important;
        content: none !important;
    }

    body.customer-body .desktop-nav-count {
        min-width: 18px;
        height: 18px;
        display: inline-grid;
        place-items: center;
        padding: 0 5px;
        border-radius: 999px;
        background: rgba(49, 95, 253, .14);
        color: #315ffd;
        font-size: .66rem;
        font-weight: 900;
    }

    body.customer-body .desktop-customer-primary > a.active .desktop-nav-count {
        background: rgba(255,255,255,.2);
        color: #fff;
    }

    body.customer-body .desktop-customer-tools {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        flex: 0 0 auto;
    }

    body.customer-body .desktop-icon-action,
    body.customer-body .desktop-logout-button {
        position: relative;
        height: 40px;
        min-width: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 0 10px;
        border: 1px solid var(--border);
        border-radius: 11px;
        background: var(--surface);
        color: var(--muted);
        cursor: pointer;
        text-decoration: none;
        box-shadow: none;
        transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
    }

    body.customer-body .desktop-icon-action:hover,
    body.customer-body .desktop-logout-button:hover {
        color: var(--primary);
        border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
        background: color-mix(in srgb, var(--primary) 7%, var(--surface));
        text-decoration: none;
        transform: translateY(-1px);
    }

    body.customer-body .desktop-icon-action.active {
        color: var(--primary);
        border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
        background: color-mix(in srgb, var(--primary) 10%, var(--surface));
    }

    body.customer-body .desktop-icon-action svg,
    body.customer-body .desktop-logout-button svg,
    body.customer-body .desktop-commerce-button svg {
        width: 19px;
        height: 19px;
        flex: 0 0 19px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    body.customer-body .desktop-tool-label {
        font-size: .78rem;
        font-weight: 750;
        white-space: nowrap;
    }

    body.customer-body .desktop-action-badge,
    body.customer-body .desktop-commerce-badge {
        min-width: 18px;
        height: 18px;
        display: inline-grid;
        place-items: center;
        padding: 0 5px;
        border: 2px solid var(--surface);
        border-radius: 999px;
        color: #fff;
        background: #ef4444;
        font-size: .61rem;
        font-weight: 900;
        line-height: 1;
    }

    body.customer-body .desktop-action-badge {
        position: absolute;
        top: -6px;
        right: -6px;
    }

    body.customer-body .desktop-commerce-actions {
        display: inline-flex;
        align-items: center;
        padding: 3px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: var(--surface-2);
    }

    body.customer-body .desktop-commerce-button {
        position: relative;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 0 10px;
        border-radius: 10px;
        color: var(--text);
        font-size: .79rem;
        font-weight: 800;
        white-space: nowrap;
        text-decoration: none;
        transition: background .16s ease, color .16s ease;
    }

    body.customer-body .desktop-commerce-button + .desktop-commerce-button {
        margin-left: 2px;
    }

    body.customer-body .desktop-commerce-button:hover,
    body.customer-body .desktop-commerce-button.active {
        color: var(--primary);
        background: var(--surface);
        text-decoration: none;
    }

    body.customer-body .desktop-commerce-badge {
        border-width: 0;
        background: #315ffd;
    }

    body.customer-body .desktop-commerce-badge.is-cart {
        background: #315ffd;
    }

    body.customer-body .desktop-commerce-badge.is-chat {
        background: #7049ec;
    }

    body.customer-body .desktop-profile-pill {
        min-width: 0;
        max-width: 180px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        gap: 9px;
        padding: 4px 10px 4px 5px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--surface);
        color: var(--text);
        text-decoration: none;
    }

    body.customer-body .desktop-profile-pill:hover,
    body.customer-body .desktop-profile-pill.active {
        border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
        background: color-mix(in srgb, var(--primary) 6%, var(--surface));
        text-decoration: none;
    }

    body.customer-body .desktop-profile-avatar {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        display: grid;
        place-items: center;
        border-radius: 50%;
        color: #fff;
        background: linear-gradient(135deg, #315ffd, #7049ec);
        font-size: .72rem;
        font-weight: 900;
    }

    body.customer-body .desktop-profile-copy {
        min-width: 0;
        display: flex;
        flex-direction: column;
        line-height: 1.05;
    }

    body.customer-body .desktop-profile-copy strong {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--text);
        font-size: .76rem;
        font-weight: 850;
    }

    body.customer-body .desktop-profile-copy small {
        margin-top: 4px;
        color: var(--muted);
        font-size: .64rem;
        font-weight: 650;
    }

    body.customer-body .desktop-logout-form {
        display: inline-flex;
        margin: 0;
    }

    body.customer-body .desktop-logout-button {
        padding: 0;
        color: #c74b43;
    }

    /* Main-nav lama yang khusus customer tidak dipakai lagi pada desktop. */
    body.customer-body .desktop-chat-nav,
    body.customer-body .customer-nav-user,
    body.customer-body .main-nav > .nav-utility-button,
    body.customer-body .main-nav > .cart-link {
        display: none !important;
    }

    /* ================================================================
       SELLER / ADMIN DESKTOP
       ================================================================ */
    body.admin-body .admin-topbar {
        min-height: 70px;
        padding-inline: 20px;
        gap: 12px;
    }

    body.admin-body .admin-mobile-header-actions {
        display: flex !important;
        align-items: center;
        gap: 8px;
        margin-left: auto;
        margin-right: 0;
    }

    body.admin-body .admin-mobile-header-actions .admin-mobile-profile-button {
        display: none !important;
    }

    body.admin-body .admin-mobile-header-actions .admin-mobile-chat-button {
        width: auto !important;
        height: 42px !important;
        min-width: 42px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0 12px !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        background: var(--surface) !important;
        color: var(--primary) !important;
        box-shadow: none !important;
        text-decoration: none;
    }

    body.admin-body .admin-mobile-header-actions .admin-mobile-chat-button:hover {
        background: color-mix(in srgb, var(--primary) 7%, var(--surface)) !important;
        text-decoration: none;
    }

    body.admin-body .admin-desktop-chat-label {
        display: inline;
        color: inherit;
        font-size: .8rem;
        font-weight: 800;
    }

    body.admin-body .admin-topbar-user {
        min-height: 46px;
        display: flex !important;
        align-items: center;
        gap: 9px;
        padding: 4px 10px 4px 5px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--surface);
    }

    body.admin-body .admin-topbar-user .admin-avatar {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        border-radius: 50%;
    }

    body.admin-body .admin-topbar-user strong {
        max-width: 155px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .8rem;
    }

    body.admin-body .admin-topbar-user span:not(.admin-avatar) {
        font-size: .66rem;
    }
}

/* Desktop sempit: pertahankan semua fungsi, tetapi hemat ruang. */
@media (min-width: 781px) and (max-width: 1220px) {
    body.customer-body .customer-header .container.nav-wrap {
        width: calc(100% - 24px);
        gap: 10px;
    }

    body.customer-body .customer-header .brand {
        font-size: 1rem;
    }

    body.customer-body .customer-brand-label,
    body.customer-body .desktop-tool-label,
    body.customer-body .desktop-profile-copy {
        display: none !important;
    }

    body.customer-body .desktop-customer-nav {
        gap: 7px;
    }

    body.customer-body .desktop-customer-primary > a {
        padding-inline: 8px;
        font-size: .75rem;
    }

    body.customer-body .desktop-profile-pill {
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 3px;
        justify-content: center;
    }

    body.customer-body .desktop-commerce-button span {
        display: none;
    }

    body.customer-body .desktop-commerce-button {
        width: 38px;
        padding: 0;
    }

    body.admin-body .admin-desktop-chat-label {
        display: none;
    }

    body.admin-body .admin-mobile-header-actions .admin-mobile-chat-button {
        width: 42px !important;
        padding: 0 !important;
    }
}

html[data-theme="dark"] body.customer-body .desktop-customer-primary,
html[data-theme="dark"] body.customer-body .desktop-commerce-actions,
html[data-theme="dark"] body.customer-body .desktop-icon-action,
html[data-theme="dark"] body.customer-body .desktop-profile-pill,
html[data-theme="dark"] body.customer-body .desktop-logout-button,
html[data-theme="dark"] body.admin-body .admin-topbar-user,
html[data-theme="dark"] body.admin-body .admin-mobile-header-actions .admin-mobile-chat-button {
    border-color: #2f405a !important;
    background: #111b2d !important;
}

html[data-theme="dark"] body.customer-body .desktop-customer-primary > a:hover,
html[data-theme="dark"] body.customer-body .desktop-commerce-button:hover,
html[data-theme="dark"] body.customer-body .desktop-commerce-button.active,
html[data-theme="dark"] body.customer-body .desktop-icon-action:hover,
html[data-theme="dark"] body.customer-body .desktop-profile-pill:hover,
html[data-theme="dark"] body.customer-body .desktop-profile-pill.active {
    background: #18243a;
}

html[data-theme="dark"] body.customer-body .desktop-customer-primary > a.active {
    background: linear-gradient(135deg, #315ffd, #6550eb) !important;
    color: #fff !important;
}

html[data-theme="dark"] body.customer-body .desktop-profile-copy strong,
html[data-theme="dark"] body.customer-body .desktop-commerce-button {
    color: #e8eef8;
}

/* HP tetap menggunakan header mobile yang sudah disetujui user. */
@media (max-width: 780px) {
    body.customer-body .desktop-customer-nav,
    body.admin-body .admin-desktop-chat-label {
        display: none !important;
    }
}

/* Pastikan bubble chat lama tidak pernah mengambang lagi setelah action masuk header. */
.rp-chat-floating-stack,
.rp-chat-floating-stack.rp-mobile-action-dock,
body.customer-body .rp-chat-floating-stack,
body.admin-body .rp-chat-floating-stack {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
