/**
 * Edulim PWA App Shell — standalone modda native mobil uygulama görünümü.
 * html.pwa-standalone sınıfı JS ile eklenir (display-mode: standalone).
 */

html.pwa-standalone {
    --pwa-tab-h: calc(62px + env(safe-area-inset-bottom, 0px));
    --pwa-bar-h: calc(56px + env(safe-area-inset-top, 0px));
    --pwa-brand: #6366f1;
    --pwa-brand2: #8b5cf6;
}

/* ── Site header (master layout) gizle ── */
html.pwa-standalone .header_area,
html.pwa-standalone .header_wrapper_modern {
    display: none !important;
}

html.pwa-standalone .edume-cinematic-page__main,
html.pwa-standalone main,
html.pwa-standalone .main_content:not(.dashboard_part) {
    padding-top: var(--pwa-bar-h) !important;
    padding-bottom: var(--pwa-tab-h) !important;
    min-height: 100dvh;
}

/* ── Sidebar & site footer gizle ── */
html.pwa-standalone .sidebar,
html.pwa-standalone .sidebar_icon,
html.pwa-standalone .sidebar_close_icon,
html.pwa-standalone footer.ft3,
html.pwa-standalone .footer_content,
html.pwa-standalone #edulim-a2hs {
    display: none !important;
}

/* ── Layout tam genişlik ── */
html.pwa-standalone .dashboard_main_wrapper {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

html.pwa-standalone .main_content.dashboard_part {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-top: var(--pwa-bar-h) !important;
    padding-bottom: var(--pwa-tab-h) !important;
    min-height: 100dvh;
}

html.pwa-standalone .header_iner {
    display: none !important;
}

/* ── Üst app bar ── */
.pwa-appbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    height: var(--pwa-bar-h);
    padding-top: env(safe-area-inset-top, 0px);
    background: linear-gradient(135deg, var(--pwa-brand), var(--pwa-brand2));
    color: #fff;
    box-shadow: 0 4px 20px rgba(99, 102, 241, .35);
}

html.pwa-standalone .pwa-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 12px;
}

.pwa-appbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.pwa-appbar__logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: contain;
    background: rgba(255, 255, 255, .15);
    padding: 4px;
    flex-shrink: 0;
}

.pwa-appbar__title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-appbar__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pwa-appbar__btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
}

.pwa-appbar__btn:active {
    background: rgba(255, 255, 255, .22);
}

.pwa-appbar__btn--text {
    width: auto;
    min-width: 56px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
}

.pwa-appbar__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* ── Alt tab bar ── */
.pwa-tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    height: var(--pwa-tab-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, .06);
    box-shadow: 0 -4px 24px rgba(16, 24, 40, .08);
}

html.pwa-standalone .pwa-tabbar {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
}

.pwa-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px 8px;
    text-decoration: none !important;
    color: #8b93a3;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .1px;
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s;
}

.pwa-tab i {
    font-size: 21px;
    line-height: 1;
    transition: transform .15s;
}

.pwa-tab.active {
    color: var(--pwa-brand);
}

.pwa-tab.active i {
    transform: scale(1.08);
}

.pwa-tab__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--pwa-brand);
    margin-top: -2px;
    opacity: 0;
}

.pwa-tab.active .pwa-tab__dot {
    opacity: 1;
}

/* ── Daha fazla menü (sheet) ── */
.pwa-sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(15, 23, 42, .45);
}

.pwa-sheet-backdrop.open {
    display: block;
}

.pwa-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1070;
    max-height: 78vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(110%);
    transition: transform .28s cubic-bezier(.32, .72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .12);
    overflow-y: auto;
}

.pwa-sheet.open {
    transform: translateY(0);
}

.pwa-sheet__handle {
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: #dde0e7;
    margin: 0 auto 16px;
}

.pwa-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.pwa-sheet__head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #1e2433;
}

.pwa-sheet__close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #f3f4f6;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
}

.pwa-sheet__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.pwa-sheet__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 6px;
    border-radius: 14px;
    text-decoration: none !important;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
}

.pwa-sheet__item:active {
    background: #f1f5f9;
}

.pwa-sheet__item .ic {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #f4f6fb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--pwa-brand);
}

.pwa-sheet__item.ai .ic {
    background: linear-gradient(135deg, #eef0fe, #f5f3ff);
    color: #7c3aed;
}

/* İçerik alanı mobil optimizasyonu */
html.pwa-standalone .container-fluid {
    padding-left: 14px !important;
    padding-right: 14px !important;
}

html.pwa-standalone body {
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

/* PWA modunda body scroll lock when sheet open */
html.pwa-sheet-open {
    overflow: hidden;
}

/* Giriş sayfası PWA modu */
html.pwa-standalone .auth_page_outer {
    min-height: 100dvh;
    padding-top: var(--pwa-bar-h);
    padding-bottom: var(--pwa-tab-h);
}

html.pwa-standalone .auth_left_panel,
html.pwa-standalone .auth_right_panel {
    padding-bottom: 12px;
}

/* ── Ön yüz düzenleme modu PWA'da gizle (toolbar z-index 99990 tab bar'ı kapatıyordu) ── */
html.pwa-standalone .fe-toolbar,
html.pwa-standalone #feEditToolbar,
html.pwa-standalone .fe-section__toolbar,
html.pwa-standalone .fe-section__drag,
html.pwa-standalone .fe-section__edit,
html.pwa-standalone .fe-section__delete,
html.pwa-standalone .fe-section__duplicate,
html.pwa-standalone .fe-nav-item-edit,
html.pwa-standalone .fe-nav-menu-drag,
html.pwa-standalone #feEditModal,
html.pwa-standalone .fe-modal {
    display: none !important;
}

html.pwa-standalone body.fe-edit-mode-active {
    padding-bottom: 0 !important;
}

html.pwa-standalone .fe-section:hover .fe-section__inner,
html.pwa-standalone .fe-home-sections--sortable .fe-section__inner,
html.pwa-standalone .fe-section--footer:hover > .fe-section__inner,
html.pwa-standalone .fe-section--logo:hover > .fe-section__inner {
    outline: none !important;
    box-shadow: none !important;
}

html.pwa-standalone .fe-section--hidden .fe-section__inner,
html.pwa-standalone .fe-section--hidden > .fe-section__inner > *:not(.fe-section-placeholder) {
    opacity: 1 !important;
}

html.pwa-standalone .pwa-tabbar {
    z-index: 100001;
}

html.pwa-standalone .pwa-appbar {
    z-index: 100000;
}
