/* HIMS global progress overlay + mobile-first layout */

/* ----- Progress overlay (master-level) ----- */
.hims-progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 200000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-sizing: border-box;
}

.hims-progress-overlay.is-visible {
    display: flex !important;
    pointer-events: auto !important;
}

html.hims-busy .hims-progress-overlay,
html.hims-busy .modal1 {
    pointer-events: auto !important;
}

.hims-progress-card {
    width: min(100%, 280px);
    background: #fff;
    border-radius: 16px;
    padding: 1.35rem 1.25rem 1.15rem;
    text-align: center;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.hims-progress-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 0 auto 0.75rem;
    display: block;
}

.hims-progress-text {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.85rem;
}

.hims-progress-text:empty,
.hims-progress-text[style*="display: none"],
.hims-progress-text[style*="display:none"] {
    display: none !important;
    margin: 0;
}

.hims-progress-bar {
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.hims-progress-bar-indeterminate {
    height: 100%;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, #10b981, #047857);
    animation: himsProgressSlide 1.1s ease-in-out infinite;
}

@keyframes himsProgressSlide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

html.hims-busy,
html.hims-busy body {
    cursor: progress;
}

/* Unify legacy per-page UpdateProgress look */
.modal1 {
    position: fixed !important;
    inset: 0 !important;
    z-index: 199990 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(15, 23, 42, 0.45) !important;
    opacity: 1 !important;
    filter: none !important;
}

.center1 {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%);
    margin: 0 !important;
    padding: 1rem 1.25rem !important;
    width: auto !important;
    min-width: 110px;
    background: #fff !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
    opacity: 1 !important;
}

.center1 img {
    width: 56px;
    height: 56px;
    display: block;
    margin: 0 auto;
}

/* ----- Mobile / responsive ----- */
@media (max-width: 991px) {
    .cpms-app .Maincontent,
    .cpms-app .cpms-page-content,
    .Maincontent {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.85rem 0.75rem 5.5rem !important;
        min-height: calc(100vh - 56px);
    }

    .cpms-app .default-layout-navbar {
        min-height: 56px;
    }

    .cpms-app .navbar-brand-wrapper {
        width: auto !important;
        min-width: 0 !important;
        padding-left: 0.35rem !important;
    }

    .cpms-app .cpms-product-brand-title {
        font-size: 0.95rem !important;
    }

    .cpms-app .cpms-product-brand-module {
        font-size: 0.65rem !important;
    }

    /* Keep logout reachable on phones */
    .cpms-app .navbar-nav .nav-logout,
    .cpms-app .navbar-nav .nav-settings {
        display: flex !important;
    }

    .cpms-app .navbar-nav .full-screen-link {
        display: none !important;
    }

    .cpms-app .sidebar {
        z-index: 1040;
    }

    .hims-page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        margin-bottom: 0.85rem;
    }

    .hims-page-head h3 {
        font-size: 1.15rem;
        line-height: 1.3;
    }

    .hims-page-head .hint {
        font-size: 0.85rem;
        max-width: none;
    }

    .hims-mode-pill {
        align-self: flex-start;
    }

    .hims-section {
        padding: 0.9rem 0.85rem 0.65rem;
        border-radius: 12px;
        margin-bottom: 0.75rem;
    }

    .hims-section-title {
        font-size: 0.9rem;
    }

    /* Stack Bootstrap columns on phones */
    .hims-section .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .hims-field .form-control,
    .hims-field select.form-control,
    .hims-field .form-control-sm,
    .hims-bs-combo .form-control,
    .hims-bs-combo .btn {
        min-height: 44px !important;
        height: auto !important;
        font-size: 16px !important; /* avoids iOS zoom on focus */
    }

    .hims-bs-combo .input-group-sm > .form-control,
    .hims-bs-combo .input-group-sm > .btn {
        height: 44px !important;
        min-height: 44px !important;
    }

    .hims-actions {
        position: sticky;
        bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
        gap: 0.5rem;
        padding: 0.7rem 0.75rem;
        margin: 0.35rem 0 0;
        border-radius: 12px;
    }

    .hims-actions .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
        min-height: 44px;
        padding: 0.55rem 0.75rem;
    }

    .hims-list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .hims-list-toolbar .hims-field,
    .hims-list-toolbar .hims-field.status-filter {
        flex: 1 1 auto;
        width: 100%;
    }

    .hims-grid-wrap {
        max-height: min(55vh, 380px);
        margin: 0 -0.15rem;
        border: 1px solid var(--cpms-border, #dbe3ee);
    }

    .hims-grid-wrap .table > thead > tr > th,
    .hims-grid-wrap .table > tbody > tr > td,
    .hims-grid-wrap table.table th,
    .hims-grid-wrap table.table td {
        font-size: 0.75rem;
        padding: 0.45rem 0.4rem;
        max-width: 9rem;
        white-space: nowrap;
    }

    .hims-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
        gap: 0.35rem;
    }

    .hims-tabs .btn {
        flex: 0 0 auto;
        min-height: 40px;
        white-space: nowrap;
    }

    .hims-check-list,
    .hims-check-list-h {
        max-height: 160px;
    }

    .hims-check-list-h table {
        display: block;
    }

    .hims-check-list-h tr {
        display: flex;
        flex-wrap: wrap;
    }

    .hims-check-list-h td {
        white-space: normal;
        padding: 0.35rem 0.65rem 0.35rem 0;
        flex: 1 1 46%;
        min-width: 140px;
    }

    .hims-check-list-h label {
        white-space: normal;
    }

    .hims-logo-box {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Sidebar profile text truncation */
    .sidebar .nav-profile-text {
        max-width: 140px;
    }
}

@media (max-width: 575px) {
    .cpms-app .Maincontent,
    .cpms-app .cpms-page-content {
        padding: 0.65rem 0.55rem 5.75rem !important;
    }

    .hims-actions .btn {
        flex: 1 1 100%;
    }

    .hims-page-head .page-title-icon {
        width: 1.75rem !important;
        height: 1.75rem !important;
    }
}

/* Touch-friendly hover equivalents */
@media (hover: none) and (pointer: coarse) {
    .hims-actions .btn,
    .hims-tabs .btn,
    .navbar-toggler {
        -webkit-tap-highlight-color: rgba(4, 120, 87, 0.15);
    }

    .hims-grid-wrap .table tbody tr:active {
        background: #ecfdf5 !important;
    }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hims-progress-bar-indeterminate {
        animation: none;
        width: 100%;
        opacity: 0.85;
    }
}
