/* HarfHesab responsive stabilization layer
   Loaded after CSS isolation to keep mobile/tablet overrides predictable. */

html,
body,
.layout-shell,
.site-main {
    max-width: 100%;
    overflow-x: hidden;
}

* {
    min-width: 0;
}

img,
video,
svg,
canvas {
    max-width: 100%;
}

.responsive-table,
.table-scroll {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

@media (max-width: 1099.98px) {
    .desktop-nav,
    .site-header__actions {
        display: none !important;
    }

    .mobile-menu-btn {
        display: inline-grid !important;
    }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
    .feature-strip__grid,
    .course-grid,
    .blog-grid,
    .state-grid,
    .admin-kpi-grid,
    .admin-kpi-grid--compact,
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .checkout-shell,
    .course-details,
    .panel-layout,
    .admin-pro-container,
    .blog-detail-layout,
    .enrollment-details-card {
        grid-template-columns: 1fr !important;
    }

    .checkout-hero-card,
    .blog-detail-hero {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) !important;
    }

    .admin-pro-sidebar {
        position: static !important;
        display: flex !important;
        overflow-x: auto;
        align-items: center;
        gap: .5rem;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-xl);
        background: #fff;
        box-shadow: var(--shadow-sm);
        padding: .65rem;
        -webkit-overflow-scrolling: touch;
    }

    .admin-pro-brand {
        display: none !important;
    }

    .admin-nav__links {
        display: flex !important;
        min-width: max-content;
        gap: .4rem;
    }

    .admin-nav__link {
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) {
    :root {
        --header-height: 64px;
        --space-8: 1.5rem;
        --space-10: 2rem;
        --space-12: 2.25rem;
        --space-16: 2.75rem;
    }

    body {
        font-size: .92rem;
        line-height: 1.78;
        padding-bottom: 4.8rem !important;
    }

    h1 {
        font-size: clamp(1.45rem, 7vw, 1.9rem) !important;
        line-height: 1.55;
    }

    h2 {
        font-size: clamp(1.15rem, 5vw, 1.42rem) !important;
    }

    .container,
    .app-container {
        width: min(100% - 1rem, var(--container)) !important;
    }

    .site-main {
        padding-block: var(--space-5) var(--space-10) !important;
    }

    .section,
    .ui-page,
    .user-panel-page,
    .admin-pro-page,
    .manage-pro-page,
    .auth-page,
    .checkout-page,
    .blog-detail-page,
    .enrollment-details-page {
        padding-block: 1.5rem 2.75rem !important;
    }

    .section-head,
    .section-header,
    .section-heading,
    .data-card__head,
    .panel-head,
    .admin-pro-hero,
    .admin-section-head,
    .manage-section-head,
    .invoice-header,
    .invoice-total,
    .blog-section-head {
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: .85rem !important;
        margin-bottom: 1.25rem !important;
    }

    .site-header {
        min-height: var(--header-height) !important;
    }

    .site-header__inner {
        min-height: var(--header-height) !important;
        gap: .75rem !important;
    }

    .brand {
        max-width: calc(100vw - 5rem);
        gap: .55rem !important;
    }

    .brand__mark {
        width: 2.35rem !important;
        height: 2.35rem !important;
        border-radius: .8rem !important;
        font-size: .9rem;
    }

    .brand__text {
        min-width: 0;
    }

    .brand__text strong,
    .brand__text small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand__text strong {
        font-size: .9rem !important;
    }

    .brand__text small {
        font-size: .68rem !important;
    }

    .mobile-menu-btn {
        width: 2.45rem !important;
        height: 2.45rem !important;
        flex: 0 0 auto;
    }

    .mobile-drawer {
        width: min(88vw, 21rem) !important;
        max-width: calc(100vw - .75rem);
        padding: 1rem !important;
    }

    .mobile-drawer__head {
        gap: .75rem !important;
    }

    .mobile-nav {
        padding-block: 1rem !important;
    }

    .mobile-nav a {
        min-height: 2.75rem;
        padding: .75rem .85rem !important;
    }

    .site-footer {
        padding-top: 2rem !important;
    }

    .site-footer__grid {
        gap: 1.4rem !important;
    }

    .site-footer__bottom {
        margin-top: 1.5rem !important;
    }

    .hero-section {
        padding-block: .75rem 2rem !important;
    }

    .hero-slider {
        border-radius: 1.1rem !important;
    }

    .hero-slide {
        min-height: auto !important;
        grid-template-columns: 1fr !important;
        align-items: start !important;
        gap: 1.2rem !important;
        padding: 1.15rem 1rem 5.25rem !important;
    }

    .hero-slide__content {
        gap: .8rem !important;
    }

    .hero-slide h1 {
        font-size: clamp(1.45rem, 7vw, 1.85rem) !important;
        line-height: 1.55 !important;
    }

    .hero-slide p {
        font-size: .9rem !important;
        line-height: 1.9 !important;
    }

    .hero-slide__actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100%;
        gap: .75rem !important;
        margin-top: .75rem !important;
    }

    .hero-slide__actions .btn {
        width: 100%;
    }

    .hero-visual {
        min-height: auto !important;
        width: 100%;
    }

    .hero-visual__card,
    .hero-keyword-panel,
    .hero-market-panel {
        width: 100% !important;
        border-radius: 1.1rem !important;
        padding: 1rem !important;
    }

    .hero-visual__card--float {
        position: static !important;
        width: 100% !important;
        margin-top: .75rem;
    }

    .hero-keyword-grid {
        grid-template-columns: 1fr !important;
    }

    .hero-market-chart {
        min-height: 6.75rem !important;
    }

    .hero-arrow {
        top: auto !important;
        bottom: .9rem !important;
        width: 2.35rem !important;
        height: 2.35rem !important;
        transform: none !important;
    }

    .hero-arrow--prev {
        right: 1rem !important;
    }

    .hero-arrow--next {
        left: 1rem !important;
    }

    .hero-slider__dots {
        bottom: 1.12rem !important;
    }

    .feature-strip__grid,
    .course-grid,
    .blog-grid,
    .state-grid,
    .kpi-grid,
    .admin-kpi-grid,
    .admin-kpi-grid--compact,
    .delivery-grid,
    .checkout-form-grid,
    .option-grid,
    .payment-methods,
    .admin-pro-grid,
    .manage-grid-2,
    .manage-form-grid,
    .manage-upload-grid,
    .invoice-grid,
    .enrollment-info-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .course-toolbar,
    .checkout-shell,
    .checkout-hero-card,
    .course-details,
    .blog-detail-layout,
    .blog-detail-hero,
    .enrollment-details-card,
    .panel-layout,
    .admin-pro-container,
    .manage-grid-2--wide-form,
    .manage-grid-2--invoice {
        grid-template-columns: 1fr !important;
    }

    .filter-pills {
        width: 100%;
        margin-inline: -.5rem;
        padding-inline: .5rem;
        justify-content: flex-start !important;
        -webkit-overflow-scrolling: touch;
    }

    .filter-pills button {
        white-space: nowrap;
    }

    .course-card,
    .blog-card,
    .content-card,
    .checkout-card,
    .checkout-step-card,
    .checkout-hero-card,
    .order-summary,
    .auth-card,
    .data-card,
    .panel-card,
    .manage-card,
    .admin-pro-card,
    .admin-list-cards,
    .manage-invoice-card,
    .blog-content-card,
    .blog-comments-card,
    .comment-form-card,
    .blog-author-card,
    .blog-share-card,
    .state-card,
    .not-found-card,
    .course-hero,
    .course-buy-card {
        border-radius: 1rem !important;
        padding: 1rem !important;
    }

    .course-card,
    .blog-card,
    .enrollment-details-card {
        padding: 0 !important;
    }

    .course-card__body,
    .blog-card__body,
    .enrollment-details-card__body {
        padding: 1rem !important;
    }

    .course-card__image,
    .blog-card__image,
    .checkout-course-media,
    .blog-detail-hero__visual,
    .enrollment-details-card__image-wrap {
        min-height: auto !important;
        aspect-ratio: 16 / 9 !important;
    }

    .course-card__image img,
    .blog-card__image img,
    .checkout-course-media img,
    .blog-detail-hero__visual img,
    .enrollment-details-card__image {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        object-fit: cover !important;
    }

    .course-card__actions,
    .enrollment-actions,
    .actions,
    .manage-actions,
    .manage-inline-actions,
    .mobile-drawer__actions,
    .checkout-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100%;
        gap: .7rem !important;
    }

    .course-card__actions .btn,
    .enrollment-actions .btn,
    .actions .btn,
    .manage-actions .btn,
    .manage-inline-actions .btn,
    .manage-actions button,
    .manage-inline-actions button,
    .auth-form .btn,
    .auth-form button[type="submit"],
    .verify-form .btn,
    .verify-form button[type="submit"],
    .discount-box .btn,
    .discount-box button,
    .order-summary .btn,
    .order-summary button {
        width: 100% !important;
        white-space: normal !important;
    }

    .btn,
    button.btn,
    a.btn {
        min-width: 0;
        white-space: normal;
        text-align: center;
    }

    .teacher-box,
    .admin-mini-row,
    .manage-row,
    .manage-enrollment-row,
    .payment-option,
    .delivery-option,
    .summary-row,
    .terms-check,
    .comment-card__header,
    .comment-user {
        align-items: flex-start !important;
    }

    .admin-mini-row,
    .manage-row,
    .manage-enrollment-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: .75rem !important;
        padding: 1rem !important;
    }

    .admin-mini-row > *,
    .manage-row > *,
    .manage-enrollment-row > * {
        width: 100%;
    }

    .admin-mini-row__meta,
    .manage-row__meta {
        justify-items: start !important;
        text-align: right !important;
        width: 100%;
    }

    .admin-pro-sidebar {
        position: static !important;
        display: flex !important;
        overflow-x: auto;
        align-items: center;
        gap: .5rem;
        border: 1px solid var(--color-border);
        border-radius: 1rem;
        background: #fff;
        box-shadow: var(--shadow-sm);
        padding: .55rem !important;
        -webkit-overflow-scrolling: touch;
    }

    .admin-pro-brand {
        display: none !important;
    }

    .admin-nav__links {
        display: flex !important;
        min-width: max-content;
        gap: .4rem;
    }

    .admin-nav__link {
        min-height: 2.35rem !important;
        padding: .55rem .75rem !important;
        white-space: nowrap;
        font-size: .78rem !important;
    }

    .checkout-step-head {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: .75rem !important;
    }

    .checkout-step-head > span {
        width: fit-content;
    }

    .discount-box,
    .inline-form {
        grid-template-columns: 1fr !important;
    }

    .payment-option {
        display: grid !important;
        grid-template-columns: auto 1fr !important;
        padding: 1rem !important;
        gap: .75rem !important;
    }

    .payment-option__content,
    .delivery-option__content {
        min-width: 0;
    }

    .payment-logo,
    .payment-option__logo {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }

    .payment-badge {
        position: static !important;
        grid-column: 2;
        width: fit-content !important;
        margin-top: .2rem !important;
    }

    .order-summary {
        position: static !important;
    }

    .summary-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: .25rem !important;
    }

    .course-buy-card {
        position: static !important;
    }

    .course-type-switch,
    .course-card__switch {
        border-radius: 1rem !important;
    }

    .sticky-mobile-cta {
        display: block !important;
        padding: .65rem .75rem !important;
    }

    .data-card {
        overflow: visible !important;
    }

    .responsive-table,
    .table-scroll {
        width: calc(100% + 1rem) !important;
        margin-inline: -.5rem;
        padding-inline: .5rem;
        overflow-x: auto !important;
    }

    table {
        min-width: 38rem !important;
    }

    th,
    td {
        padding: .7rem !important;
        font-size: .8rem !important;
    }

    .otp-row {
        gap: .4rem !important;
    }

    .otp-row input {
        width: 2.35rem !important;
        height: 2.75rem !important;
        font-size: 1rem !important;
    }

    .bottom-nav {
        right: .5rem !important;
        left: .5rem !important;
        bottom: .5rem !important;
        border-radius: 1rem !important;
    }

    .bottom-nav button {
        min-width: 0;
        padding: .55rem .25rem !important;
        font-size: .68rem !important;
    }
}

@media (max-width: 480px) {
    .brand__text small {
        display: none !important;
    }

    .mobile-drawer {
        width: min(92vw, 20rem) !important;
    }

    .hero-slide {
        padding-inline: .85rem !important;
    }

    .course-card__switch label,
    .course-type-switch label {
        font-size: .74rem !important;
        padding-inline: .35rem !important;
    }

    .admin-pro-hero,
    .checkout-hero-card,
    .course-hero,
    .auth-card,
    .data-card,
    .manage-card,
    .admin-pro-card,
    .checkout-card,
    .order-summary {
        padding: .9rem !important;
    }

    .payment-option,
    .delivery-option {
        grid-template-columns: 1fr !important;
    }

    .payment-badge {
        grid-column: 1 !important;
    }

    .otp-row input {
        width: 2.05rem !important;
        height: 2.55rem !important;
    }

    table {
        min-width: 34rem !important;
    }
}

/* Mobile drawer must be detached from header layout and rendered on the viewport layer. */
.nav-toggle {
    position: fixed !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.mobile-backdrop,
.mobile-drawer {
    position: fixed !important;
    margin: 0 !important;
}

.mobile-backdrop {
    inset: 0 !important;
    z-index: 1200 !important;
}

.mobile-drawer {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    z-index: 1210 !important;
    max-height: 100dvh !important;
    transform: translateX(105%) !important;
}

.nav-toggle:checked ~ .mobile-backdrop {
    display: block !important;
}

.nav-toggle:checked ~ .mobile-drawer {
    transform: translateX(0) !important;
}

.layout-shell:has(.nav-toggle:checked) .mobile-menu-btn span:nth-child(1) {
    transform: translateY(6px) rotate(45deg) !important;
}

.layout-shell:has(.nav-toggle:checked) .mobile-menu-btn span:nth-child(2) {
    opacity: 0 !important;
}

.layout-shell:has(.nav-toggle:checked) .mobile-menu-btn span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg) !important;
}

@media (min-width: 1100px) {
    .mobile-backdrop,
    .mobile-drawer,
    .mobile-menu-btn {
        display: none !important;
    }
}

/* Image-only home slider mobile hard override.
   Keeps old text-hero mobile rules from shrinking/cropping uploaded banner images. */
@media (max-width: 767.98px) {
    .hero-section--image-only {
        padding-block: .75rem 1.25rem !important;
    }

    .hero-section--image-only .container {
        width: min(100% - 1rem, var(--container)) !important;
    }

    .hero-section--image-only .image-hero-slider {
        overflow: hidden !important;
        border-radius: 1.05rem !important;
        line-height: 0 !important;
        background: #0f172a !important;
    }

    .hero-section--image-only .hero-slider__viewport {
        width: 100% !important;
        aspect-ratio: 1672 / 941 !important;
        overflow: hidden !important;
    }

    .hero-section--image-only .hero-slider__track {
        height: 100% !important;
        align-items: stretch !important;
    }

    .hero-section--image-only .image-hero-slide,
    .hero-section--image-only .hero-slide.image-hero-slide {
        display: block !important;
        width: 100% !important;
        min-width: 100% !important;
        flex: 0 0 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        aspect-ratio: auto !important;
        padding: 0 !important;
        background: #0f172a !important;
    }

    .hero-section--image-only .image-hero-slide__link,
    .hero-section--image-only .image-hero-slide img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
    }

    .hero-section--image-only .image-hero-slide img {
        object-fit: contain !important;
        object-position: center center !important;
        background: #0f172a !important;
    }

    .hero-section--image-only .image-hero-slider .hero-arrow {
        top: 50% !important;
        bottom: auto !important;
        z-index: 6 !important;
        width: 1.82rem !important;
        height: 1.82rem !important;
        transform: translateY(-50%) !important;
        border-color: rgba(255, 255, 255, .34) !important;
        background: rgba(15, 23, 42, .34) !important;
    }

    .hero-section--image-only .image-hero-slider .hero-arrow:hover {
        transform: translateY(-50%) scale(1.04) !important;
    }

    .hero-section--image-only .image-hero-slider .hero-arrow svg {
        width: .82rem !important;
        height: .82rem !important;
    }

    .hero-section--image-only .image-hero-slider .hero-arrow--next {
        right: .48rem !important;
        left: auto !important;
    }

    .hero-section--image-only .image-hero-slider .hero-arrow--prev {
        right: auto !important;
        left: .48rem !important;
    }

    .hero-section--image-only .image-hero-slider .hero-slider__dots {
        bottom: .42rem !important;
        left: 50% !important;
        right: auto !important;
        z-index: 7 !important;
        transform: translateX(-50%) !important;
        gap: .24rem !important;
        padding: .2rem .3rem !important;
        border-radius: 999px !important;
    }

    .hero-section--image-only .image-hero-slider .hero-slider__dots button {
        width: .36rem !important;
        height: .36rem !important;
        min-width: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
    }

    .hero-section--image-only .image-hero-slider .hero-slider__dots button.is-active {
        width: .88rem !important;
    }
}

@media (max-width: 480px) {
    .hero-section--image-only .image-hero-slide,
    .hero-section--image-only .hero-slide.image-hero-slide {
        padding: 0 !important;
    }
}
