/* Tooliak PWA — bottom nav, modals, banners (standalone mode) */

/* --- Bottom navigation --- */
.pwa-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    display: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

@media (max-width: 1023px) {
    .pwa-bottom-nav {
        display: block;
        visibility: visible;
    }
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }
}
body.pwa-standalone.pwa-has-bottom-nav .pwa-bottom-nav {
    display: block;
}

body.pwa-standalone.pwa-has-bottom-nav {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.pwa-bottom-nav__inner {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    max-width: 100%;
    height: 64px;
    margin: 0 auto;
}

.pwa-bottom-nav__tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.35rem 0.25rem;
    border: none;
    background: transparent;
    color: #64748b;
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.pwa-bottom-nav__tab:hover,
.pwa-bottom-nav__tab:focus-visible {
    color: #2563eb;
    outline: none;
}

.pwa-bottom-nav__tab--active {
    color: #2563eb;
}

.pwa-bottom-nav__icon {
    font-size: 1.15rem;
    line-height: 1;
}

.pwa-bottom-nav__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* --- Mobile header: bottom nav replaces hamburger --- */
@media (max-width: 1023px) {
    .site-header-mobile-btn,
    #mobile-menu-button {
        display: none !important;
    }

    .site-header-mobile-menu,
    .site-header-mobile-overlay,
    #mobile-menu,
    #mobile-menu-overlay {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* --- Standalone header tweaks --- */
body.pwa-standalone .site-header-mobile-btn {
    display: none !important;
}

body.pwa-standalone .site-header-brand .w-12 {
    width: 2.5rem;
    height: 2.5rem;
}

body.pwa-standalone .site-header-brand .text-2xl {
    font-size: 1.25rem;
}

body.pwa-standalone .site-header-tagline {
    display: none;
}

@media (max-width: 1023px) {
    body.pwa-standalone #desktop-nav {
        display: none !important;
    }
}

/* --- Standalone footer collapse --- */
body.pwa-standalone.pwa-has-bottom-nav .site-footer__grid,
body.pwa-standalone.pwa-has-bottom-nav .site-footer__ads {
    display: none !important;
}

body.pwa-standalone.pwa-has-bottom-nav footer .border-t {
    margin-top: 0;
    padding-top: 1.5rem;
}

/* --- Search modal --- */
.pwa-search-modal {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.pwa-search-modal.is-open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.pwa-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.pwa-search-modal__panel {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
}

.pwa-search-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.pwa-search-modal__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.pwa-search-modal__close {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 0.75rem;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-search-modal__search-wrap {
    position: relative;
    padding: 1rem 1.25rem;
    flex-shrink: 0;
}

.pwa-search-modal__search-icon {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.pwa-search-modal__input {
    width: 100%;
    padding: 0.875rem 2.75rem 0.875rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    font-size: 1rem;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
}

.pwa-search-modal__input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pwa-search-modal__results {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.75rem 1rem;
    -webkit-overflow-scrolling: touch;
}

.pwa-search-modal__result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: #0f172a;
    transition: background 0.15s ease;
}

.pwa-search-modal__result:hover,
.pwa-search-modal__result:focus-visible {
    background: #f1f5f9;
    outline: none;
}

.pwa-search-modal__result-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    flex-shrink: 0;
}

.pwa-search-modal__result-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.pwa-search-modal__empty {
    text-align: center;
    color: #64748b;
    padding: 2rem 1rem;
    margin: 0;
}

.pwa-search-modal__empty.hidden {
    display: none;
}

/* --- More sheet --- */
.pwa-more-sheet {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.pwa-more-sheet.is-open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.pwa-more-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.pwa-more-sheet__panel {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 1.25rem 1.25rem 0 0;
    padding: 0 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s ease;
}

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

.pwa-more-sheet__handle {
    width: 2.5rem;
    height: 0.25rem;
    background: #cbd5e1;
    border-radius: 999px;
    margin: 0.75rem auto 0;
}

.pwa-more-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0 1rem;
}

.pwa-more-sheet__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

.pwa-more-sheet__close {
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 0.625rem;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
}

.pwa-more-sheet__links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pwa-more-sheet__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 0.75rem;
    border-radius: 0.75rem;
    color: #0f172a;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease;
}

.pwa-more-sheet__link i {
    width: 1.25rem;
    color: #2563eb;
    text-align: center;
}

.pwa-more-sheet__link:hover,
.pwa-more-sheet__link:focus-visible {
    background: #f1f5f9;
    outline: none;
}

.pwa-more-sheet__actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.pwa-more-sheet__install {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 0.875rem;
    background: linear-gradient(to left, #2563eb, #0ea5e9);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

.pwa-more-sheet__install.hidden,
.pwa-more-sheet__ios-hint.hidden {
    display: none;
}

.pwa-more-sheet__ios-hint {
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.pwa-more-sheet__ios-title {
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: #0f172a;
}

.pwa-more-sheet__ios-text {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

/* --- Recent sheet (reuses more-sheet shell) --- */
.pwa-recent-sheet__list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.5rem;
}

.pwa-recent-sheet__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 0.75rem;
    border-radius: 0.75rem;
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.15s ease;
}

.pwa-recent-sheet__item:hover,
.pwa-recent-sheet__item:focus-visible {
    background: #f1f5f9;
    outline: none;
}

.pwa-recent-sheet__item-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-recent-sheet__empty {
    text-align: center;
    color: #64748b;
    padding: 1.5rem 0.75rem 1rem;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.pwa-recent-sheet__empty.hidden {
    display: none;
}

.pwa-recent-sheet__footer {
    padding: 0.5rem 0 0.25rem;
}

.pwa-recent-sheet__clear {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    background: #fff;
    color: #dc2626;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

.pwa-recent-sheet__clear.hidden {
    display: none;
}

.pwa-recent-sheet__clear:hover {
    background: #fef2f2;
}

/* --- Banners (install / update) --- */
.pwa-banner {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 0.5rem);
    z-index: 9100;
    background: #0f172a;
    color: #fff;
    border-radius: 0.875rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
}

body:not(.pwa-has-bottom-nav) .pwa-banner {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

.pwa-banner.hidden {
    display: none;
}

/* Update + install banners: phone only */
@media (min-width: 768px) {
    .pwa-banner--install,
    .pwa-banner--update {
        display: none !important;
    }
}

.pwa-banner__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pwa-banner__text {
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1;
    min-width: 0;
}

.pwa-banner__text i {
    margin-left: 0.35rem;
}

.pwa-banner__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pwa-banner__btn {
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.pwa-banner__btn--primary {
    background: #2563eb;
    color: #fff;
}

.pwa-banner__btn--ghost {
    background: transparent;
    color: #94a3b8;
}

.pwa-banner--update {
    background: #1e40af;
}

/* Body scroll lock for overlays */
body.pwa-overlay-open {
    overflow: hidden;
}
