:root {
    color-scheme: dark;
    --color-background: #121212;
    --color-background-secondary: #1e1e1e;
    --color-on-background: #ffffff;
    --color-on-background-secondary: #b0b0b0;
    --color-background-hover: #2a2a2a;
    --color-on-background-hover: #ffffff;
    --color-primary: #ff8c5a;
    --color-primary-dark: #ff6b35;
    --color-primary-light: #ffb088;
    --color-on-primary: #ffffff;
    --navbar-color: #ff8c5a;
    --navbar-color-dark: #ff6b35;
    --color-secondary: #ff6f00;
    --color-tertiary: #64b5f6;
    --color-error: #ff5252;
    --color-on-error: #ffffff;
    --color-success: #4caf50;
    --color-warning: #fdd835;
    --color-border: #333333;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-dark: rgba(0, 0, 0, 0.5);
}

html,
body {
    height: 100%;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    font-family: 'Lexend Deca', 'Cairo', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Arabic RTL and font */
.arabic {
    font-family: 'Cairo', 'Lexend Deca', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    direction: rtl;
}

/* Submit popup form styles */
.site-popup form {
    width: 100%;
    max-width: 720px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}
.site-popup form label {
    grid-column: span 2;
    text-align: start;
    font-weight: 600;
}
.site-popup form input,
.site-popup form select,
.site-popup form textarea {
    grid-column: span 2;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    background-color: var(--color-background-hover);
    color: var(--color-on-background);
    border: 1px solid rgba(0,0,0,0.08);
}
.site-popup form textarea {
    min-height: 6rem;
}
.site-popup form .site-popup__actions {
    grid-column: span 2;
    justify-content: center;
}
.site-popup form input::placeholder,
.site-popup form textarea::placeholder {
    color: rgba(0,0,0,0.5);
}
.site-popup-overlay.dark .site-popup form input,
.site-popup-overlay.dark .site-popup form select,
.site-popup-overlay.dark .site-popup form textarea {
    background-color: #27262c;
    border: 1px solid rgba(255,255,255,0.06);
}


header,
main {
    background-color: var(--color-background);
    color: var(--color-on-background);
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) minmax(16rem, 2fr) minmax(
            16em,
            1fr
        );
    column-gap: 2rem;
}

header {
    display: flex;
    padding-inline: 2rem;
    padding-block: 1.35rem;
    height: auto;
    background: linear-gradient(135deg, var(--navbar-color) 0%, var(--navbar-color-dark) 100%);
    color: #121212;
    box-shadow: 0 2px 8px var(--color-shadow-dark);
    align-items: center;
    gap: 2rem;
    position: relative;
    overflow: visible;
    z-index: 2500;
    --logo-panel-width: 250px;
    --logo-panel-offset: -30px;
    min-height: 72px;
}

header,
main {
    position: relative;
    z-index: 1;
}
header::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--logo-panel-offset);
    height: 100%;
    width: var(--logo-panel-width);
    background: #f7f2ea;
    transform: skewX(-12deg);
    box-shadow: 6px 0 18px rgba(0, 0, 0, 0.2);
    z-index: 0;
}
header > * {
    position: relative;
    z-index: 1;
}
header .logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: fit-content;
}
header .logo .logo-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}
header .logo .logo-mark {
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 0.8rem;
    background: #ffffff;
    border: 2px solid rgba(0, 0, 0, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
header .logo .logo-mark img {
    width: 1.9rem;
    height: auto;
    display: block;
}
header .logo h3 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.8px;
    text-transform: uppercase;
}
header .nav {
    flex: 1;
}

main {
    height: 0;
    flex: 1;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    column-gap: 2rem;
}
main > div {
    overflow-y: auto;
}

.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: span 3;
}

input[type="checkbox"] {
    height: 1.25rem;
    width: 1.25rem;
    cursor: pointer;
    margin: 0;
}

/* Popup overlay and card (promo) */
.site-popup-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    padding: 2rem;
}
.site-popup-overlay.dark {
    /* subtle lighter overlay in dark mode */
    background: rgba(0,0,0,0.6);
}

.site-popup {
    position: relative;
    width: 92vw;
    max-width: 1200px;
    height: 86vh;
    background: var(--color-background);
    color: var(--color-on-background);
    padding: 2rem;
    border-radius: 12px;
    overflow: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.site-popup h2 {
    margin-top: 0;
    font-size: 1.5rem;
    text-align: center;
}

.site-popup__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.submit-queue-status {
    margin: -0.15rem 0 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.92rem;
}

.site-popup__content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.video-wrapper {
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16/9;
    height: auto;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: 0;
    display: block;
}

.site-popup__link a {
    color: var(--color-primary);
    word-break: break-all;
}

.site-popup__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.site-popup__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--color-on-background);
    font-size: 1.25rem;
    cursor: pointer;
}

/* Dark mode styles for the popup when overlay has the .dark class */
.site-popup-overlay.dark {
    background: rgba(0,0,0,0.6);
}
.site-popup-overlay.dark .site-popup {
    background: #1c1b1f;
    color: #ffffff;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}
.site-popup-overlay.dark .site-popup__close {
    color: #ffffff;
}
.site-popup-overlay.dark .site-popup__link a {
    color: var(--color-primary);
}

.checkout-popup {
    max-width: 560px;
    height: auto;
    min-height: 320px;
}

.checkout-popup__subtitle {
    opacity: 0.86;
    margin-top: 0.35rem;
}

.checkout-popup__actions {
    width: 100%;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.annoying-ad {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(8, 7, 10, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: ad-jitter 220ms steps(2, end) 2;
}

.annoying-ad__panel {
    position: relative;
    width: min(560px, 100%);
    padding: 2rem 1.5rem 1.4rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    color: #ffffff;
    background:
        radial-gradient(circle at top right, rgba(255, 209, 102, 0.22), transparent 36%),
        linear-gradient(145deg, #2f2323, #5a1f1f);
}

.annoying-ad__close {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
}

.annoying-ad__badge {
    display: inline-block;
    margin-bottom: 0.9rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffd166;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.annoying-ad__title {
    margin: 0 0 0.55rem 0;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.05;
}

.annoying-ad__text {
    margin: 0 0 1rem 0;
    padding-right: 0;
    font-weight: 700;
    line-height: 1.3;
    font-size: 1.02rem;
}

.annoying-ad__cta {
    border: 0;
    border-radius: 0.8rem;
    padding: 0.8rem 1rem;
    background: #ffd166;
    color: #351d00;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-bottom: 0.7rem;
}

.annoying-ad__secondary {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.8rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

@keyframes ad-jitter {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(1px, -1px) rotate(-0.35deg); }
    50% { transform: translate(-1px, 1px) rotate(0.25deg); }
    75% { transform: translate(1px, 1px) rotate(-0.2deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@media (max-width: 640px) {
    .site-popup { width: 100%; height: 92vh; padding: 1rem; border-radius: 6px; }
    .site-popup h2 { font-size: 1.25rem; }
    .video-wrapper { max-height: 40vh; aspect-ratio: 16/9; }
    .annoying-ad {
        padding: 0.9rem;
    }
    .annoying-ad__panel {
        padding: 1.6rem 1rem 1rem;
    }
}

@media screen and (max-width: 1024px) {
    header::before {
        width: 230px;
        left: -40px;
    }

    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 1rem;
        height: auto;
    }

    header .logo {
        justify-self: center;
        text-align: center;
    }

    main {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        grid-template-columns: 85vw 85vw 85vw;
        column-gap: 1rem;
    }
}

/* Mobile navbar layout overrides */
@media screen and (max-width: 768px) {
    header {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        align-items: stretch;
        gap: 0.45rem;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1200;
        width: 100vw;
        max-width: 100vw;
        min-width: 0;
        overflow-x: hidden;
        overflow-y: visible;
    }

    header::before {
        display: none;
    }

    header .logo {
        justify-content: center;
        background: #f7f2ea;
        border-radius: 0.8rem;
        padding: 0.35rem 0.65rem;
        width: 100%;
        margin: 0;
    }

    header .logo .logo-link {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    header .logo h3 {
        font-size: 1rem;
        letter-spacing: -0.3px;
    }
}

/* Independent panel scrolling fix */
#app {
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
}

router-view {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

router-view > main {
    height: 100%;
    min-height: 0;
}

main > div {
    min-height: 0;
}

/* Mobile navbar: show full content without clipping */
@media screen and (max-width: 768px) {
    header {
        overflow-x: hidden;
        overflow-y: visible;
    }

    header .nav {
        grid-row: 2;
        display: block;
        width: 100%;
        min-width: 0;
        flex: none !important;
    }
}

@media screen and (max-width: 768px) {
    header {
        position: sticky;
        top: 0;
        z-index: 2000;
        touch-action: pan-y;
        scrollbar-width: none;
        overscroll-behavior-y: contain;
        padding-bottom: 0.7rem;
    }

    header::-webkit-scrollbar {
        display: none;
    }

    main.page-list {
        touch-action: pan-x;
        cursor: grab;
        padding-top: 0.45rem;
    }
}

/* Final mobile header lock: keep full navbar visible and styled like the reference */
@media screen and (max-width: 768px) {
    header {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 0 !important;
        overflow: visible !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        z-index: 3000 !important;
        box-sizing: border-box !important;
        background: linear-gradient(135deg, var(--navbar-color, #ec6e0d) 0%, var(--navbar-color-dark, #b65608) 100%) !important;
        border-bottom: 0 !important;
        isolation: isolate !important;
    }

    header::before {
        display: none !important;
    }

    header::after {
        display: none !important;
    }

    header .logo {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: linear-gradient(135deg, var(--navbar-color, #ec6e0d) 0%, var(--navbar-color-dark, #b65608) 100%) !important;
        border-radius: 0 !important;
        padding: 0.55rem 0.75rem 0.35rem !important;
        margin: 0 !important;
        gap: 0.65rem !important;
    }

    header .logo .logo-link {
        width: auto !important;
        max-width: calc(100% - 3.25rem) !important;
        justify-content: flex-start !important;
        gap: 0.55rem !important;
        background: #f7f2ea !important;
        border-radius: 0.8rem !important;
        padding: 0.35rem 0.6rem !important;
    }

    header .logo h3 {
        font-size: 1.05rem !important;
        letter-spacing: -0.2px !important;
    }

    header .nav {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        overflow: visible !important;
        background: linear-gradient(135deg, var(--navbar-color, #ec6e0d) 0%, var(--navbar-color-dark, #b65608) 100%) !important;
    }
}


