/* ========================================================================
   MMC Z27H83 — Mobile Foundation Pass 1
   Additive mobile-only UX overrides for Header, Main Editor, Timeline,
   Account/Albums, Flip Book Editor, menus/modals, and live chat clearance.
   Desktop (>820px non-coarse) is intentionally untouched.
   ======================================================================== */

body.mmc-z27h83-mobile,
body.mmc-z27h83-mobile #app,
body.mmc-z27h83-mobile #root {
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

body.mmc-z27h83-mobile * {
    -webkit-tap-highlight-color: rgba(127, 0, 0, .12);
}

/* ---------- Shared mobile header ---------- */
body.mmc-z27h83-mobile .header {
    position: relative !important;
    z-index: 2200 !important;
    width: 100% !important;
}

body.mmc-z27h83-mobile .header .navbar {
    min-height: 60px !important;
    padding: 5px 7px !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
}

body.mmc-z27h83-mobile .header .brand {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    margin-right: 5px !important;
}

body.mmc-z27h83-mobile .header img.headerLogo {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
}

body.mmc-z27h83-mobile .header .headerPoster,
body.mmc-z27h83-mobile .header .mmc-header-social-strip {
    display: none !important;
}

body.mmc-z27h83-mobile .header .navbar-collapse {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-basis: auto !important;
    justify-content: flex-end !important;
    align-items: center !important;
    min-width: 0 !important;
    margin-left: 4px !important;
    gap: 4px !important;
}

/* Hide desktop utility chips on a phone. Login remains because it is nested. */
body.mmc-z27h83-mobile .header .navbar-collapse > button.btn-light,
body.mmc-z27h83-mobile .header .navbar-collapse > a[href="/mmc_updates.php"],
body.mmc-z27h83-mobile .header .navbar-collapse > .mmc-publish-credit-label {
    display: none !important;
}

body.mmc-z27h83-mobile .header .mmc-buy-credits-header {
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 4px !important;
    padding: 4px 8px !important;
    font-size: 10px !important;
}

body.mmc-z27h83-mobile .header .btn-success {
    width: auto !important;
    min-width: 86px !important;
    min-height: 42px !important;
    margin: 0 4px 0 0 !important;
    padding: 7px 10px !important;
    border-radius: 9px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
}

body.mmc-z27h83-mobile .header .userLogo {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.mmc-z27h83-mobile .header .userLogo img {
    width: 38px !important;
    height: 38px !important;
}

/* ---------- Main editor ---------- */
body.mmc-z27h83-route-editor .editorDiv {
    top: var(--mmc-z27h83-header-h, 60px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body.mmc-z27h83-route-editor .toolBarContainer {
    position: fixed !important;
    top: var(--mmc-z27h83-header-h, 60px) !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1350 !important;
    min-height: 50px !important;
    max-height: 54px !important;
    margin: 0 !important;
    padding: 5px 6px !important;
    gap: 5px !important;
    align-items: center !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
body.mmc-z27h83-route-editor .toolBarContainer::-webkit-scrollbar { display: none; }

body.mmc-z27h83-route-editor .toolBarContainer button,
body.mmc-z27h83-route-editor .toolBarContainer .btn,
body.mmc-z27h83-route-editor .sideToolBarShowButton button {
    min-height: 40px !important;
    min-width: 40px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    flex: 0 0 auto !important;
    touch-action: manipulation;
}

body.mmc-z27h83-route-editor .workspaceDiv {
    top: calc(var(--mmc-z27h83-header-h, 60px) + 52px) !important;
    right: 0 !important;
    bottom: 60px !important;
    left: 0 !important;
    width: 100vw !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 7px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

body.mmc-z27h83-route-editor .paperContainer {
    margin-left: 0 !important;
    padding: 8px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-route-editor .videoFrameBar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1360 !important;
    width: 100vw !important;
    height: 58px !important;
    min-height: 58px !important;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    background: rgba(48,33,28,.96) !important;
}

body.mmc-z27h83-route-editor .videoFrameBar button,
body.mmc-z27h83-route-editor .videoFrameBar .btn {
    min-height: 40px !important;
    min-width: 44px !important;
    touch-action: manipulation;
}

body.mmc-z27h83-route-editor .sideToolBarDiv {
    top: calc(var(--mmc-z27h83-header-h, 60px) + 52px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: min(94vw, 390px) !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 1600 !important;
    box-shadow: -8px 0 22px rgba(0,0,0,.28) !important;
}

body.mmc-z27h83-route-editor .editorDiv .MuiDrawer-paper {
    top: calc(var(--mmc-z27h83-header-h, 60px) + 52px) !important;
    bottom: 0 !important;
    width: min(94vw, 390px) !important;
    max-width: 94vw !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

body.mmc-z27h83-route-editor .closeToolBarDiv {
    position: fixed !important;
    top: calc(var(--mmc-z27h83-header-h, 60px) + 57px) !important;
    right: 7px !important;
    margin: 0 !important;
    z-index: 1700 !important;
}
body.mmc-z27h83-route-editor .closeToolBarDiv button { min-width: 42px !important; min-height: 42px !important; }

/* ---------- Timeline ---------- */
body.mmc-z27h83-route-timeline .timeEditDiv {
    top: var(--mmc-z27h83-header-h, 60px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: auto !important;
    min-height: 0 !important;
    display: block !important;
    overflow: hidden !important;
}

body.mmc-z27h83-route-timeline .previewDiv {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 35% !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.mmc-z27h83-route-timeline .timeLine {
    position: absolute !important;
    top: 35% !important;
    right: 0 !important;
    bottom: 66px !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    padding: 8px 10px 76px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

body.mmc-z27h83-route-timeline .timeLine p {
    font-size: 14px !important;
    line-height: 1.25 !important;
}

body.mmc-z27h83-route-timeline .timeLine button,
body.mmc-z27h83-route-timeline .timeLine .btn {
    min-height: 40px !important;
    touch-action: manipulation;
}

body.mmc-z27h83-route-timeline .video-segment-slider,
body.mmc-z27h83-route-timeline .custom-range {
    max-width: 100% !important;
}

body.mmc-z27h83-route-timeline .footerBar {
    position: absolute !important;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 1380 !important;
    width: 100% !important;
    height: 66px !important;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    box-shadow: 0 -4px 14px rgba(0,0,0,.18) !important;
}

body.mmc-z27h83-route-timeline .footerBar button,
body.mmc-z27h83-route-timeline .footerBar .btn {
    position: static !important;
    width: 116px !important;
    max-width: 44vw !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    font-weight: 800 !important;
}

/* ---------- Account / Albums ---------- */
body.mmc-z27h83-route-account div.userWorkspaceDiv {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    display: block !important;
    overflow-x: hidden !important;
}

body.mmc-z27h83-route-account .paperContainer {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 48px !important;
    padding: 14px 8px 30px !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-route-account .projectContainer {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 10px 4px 30px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-route-account .NewGalleryDiv,
body.mmc-z27h83-route-account div.projectItem {
    width: calc(50% - 5px) !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 0 2px !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-route-account .NewGalleryDiv > *,
body.mmc-z27h83-route-account div.newGallery,
body.mmc-z27h83-route-account div.workspaceButtonContainer {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 150px !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-route-account div.projectItem-media {
    width: 100% !important;
    height: 112px !important;
    min-height: 112px !important;
}

body.mmc-z27h83-route-account div.projectItem-info {
    min-height: 64px !important;
    padding: 7px 5px 8px 9px !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-route-account div.projectItem-info-more {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: -4px !important;
    touch-action: manipulation;
}

body.mmc-z27h83-route-account div.projectItem-title {
    width: calc(100% - 44px) !important;
}

body.mmc-z27h83-route-account div.projectItem-title-text {
    font-size: 13px !important;
    line-height: 1.25 !important;
}

body.mmc-z27h83-route-account div.Workspace_workspaceHeader {
    min-width: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding-right: 4px !important;
}

body.mmc-z27h83-route-account div.Workspace_workspaceName {
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 20px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
}

body.mmc-z27h83-route-account .ant-dropdown-menu,
body.mmc-z27h83-route-account .MuiMenu-paper {
    max-width: calc(100vw - 20px) !important;
    max-height: 72vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

body.mmc-z27h83-route-account .ant-dropdown-menu-item,
body.mmc-z27h83-route-account .MuiMenuItem-root {
    min-height: 44px !important;
    white-space: normal !important;
}

/* ---------- Flip Book editor ---------- */
body.mmc-z27h83-route-edit-album .editorDiv {
    top: var(--mmc-z27h83-header-h, 60px) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body.mmc-z27h83-route-edit-album .hamburger-button {
    position: fixed !important;
    top: calc(var(--mmc-z27h83-header-h, 60px) + 7px) !important;
    left: 7px !important;
    z-index: 1500 !important;
    transform: none !important;
}
body.mmc-z27h83-route-edit-album .hamburger-button button { min-width: 44px !important; min-height: 44px !important; }

body.mmc-z27h83-route-edit-album .hamburger-button.menu-open {
    left: 7px !important;
    transform: none !important;
}

body.mmc-z27h83-route-edit-album div.album-editor-frame-paper,
body.mmc-z27h83-route-edit-album div.album-editor-frame-paper.menu-open {
    width: 100% !important;
    height: calc(100% - 58px) !important;
    min-height: 0 !important;
    margin-top: 58px !important;
    padding: 7px !important;
    box-sizing: border-box !important;
    transform: none !important;
}

body.mmc-z27h83-route-edit-album .album-editor-frame-container,
body.mmc-z27h83-route-edit-album .album-editor-frame-container.menu-open {
    position: fixed !important;
    top: calc(var(--mmc-z27h83-header-h, 60px) + 54px) !important;
    bottom: 0 !important;
    left: 0 !important;
    width: min(88vw, 350px) !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 1490 !important;
    background: #553b32 !important;
    box-shadow: 8px 0 22px rgba(0,0,0,.3) !important;
}

body.mmc-z27h83-route-edit-album .mini-edit-div,
body.mmc-z27h83-route-edit-album .mini-edit-div.menu-open {
    transform: none !important;
    max-width: 100vw !important;
}

body.mmc-z27h83-route-edit-album .sideToolBarDiv {
    top: calc(var(--mmc-z27h83-header-h, 60px) + 54px) !important;
    right: 0 !important;
    bottom: 0 !important;
    width: min(94vw, 390px) !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 1650 !important;
    box-shadow: -8px 0 22px rgba(0,0,0,.28) !important;
}

body.mmc-z27h83-route-edit-album .closeToolBarDiv {
    top: calc(var(--mmc-z27h83-header-h, 60px) + 61px) !important;
    right: 8px !important;
    margin: 0 !important;
    z-index: 1750 !important;
}
body.mmc-z27h83-route-edit-album .closeToolBarDiv button { min-width: 44px !important; min-height: 44px !important; }

/* ---------- Shared dialogs, forms and live chat ---------- */
body.mmc-z27h83-mobile .MuiDialog-paper,
body.mmc-z27h83-mobile .modal-dialog {
    max-width: calc(100vw - 18px) !important;
    max-height: calc(var(--mmc-z27h83-vh, 100vh) - 18px) !important;
    margin: 9px auto !important;
}

body.mmc-z27h83-mobile .modal-content,
body.mmc-z27h83-mobile .MuiDialogContent-root {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-mobile input,
body.mmc-z27h83-mobile select,
body.mmc-z27h83-mobile textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body.mmc-z27h83-mobile .speed-dial {
    right: 12px !important;
    max-width: calc(100vw - 24px) !important;
}

body.mmc-z27h83-mobile .contact-form-modal {
    right: 10px !important;
    left: auto !important;
    width: min(92vw, 390px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 390px) {
    body.mmc-z27h83-route-account .paperContainer { margin-left: 42px !important; }
    body.mmc-z27h83-route-account .projectContainer { gap: 8px !important; }
    body.mmc-z27h83-route-account .NewGalleryDiv,
    body.mmc-z27h83-route-account div.projectItem { width: calc(50% - 4px) !important; }
    body.mmc-z27h83-route-account div.projectItem-media { height: 98px !important; min-height: 98px !important; }
    body.mmc-z27h83-mobile .header .btn-success { min-width: 78px !important; padding-left: 7px !important; padding-right: 7px !important; }
    body.mmc-z27h83-mobile .header .mmc-buy-credits-header { font-size: 9px !important; padding-left: 6px !important; padding-right: 6px !important; }
}

@media (orientation: landscape) and (max-height: 520px) {
    body.mmc-z27h83-route-timeline .previewDiv { height: 28% !important; }
    body.mmc-z27h83-route-timeline .timeLine { top: 28% !important; }
    body.mmc-z27h83-route-editor .workspaceDiv { bottom: 54px !important; }
    body.mmc-z27h83-route-editor .videoFrameBar { height: 52px !important; min-height: 52px !important; }
}
