/* Unified modal overlays, close buttons, and customer profile views */
.cms-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(2px);
    z-index: 999999;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.cms-modal-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

.cms-modal-overlay.cms-modal-nested,
body:has(.cms-modal-overlay.active:not(#customConfirmModal):not(#cmsSuccessModal)) #customConfirmModal.active,
body:has(.cms-modal-overlay.active:not(#customConfirmModal):not(#cmsSuccessModal)) #cmsSuccessModal.active {
    background-color: transparent !important;
    backdrop-filter: none !important;
}

.cms-modal-overlay.cms-modal-nested .cms-modal,
body:has(.cms-modal-overlay.active:not(#customConfirmModal):not(#cmsSuccessModal)) #customConfirmModal.active .cms-modal,
body:has(.cms-modal-overlay.active:not(#customConfirmModal):not(#cmsSuccessModal)) #cmsSuccessModal.active .cms-modal {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(212, 175, 55, 0.28);
}

.cms-modal {
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    margin: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(230, 223, 208, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(14px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.cms-modal-overlay.active .cms-modal {
    transform: translateY(0) scale(1);
}

.cms-modal-lg {
    max-width: 820px;
}

.cms-modal-admin-xl {
    max-width: 1360px;
}

.modal-heading {
    margin: 0;
    padding: 20px 50px 14px 26px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    border-bottom: 2px dashed #eeeeee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-heading i {
    color: var(--primary-dark);
}

.modal-close-btn-absolute,
.shop-modal-close,
.profile-modal-close-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: none;
    color: #999999;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.modal-close-btn-absolute:hover,
.shop-modal-close:hover,
.profile-modal-close-btn:hover {
    background: none;
    color: var(--primary);
    transform: scale(1.1);
}

.cms-modal-body {
    padding: 22px 26px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.auth-form-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    gap: 10px;
}

.profile-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 26px 14px;
    border-bottom: 2px dashed #eeeeee;
    background-color: #ffffff;
    flex-shrink: 0;
}

.profile-modal-header .modal-heading,
.profile-modal-header .profile-modal-title {
    border-bottom: none;
    padding: 0;
    margin: 0;
    margin-right: auto;
    min-width: 0;
    font-size: 1.2rem;
    line-height: 1.25;
}

.profile-modal-title-text {
    min-width: 0;
    overflow-wrap: break-word;
}

.profile-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.profile-modal-header .shop-modal-close,
.profile-modal-header .profile-modal-close-btn,
.profile-header-actions .shop-modal-close,
.profile-header-actions .profile-modal-close-btn {
    position: static;
    flex-shrink: 0;
}

.admin-mobile-menu-toggle {
    display: none;
}

.admin-mobile-menu-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.admin-mobile-menu-toggle-left > i {
    color: var(--primary-dark);
    flex-shrink: 0;
}

#adminMobileMenuLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-mobile-menu-chevron {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.admin-mobile-menu-toggle[aria-expanded="true"] {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.admin-mobile-menu-toggle[aria-expanded="true"] .admin-mobile-menu-chevron {
    transform: rotate(180deg);
    color: var(--primary-dark);
}

.admin-main-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.admin-tab-viewport {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.admin-tab-viewport:has(> #tabPanelMail:not(.d-none)) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-right: 0;
}

#tabPanelMail:not(.d-none) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.profile-modal-card .cms-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px 26px;
}

.profile-user-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: #fef9e7;
    border: 1px solid rgba(212, 175, 55, 0.35);
    flex-shrink: 0;
}

.profile-user-banner strong {
    color: var(--text-dark);
    font-size: 15px;
}

.btn-compact-pad {
    padding: 8px 15px;
    font-size: 13px;
}

.profile-section-heading {
    margin: 0 0 15px;
    color: var(--primary-dark);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-tabs-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.profile-modal-card .profile-tab-btn {
    flex: 1 1 0;
    min-width: 140px;
    justify-content: center;
    padding: 10px 15px;
}

.profile-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    background-color: #f4f6f8;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.profile-tab-btn:hover {
    background-color: #e9ecf0;
    border-color: transparent;
    color: var(--text-dark);
}

.profile-tab-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.28);
}

.orders-cards-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.order-summary-card {
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 18px 20px;
    background-color: var(--primary-light);
}

.order-summary-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(230, 223, 208, 0.85);
}

.order-summary-card-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-dark);
}

.order-summary-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-summary-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid rgba(230, 223, 208, 0.8);
}

.order-summary-item-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 14px;
    color: var(--text-dark);
}

.order-summary-item-icon {
    color: var(--primary-dark);
    font-size: 14px;
    flex-shrink: 0;
}

.order-summary-item-name {
    font-weight: 600;
    color: var(--text-dark);
}

.order-summary-item-qty {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.order-summary-item-action {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
}

.order-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.order-summary-meta {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e6dfd0;
    font-size: 13.5px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-summary-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (min-width: 769px) {
    #userProfileModal .cms-modal.profile-modal-card {
        width: min(92vw, 1000px);
        max-width: 1000px;
        height: min(90vh, 780px);
        height: min(90dvh, 780px);
    }
}

@media (max-width: 768px) {
    .cms-modal-overlay {
        padding: 10px;
    }

    .cms-modal {
        border-radius: 14px;
        max-height: 94vh;
        max-height: 94dvh;
    }

    .modal-heading {
        padding: 16px 44px 12px 18px;
        font-size: 1.08rem;
    }

    .cms-modal-body {
        padding: 16px 18px;
    }

    .profile-modal-header {
        padding: 14px 18px;
    }

    .order-summary-card {
        padding: 14px;
    }

    .order-summary-item {
        padding: 9px 12px;
    }

    .order-summary-item-action {
        margin-left: 0;
    }
}
