/**
 * GlobaleSIM Theme — Supplementary Styles
 * Tailwind CDN handles most styling; these cover edge cases.
 */

:root {
    --ge-page-bg: #f6fafc;
    --ge-top-nav-bg: rgba(255, 255, 255, .70);
    --ge-mobile-chrome-bg: rgba(255, 255, 255, .94);
    --ge-safe-area-top: env(safe-area-inset-top, 0px);
    --ge-safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
    background: var(--ge-page-bg);
}

.ge-site-nav {
    background: var(--ge-top-nav-bg) !important;
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
}

.ge-top-promo-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ge-top-promo-content,
.ge-top-promo-content * {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.ge-top-promo-content p {
    display: inline;
    margin: 0;
}

.ge-top-promo-content a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 767px) {
        .ge-site-nav {
            padding-top: var(--ge-safe-area-top);
            transform: translate3d(0, 0, 0);
        }

        main.flex-1 {
            padding-top: calc(var(--ge-mobile-nav-offset, 56px) + var(--ge-safe-area-top)) !important;
        }

        .ge-filter-sticky {
            top: calc(var(--ge-mobile-nav-offset, 56px) + var(--ge-safe-area-top)) !important;
        }
    }
}

/* ===================== Notification Toast ===================== */
.ge-notification {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 9999;
    min-width: 200px;
    max-width: calc(100vw - 40px);
    padding: 14px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    backdrop-filter: blur(12px);
    animation: geSlideIn .35s cubic-bezier(.22,1,.36,1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.ge-notification.success { background: linear-gradient(135deg, #126e00, #1a8c00); }
.ge-notification.error   { background: linear-gradient(135deg, #ba1a1a, #dc2626); }
.ge-notification.info    { background: linear-gradient(135deg, #00658d, #0088b5); }
.ge-notification.warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.ge-notification.fade-out {
    animation: geFadeOut .3s ease forwards;
}

#noticeModal {
    z-index: 140;
}
@keyframes geSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes geFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ===================== Prose (Tutorial Content) ===================== */
.ge-desc-content img,
.ge-tutorial-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1em 0;
}
.ge-desc-content p,
.ge-tutorial-content p {
    margin-bottom: 1em;
    line-height: 1.8;
}
.ge-desc-content h1, .ge-desc-content h2, .ge-desc-content h3,
.ge-tutorial-content h1, .ge-tutorial-content h2, .ge-tutorial-content h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    margin: 1.5em 0 .75em;
    color: #181c1e;
}
.ge-desc-content h1, .ge-tutorial-content h1 { font-size: 1.5em; }
.ge-desc-content h2, .ge-tutorial-content h2 { font-size: 1.25em; }
.ge-desc-content h3, .ge-tutorial-content h3 { font-size: 1.1em; }
.ge-desc-content ul, .ge-desc-content ol,
.ge-tutorial-content ul, .ge-tutorial-content ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}
.ge-desc-content li, .ge-tutorial-content li {
    margin-bottom: .4em;
}
.ge-desc-content a, .ge-tutorial-content a {
    color: #00658d;
    text-decoration: underline;
}
.ge-desc-content table, .ge-tutorial-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: .9em;
}
.ge-desc-content th, .ge-desc-content td,
.ge-tutorial-content th, .ge-tutorial-content td {
    border: 1px solid #bdc8d1;
    padding: 8px 12px;
    text-align: left;
}
.ge-desc-content th, .ge-tutorial-content th {
    background: #f0f4f6;
    font-weight: 600;
}
.ge-desc-content blockquote, .ge-tutorial-content blockquote {
    border-left: 4px solid #00658d;
    padding: .5em 1em;
    margin: 1em 0;
    color: #3e4850;
    background: #f6fafc;
    border-radius: 0 8px 8px 0;
}
.ge-desc-content code, .ge-tutorial-content code {
    background: #f0f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .9em;
}
.ge-desc-content pre, .ge-tutorial-content pre {
    background: #181c1e;
    color: #e5e9eb;
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1em 0;
}
.ge-desc-content pre code, .ge-tutorial-content pre code {
    background: transparent;
    padding: 0;
    font-size: .85em;
}

/* ===================== Telegram Step Indicators ===================== */
.login-mode-tab {
    color: #3e4850;
    background: transparent;
}
.login-mode-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #00658d, #00aeef);
    box-shadow: 0 8px 20px rgba(0, 101, 141, .22);
}
.login-mode-tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 101, 141, .22);
}

.email-login-msg-success {
    color: #126e00;
    background: rgba(18, 110, 0, .08);
    border: 1px solid rgba(18, 110, 0, .18);
}
.email-login-msg-error {
    color: #ba1a1a;
    background: rgba(186, 26, 26, .08);
    border: 1px solid rgba(186, 26, 26, .18);
}

#tgStep1.done span:first-child,
#tgStep2.done span:first-child,
#tgStep3.done span:first-child {
    background: #126e00 !important;
    color: #fff !important;
}
#tgStep1 span:first-child,
#tgStep2 span:first-child,
#tgStep3 span:first-child {
    transition: background .3s, color .3s;
}

/* ===================== Scroll Lock ===================== */
body.modal-open {
    overflow: hidden;
}

/* ===================== Mobile Bottom Navigation ===================== */
.ge-mobile-tabbar {
    display: none;
}

@media (max-width: 767px) {
    body {
        padding-bottom: calc(68px + var(--ge-safe-area-bottom));
    }

    .ge-mobile-tabbar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 120;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        align-content: start;
        min-height: calc(64px + var(--ge-safe-area-bottom));
        padding: 6px 10px calc(6px + var(--ge-safe-area-bottom));
        background: var(--ge-mobile-chrome-bg);
        border-top: 1px solid rgba(189, 200, 209, .72);
        box-shadow: 0 -10px 28px rgba(15, 23, 42, .08);
        isolation: isolate;
        overflow: hidden;
        transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        contain: paint;
    }

    body.notice-open .ge-mobile-tabbar,
    body.category-modal-open .ge-mobile-tabbar,
    body.overflow-hidden .ge-mobile-tabbar {
        display: none;
    }

    .ge-category-modal__sheet {
        max-height: min(78vh, calc(100vh - var(--ge-mobile-nav-offset, 56px) - var(--ge-safe-area-top)));
        padding-bottom: calc(1.5rem + var(--ge-safe-area-bottom) + 20px) !important;
        scroll-padding-bottom: calc(var(--ge-safe-area-bottom) + 28px);
    }

    .ge-mobile-tabbar__item {
        position: relative;
        min-width: 0;
        height: 52px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border-radius: 13px;
        color: #5d6972;
        font-size: 11px;
        font-weight: 800;
        line-height: 1.1;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
        transform: translate3d(0, 0, 0);
        transition: background-color .16s ease, color .16s ease;
    }

    .ge-mobile-tabbar__item:hover,
    .ge-mobile-tabbar__item:focus {
        color: #00658d;
        text-decoration: none;
    }

    .ge-mobile-tabbar__item.is-active {
        color: #00658d;
        background: transparent;
    }

    .ge-mobile-tabbar__item.is-active::after {
        content: "";
        position: absolute;
        bottom: 4px;
        left: 50%;
        width: 18px;
        height: 3px;
        border-radius: 999px;
        background: rgba(0, 101, 141, .72);
        transform: translateX(-50%);
    }

    .ge-mobile-tabbar__item .material-symbols-outlined {
        font-size: 21px;
        line-height: 1;
    }

    .ge-mobile-tabbar__item.is-active .material-symbols-outlined {
        font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    }

    .ge-mobile-tabbar__label {
        max-width: 100%;
        overflow: hidden;
        letter-spacing: 0;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ge-mobile-account-sheet.hidden {
        display: none;
    }

    .ge-mobile-account-sheet {
        position: fixed;
        inset: 0;
        z-index: 130;
        display: block;
    }

    .ge-mobile-account-sheet__backdrop {
        position: absolute;
        inset: 0;
        width: 100%;
        border: 0;
        background: rgba(15, 23, 42, .36);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .ge-mobile-account-sheet__panel {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        padding: 10px 14px calc(18px + var(--ge-safe-area-bottom));
        border-radius: 22px 22px 0 0;
        background: #fff;
        border-top: 1px solid rgba(189, 200, 209, .72);
        box-shadow: 0 -24px 60px rgba(15, 23, 42, .18);
    }

    .ge-mobile-account-sheet__handle {
        width: 42px;
        height: 4px;
        margin: 0 auto 12px;
        border-radius: 999px;
        background: #d8e2e8;
    }

    .ge-mobile-account-sheet__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 12px;
    }

    .ge-mobile-account-sheet__head h3 {
        margin: 0;
        color: #181c1e;
        font-size: 20px;
        font-weight: 900;
        line-height: 1.2;
        letter-spacing: 0;
    }

    .ge-mobile-account-sheet__eyebrow {
        margin-bottom: 2px;
        color: #00658d;
        font-size: 12px;
        font-weight: 900;
    }

    .ge-mobile-account-sheet__close {
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 999px;
        background: #f0f4f6;
        color: #3e4850;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .ge-mobile-account-sheet__list {
        display: grid;
        gap: 10px;
    }

    .ge-mobile-account-item {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 64px;
        padding: 11px 12px;
        border-radius: 16px;
        border: 1px solid #d8e2e8;
        background: #fbfdfe;
        color: #181c1e;
        text-decoration: none;
    }

    .ge-mobile-account-item.hidden {
        display: none;
    }

    button.ge-mobile-account-item {
        width: 100%;
        font: inherit;
        text-align: left;
        cursor: pointer;
    }

    .ge-mobile-account-item:hover,
    .ge-mobile-account-item:focus {
        color: #181c1e;
        text-decoration: none;
        background: #f6fafc;
        border-color: rgba(0, 101, 141, .24);
    }

    .ge-mobile-account-item__icon {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        background: rgba(0, 101, 141, .09);
        color: #00658d;
        font-size: 22px;
    }

    .ge-mobile-account-item__text {
        min-width: 0;
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        gap: 2px;
    }

    .ge-mobile-account-item__text strong {
        color: #181c1e;
        font-size: 15px;
        line-height: 1.25;
    }

    .ge-mobile-account-item__text small {
        color: #6e7881;
        font-size: 12px;
        line-height: 1.35;
    }

    .ge-mobile-account-item__chevron {
        flex: 0 0 auto;
        color: #8a959e;
        font-size: 20px;
    }

    .ge-mobile-account-item--danger .ge-mobile-account-item__icon {
        background: rgba(186, 26, 26, .08);
        color: #ba1a1a;
    }
}

@media (min-width: 768px) {
    .ge-mobile-account-sheet {
        display: none !important;
    }
}

/* ===================== PWA Standalone Comfort ===================== */
@media (display-mode: standalone) {
    html {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;
    }
}

html.is-pwa-standalone,
html.is-pwa-standalone body {
    background: #f6fafc;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
}

@media (max-width: 767px) {
    html.is-pwa-standalone body {
        padding-bottom: calc(92px + var(--ge-safe-area-bottom));
    }

    html.is-pwa-standalone body > nav.fixed.top-0 {
        background: var(--ge-top-nav-bg) !important;
        box-shadow: 0 1px 0 rgba(189, 200, 209, .42);
        transform: translateZ(0);
    }

    html.is-pwa-standalone main.flex-1 {
        padding-top: calc(var(--ge-mobile-nav-offset, 56px) + var(--ge-safe-area-top)) !important;
    }

    html.is-pwa-standalone .ge-mobile-tabbar {
        min-height: calc(68px + var(--ge-safe-area-bottom));
        padding: 6px 10px calc(10px + var(--ge-safe-area-bottom));
        background: var(--ge-mobile-chrome-bg);
        box-shadow: 0 -6px 18px rgba(15, 23, 42, .08);
        transform: translateZ(0);
        will-change: transform;
    }

    html.is-pwa-standalone .ge-mobile-tabbar__item {
        height: 54px;
        min-height: 54px;
        border-radius: 14px;
        touch-action: manipulation;
    }
}

/* ===================== Print ===================== */
@media print {
    nav, footer, .ge-notification, #tgLoginOverlay { display: none !important; }
    main { padding-top: 0 !important; }
}

/* ===================== Animations ===================== */
@keyframes gePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
.ge-pulse { animation: gePulse 2s ease-in-out infinite; }

/* ===================== Misc ===================== */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
