/**
 * Green University — mobil va planshet uchun responsive tuzatishlar.
 * Barcha sahifalarga app.py orqali inject qilinadi.
 */

/* ── Gorizontal scroll oldini olish ── */
html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: clip;
}

/* .container max-width ni buzmaslik — asl tema 1592px markazlashtiradi */
.wrapper,
main,
.page,
.page-main,
.page-content {
  max-width: 100%;
}

.container {
  width: 100%;
  max-width: 1592px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}

/* ── Media elementlar ── */
img,
video,
iframe,
embed,
object,
svg {
  max-width: 100%;
  height: auto;
}

.page-content img,
.page-content video,
.page-content iframe,
.page-content embed,
.page-content object,
.page-content figure,
.page-content picture {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
}

/* Inline fixed-width elementlar */
.page-content [style*="width:"],
.page-content [style*="width :"],
.page-content [style*="min-width:"] {
  max-width: 100% !important;
  box-sizing: border-box;
}

/* ── Jadvallar ── */
.page-content table {
  display: block;
  width: 100% !important;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-content table td,
.page-content table th {
  word-break: break-word;
}

/* ── Matn va kod bloklari ── */
.page-content pre,
.page-content code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.page-content p,
.page-content li,
.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6 {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* ── Bootstrap row margin containment ── */
.wrapper .row {
  max-width: 100%;
}

/* ── Carousel ── */
.owl-carousel,
.owl-carousel .owl-stage-outer {
  max-width: 100%;
  overflow: hidden;
}

.owl-carousel .owl-item img {
  width: 100%;
  height: auto;
}

/* ── Apply tugmasi ── */
.header-top a.header-apply {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  min-height: 28px;
  line-height: 1.2 !important;
  padding: 6px 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  border-radius: 4px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  text-decoration: none !important;
  white-space: nowrap;
  color: #fff !important;
  font-weight: 600;
  gap: 6px;
}

.header-top a.header-apply .header-apply-text-mobile {
  display: none;
}

.header-top a.header-apply .header-apply-text-full {
  display: inline;
}

/* ── Header-top: mobilda sig'ishi ── */
@media (max-width: 991px) {
  :root {
    --header-top-height: auto;
  }

  .header-top-wrapper {
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    padding: 6px 0;
    gap: 4px 10px;
    row-gap: 6px;
  }

  .header-top .header-item._1 {
    order: 1;
    flex-shrink: 0;
  }

  .header-top .header-item._2 {
    order: 2;
    display: inline-flex !important;
    align-items: center;
    flex-shrink: 0;
  }

  .header-top a.header-apply {
    order: 3;
    flex-shrink: 0;
  }

  .header-top .header-line {
    display: none;
  }

  .header-top .header-item._2 span {
    display: none;
  }

  .header-top .header-item._2 i {
    margin-right: 0;
    font-size: 20px;
  }

  .header-top .header-icons.gu-a11y-header-icons {
    margin-left: auto !important;
    order: 90;
  }

  .header-top .header-lang {
    margin-left: 0;
    flex-shrink: 0;
    order: 91;
    display: flex !important;
  }

  /* Mobilda ijtimoiy tarmoq ikonkalari kerak emas — faqat maxsus imkoniyatlar qoladi */
  .header-top .header-icons:not(.gu-a11y-header-icons) {
    display: none !important;
  }

  .header-top .header-icons.gu-a11y-header-icons ul {
    gap: 6px;
  }

  .header-top a.header-apply {
    flex-shrink: 0;
    gap: 0 !important;
    padding: 5px 10px !important;
    min-height: 26px;
  }

  .header-top a.header-apply .header-apply-icon,
  .header-top a.header-apply > .icon-edit,
  .header-top a.header-apply > .icon-angle-right {
    display: none !important;
  }

  .header-top a.header-apply .header-apply-text-full {
    display: none !important;
  }

  .header-top a.header-apply .header-apply-text-mobile,
  .header-top a.header-apply .gu-apply-mobile-label {
    display: inline !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em;
    line-height: 1.2 !important;
    color: #fff !important;
  }

  /* Header-bottom: menyu yashirilganda hamburger + qidiruv + logo */
  .header-bottom-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px;
  }

  .header-bars {
    flex-shrink: 0;
    order: 1;
  }

  .header-logo {
    order: 2;
    flex: 1;
    min-width: 0;
    display: flex !important;
    justify-content: center;
  }

  .header-search {
    flex-shrink: 0;
    order: 3;
  }

  /* ── Mobil to'liq menyu (header-full) ── */
  .header-full {
    height: calc(100dvh - var(--gu-mobile-header-offset, 120px)) !important;
    max-height: calc(100dvh - var(--gu-mobile-header-offset, 120px)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    z-index: 6 !important;
  }

  .header-full .container,
  .header-full-wrapper {
    min-height: 100%;
  }

  .header-full-wrapper {
    padding-top: 12px;
    padding-bottom: 32px;
  }

  /* Asosiy menyu va dropdown — ustma-ust (logo ortiga tushmasin) */
  .header-full .row {
    flex-direction: column !important;
    margin: 0 !important;
  }

  .header-full .row > div {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }

  .header-full-submenu._1 {
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  .header-full-menu ul li:not(:last-child) {
    margin-bottom: 18px !important;
  }

  .header-full-menu ul li a,
  .header-full-menu ul li span {
    font-size: 20px !important;
  }

  .header-full-menu ul li span i {
    font-size: 22px !important;
  }

  .header-full-submenu ul li:not(:last-child) {
    margin-bottom: 12px !important;
  }

  .header-full-submenu ul li a,
  .header-full-submenu ul li span {
    font-size: 16px !important;
  }

  /* Menyu ochilganda markazdagi logo dropdown ustiga chiqmasin */
  .header-bars.active ~ .header-logo {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 1 !important;
  }
}

@media (max-width: 768px) {
  :root {
    --header-bottom-height: 56px;
  }

  .header-top a.header-apply .header-apply-text-full {
    display: none !important;
  }

  .header-top .header-item._1 span {
    font-size: 13px;
  }

  .header-logo img {
    width: 100px !important;
    max-width: 100px !important;
  }

  /* Hero — juda baland bo'lmasin */
  .hero,
  .hero-info {
    min-height: auto !important;
  }

  .hero-info {
    padding: 48px 16px !important;
  }

  .hero-info h1 {
    font-size: 22px !important;
    line-height: 1.3 !important;
  }

  .hero .hero-info .hero-links,
  .hero-links {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: min(320px, calc(100vw - 48px)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
  }

  .hero .hero-info .hero-links a,
  .hero .hero-info .hero-links a[href*="postgraduate"],
  .hero-links a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    padding: 10px 20px !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    text-align: center !important;
    white-space: normal !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  body.admission-enabled .hero-buttons a._1,
  body.admission-enabled .hero-buttons a.button.blur._2 {
    padding: 1rem !important;
    font-size: 15px !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .page-banner h1 {
    font-size: 22px !important;
  }

  .section-header h2 {
    font-size: 20px !important;
  }

  .section-accordion .section-button {
    font-size: 17px !important;
    padding: 14px !important;
  }

  .apply-help {
    padding: 24px 16px !important;
  }
}

@media (max-width: 575px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header-top .header-item._1 span {
    display: none;
  }

  /* Asl CSS: .header-item span { display:none } — Apply matnini qayta ko'rsatish */
  .header-top a.header-apply span,
  .header-top a.header-apply .header-apply-text,
  .header-top a.header-apply .header-apply-text-mobile,
  .header-top a.header-apply .gu-apply-mobile-label {
    display: inline !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    color: #fff !important;
  }

  .header-top a.header-apply .header-apply-text-full {
    display: none !important;
  }

  .header-top .header-lang {
    display: flex !important;
  }

  .header-logo img {
    width: 80px !important;
    max-width: 80px !important;
  }

  .header-lang .dropdown-toggle span {
    display: none;
  }

  .footer-top-body {
    flex-direction: column;
  }

  .footer .row {
    margin: 0;
  }

  .footer .row > div {
    padding: 12px 0;
  }
}

@media (max-width: 399px) {
  .header-top-wrapper {
    gap: 2px 6px;
  }

  .header-top .header-item._1 {
    font-size: 12px;
  }

  .header-logo img {
    width: 70px !important;
    max-width: 70px !important;
  }
}

/* ── Sahifa layout ── */
@media (max-width: 768px) {
  .page-main {
    flex-direction: column !important;
  }

  .page-aside,
  .page-content,
  .apply-aside,
  .page-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .page-main.page-apply {
    gap: 24px;
  }

  .news-card,
  .events-card,
  .programs-card,
  a.card {
    max-width: 100%;
  }

  .filter-block {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dropdown-menu,
  .dropdown-menu-center {
    max-width: calc(100vw - 24px);
    left: auto !important;
    right: 0 !important;
  }
}

/* ── Admin rich content (CMS) ── */
#admin-rich-content-root {
  max-width: 100%;
  overflow-x: clip;
}

#admin-rich-content-root table {
  display: block;
  width: 100% !important;
  overflow-x: auto;
}

#admin-rich-content-root iframe,
#admin-rich-content-root video {
  max-width: 100% !important;
}

/* ── Modal ── */
.subscribe-success-box {
  min-width: 0 !important;
  width: calc(100vw - 32px) !important;
  max-width: 560px !important;
  margin: 16px;
  box-sizing: border-box;
}

/* ── Katta ekranlar uchun proporsiya cheklovi ── */
@media (min-width: 1600px) {
  .hero-info h1 {
    font-size: clamp(28px, 3vw, 48px);
  }
}
