/*
 * mobile.css — Responsive / mobile-first overrides for eucertify.eu public pages
 * Breakpoints: 768px (mobile), 1024px (tablet)
 * Injected via <link> on all public pages that include main.css
 */

/* ═══════════════════════════════════════════════════════════════
   HAMBURGER BUTTON
═══════════════════════════════════════════════════════════════ */
.hamburger {
  display: none; /* hidden on desktop */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 6px;
  margin: 0;
  margin-left: auto; /* push to right of logo */
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  cursor: pointer;
  z-index: 1100;
  flex-shrink: 0;
  transition: background 0.2s;
}

.hamburger:hover {
  background: rgba(255,255,255,0.16);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #e2e8f0;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease, width 0.25s ease;
  transform-origin: center;
}

/* Animate to X when open */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ═══════════════════════════════════════════════════════════════
   TABLET (≤ 1024px) — tighten nav, no major layout changes
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  nav li {
    padding: 0.55rem 1rem;
    font-size: 0.92rem;
  }

  .nav-list {
    gap: 0.2rem 0.4rem;
  }

  .language-current .language-name {
    display: none; /* show only icon on tablet to save space */
  }

  .language-dropdown {
    min-width: auto;
    padding: 0 0.6em;
  }
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE (≤ 768px) — hamburger menu, stacked layout
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Header ── */
  .header-container {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .logo-link img {
    height: 38px;
  }

  /* Show hamburger */
  .hamburger {
    display: flex;
    order: 3;
    margin-left: 0;
    align-self: center;
  }

  /* Logo left, lang selector middle, hamburger right */
  .logo-link { order: 1; flex: 0 1 auto; min-width: 0; overflow: hidden; }
  .header-controls { order: 2; flex: 0 0 auto; }

  /* Hide the brand text block on mobile so the hamburger always fits;
     keep the logo icon. Prevents the logo from pushing the menu off-screen
     on narrow viewports (≤360px) and in languages with longer brand strings. */
  .logo-link > span {
    display: none !important;
  }
  .hamburger { margin-left: auto; }

  /* Mobile tap targets: ensure primary CTAs meet the 44px minimum */
  .guide-btn,
  .guide-btn-primary,
  .guide-btn-secondary,
  .guide-btn-white,
  .submit-request-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Language selector: show only icon in button, names visible in dropdown */
  .language-current .language-name {
    display: none;
  }

  .language-arrow {
    display: none;
  }

  .language-dropdown {
    min-width: 40px;
    width: 40px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
  }

  .language-current {
    justify-content: center;
    gap: 0;
    width: auto;
  }

  .language-flag {
    font-size: 1.4rem;
    line-height: 1;
  }

  /* Override main.css bottom:70px rule that pushes dropdown off-screen
     when language selector is in the header (top of page) */
  .language-options {
    top: calc(100% + 6px) !important;
    bottom: auto !important;
    left: auto !important;
    right: 0 !important;
    min-width: 150px;
    max-width: 180px;
    z-index: 9999;
  }

  /* ── Mobile nav overlay ── */
  #mainMenu {
    display: none;
    position: fixed;
    top: 60px; /* below header */
    left: 0;
    right: 0;
    bottom: 0;
    /* Solid background — no backdrop-filter (parent header creates stacking context
       that would make rgba backgrounds invisible on mobile Safari/Chrome) */
    background: #0c1220;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    padding: 1rem 1rem 2rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    animation: menuSlideIn 0.22s ease forwards;
  }

  @keyframes menuSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  #mainMenu.open {
    display: block;
  }

  /* Prevent body scroll when menu is open */
  body.mobile-menu-open {
    overflow: hidden;
  }

  /* ── Nav list: vertical stack ── */
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  nav li {
    width: 100%;
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    border-radius: 12px;
    white-space: normal;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    text-align: left;
  }

  nav li:hover,
  nav li:active {
    background: rgba(59, 130, 246, 0.25);
  }

  /* ── Dropdown items on mobile: click to expand ── */
  .nav-dd {
    display: block;
  }

  /* Remove hover-based open (use JS .open class instead) */
  .nav-dd:hover .nav-submenu,
  .nav-dd:focus-within .nav-submenu {
    display: none;
  }

  .nav-dd.open .nav-submenu {
    display: flex !important;
  }

  /* Caret: rotate when open */
  .nav-dd.open .nav-dd-label::after {
    transform: translateY(-50%) rotate(180deg);
  }

  /* Submenu: inline, not absolute */
  .nav-submenu {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100%;
    max-width: none;
    margin-top: 0.4rem;
    padding: 0.4rem 0 0.4rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    box-shadow: none;
    backdrop-filter: none;
  }

  .nav-submenu li {
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
    border-radius: 8px;
    background: transparent;
    border: none;
    white-space: normal;
  }

  /* ── Close overlay when clicking scroll area ── */
  #scrollArea.menu-dimmed::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 998;
    background: transparent;
  }

  /* ── Hero section ── */
  .hero-section {
    background-attachment: scroll; /* fixed bg is slow on mobile */
    min-height: auto; /* allow natural height when cards stack */
    padding-bottom: 32px;
  }

  .hero-title {
    white-space: normal;
    word-break: break-word;
    padding: 0.3em 0.8em;
    font-size: clamp(1.4rem, 8vw, 2.2rem);
    line-height: 1.2;
    border-radius: 1em;
    max-width: 96vw;
  }

  .hero-subtitle {
    padding: 0.8em 1.2em;
    font-size: clamp(0.95rem, 3.5vw, 1.1rem);
    max-width: 94vw;
    border-radius: 1em;
    margin: 1.2rem auto;
  }

  /* ── Hero CTA buttons ── */
  .hero-buttons,
  .hero-cta,
  .cta-buttons {
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 0 1rem;
  }

  .cta-button,
  .hero-btn,
  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 320px;
    text-align: center;
    justify-content: center;
  }

  /* ── Page content container ── */
  #pageContainer,
  .page,
  .wrap,
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* ── Scroll area top offset for mobile header ── */
  #scrollArea {
    top: 60px;
  }

  /* ── Dashboard iframe ── */
  #dashboardIframe,
  .dashboard-iframe {
    top: 60px;
    height: calc(100vh - 60px);
  }

  /* ── Back button ── */
  .back-btn-fixed {
    top: 70px;
    right: 12px;
    font-size: 0.8rem;
    padding: 0.35rem 0.9rem;
  }

  /* ── Modals: full width ── */
  .modal-content {
    max-width: calc(100vw - 24px);
    padding: 24px 18px 20px;
    border-radius: 14px;
  }

  .modal-content-inner {
    max-height: calc(90vh - 80px);
  }

  /* ── Forms: full-width inputs ── */
  input, select, textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  /* ── Footer columns: 2-up on mobile ── */
  .site-footer .footer-col {
    grid-column: span 6;
  }

  .site-footer .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   SMALL MOBILE (≤ 480px) — further tightening
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  .header-container {
    padding: 0.4rem 0.75rem;
  }

  .logo-link img {
    height: 32px;
  }

  .hamburger {
    width: 36px;
    height: 36px;
  }

  /* Full-width footer cols */
  .site-footer .footer-col {
    grid-column: span 12;
  }

  /* Hero */
  .hero-title {
    font-size: clamp(1.2rem, 9vw, 1.8rem);
    padding: 0.25em 0.6em;
  }

  .hero-subtitle {
    font-size: clamp(0.88rem, 4vw, 1rem);
    padding: 0.7em 1em;
  }

  /* Modal: full-screen almost */
  .modal-content {
    max-width: calc(100vw - 16px);
    padding: 20px 14px 16px;
  }

  /* Larger tap targets for nav */
  nav li {
    padding: 1rem 1rem;
    font-size: 1.02rem;
  }

  .nav-submenu li {
    padding: 0.85rem 0.8rem;
  }
}


/* ═══════════════════════════════════════════════════════════════
   CONTENT SECTIONS — cards, grids, tables
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Generic card grids → single column */
  .cards-grid,
  .features-grid,
  .roles-grid,
  .benefits-grid,
  .steps-grid,
  .services-grid,
  .about-overview,
  .process-flow {
    grid-template-columns: 1fr !important;
    flex-direction: column;
    gap: 1rem;
  }

  /* Role/feature cards: full width */
  .role-card,
  .feature-card,
  .service-card,
  .benefit-block,
  .step-card,
  .glass,
  .card {
    width: 100%;
    box-sizing: border-box;
  }

  /* Section padding */
  .section,
  .sec-hdr,
  .page-section,
  [class*="-section"] {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Headings scale down */
  h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); }
  h2 { font-size: clamp(1.3rem, 5vw, 1.9rem); }
  h3 { font-size: clamp(1.1rem, 4vw, 1.5rem); }

  /* Process arrows: rotate */
  .process-arrow {
    transform: rotate(90deg);
    margin: 0.3rem auto;
  }

  /* Tables: horizontal scroll */
  .table-wrapper,
  .tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 480px;
  }

  /* Normative requirements table — can be very wide */
  .normative-table {
    font-size: 0.82rem;
  }

  /* FAQ accordion */
  .faq-item,
  .accordion-item {
    border-radius: 10px;
  }

  /* Guide article */
  .guide-content,
  .guide-article {
    padding: 1rem;
  }

  /* How it works steps */
  .steps-list,
  .how-steps {
    flex-direction: column;
    gap: 1rem;
  }

  .step-item,
  .how-step {
    width: 100%;
  }

  /* News cards */
  .news-grid,
  .news-list {
    grid-template-columns: 1fr !important;
  }

  /* Investor/applicant/provider page two-column sections */
  .two-col,
  .split-layout,
  .info-columns {
    flex-direction: column;
    gap: 1.2rem;
  }

  /* Advantages grid → 1 col on mobile */
  .advantages-grid,
  .coverage-highlights {
    grid-template-columns: 1fr !important;
  }

  /* Coverage numbers / stats */
  .coverage-number,
  .stat-number {
    font-size: 2rem;
  }
}


/* ═══════════════════════════════════════════════════════════════
   GUIDE PAGES
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .guide-hero,
  .guide-header {
    padding: 1.5rem 1rem;
  }

  .guide-hero h1,
  .guide-header h1 {
    font-size: clamp(1.4rem, 6vw, 2rem);
  }

  .guide-body,
  .guide-main {
    padding: 1rem;
  }

  .guide-toc {
    position: static;
    width: 100%;
    margin-bottom: 1.5rem;
  }

  .guide-layout,
  .guide-with-toc {
    flex-direction: column;
    gap: 1rem;
  }

  .guide-sidebar {
    width: 100%;
    order: -1; /* TOC above content on mobile */
  }
}


/* ═══════════════════════════════════════════════════════════════
   CHATBOT — adjust position for mobile bottom bar
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  .chatbot-widget {
    bottom: 76px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
}


/* ═══════════════════════════════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Hide decorative separators on mobile */
  .footer-sep {
    display: none;
  }

  /* Wider badges/pills */
  .badge,
  .tag,
  .chip {
    white-space: normal;
  }

  /* Notification modal */
  #notificationModal .modal-content {
    max-width: calc(100vw - 20px);
  }

  /* Cookie consent */
  .cookie-banner,
  .cookie-consent {
    padding: 1rem;
    flex-direction: column;
    gap: 0.75rem;
  }

  .cookie-banner .cookie-buttons,
  .cookie-consent .cookie-buttons {
    flex-direction: column;
    width: 100%;
  }

  .cookie-banner button,
  .cookie-consent button {
    width: 100%;
  }
}


/* ═══════════════════════════════════════════════════════════════
   STATIC PAGE TABLES (.tbl / div-grid tables in how-it-works etc.)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Horizontal scroll for div-based tables */
  .tbl {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block !important;
  }

  /* Static pages wrap: no horizontal overflow */
  .wrap {
    overflow-x: hidden;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box;
  }

  /* Hero sections on static pages */
  .hero {
    padding: 1.5rem 1.2rem !important;
    border-radius: 14px !important;
  }

  .hero h1 {
    font-size: clamp(1.4rem, 7vw, 2rem) !important;
  }

  .hero p {
    font-size: 0.92rem !important;
    max-width: 100% !important;
  }

  /* CTA buttons row → wrap */
  .cta, .actions {
    flex-wrap: wrap !important;
    gap: 0.6rem !important;
  }

  .btn, .cta button {
    min-width: 140px;
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }
}


/* ═══════════════════════════════════════════════════════════════
   HOME PAGE — entrance blocks (applicant / provider cards)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Allow home page to scroll when cards stack vertically */
  #scrollArea {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Stack cards single column */
  .home-role-cards > div {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Compact card height */
  .entrance-block {
    min-height: 0 !important;
    padding: 24px 20px 20px !important;
    border-radius: 16px !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  /* Smaller heading inside card */
  .entrance-title {
    font-size: clamp(1.1rem, 5.5vw, 1.4rem) !important;
    margin-bottom: 8px !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .entrance-sub {
    font-size: 0.88rem !important;
    margin-bottom: 16px !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Long chip text must wrap */
  .entrance-chips span {
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
  }

  .entrance-cta {
    padding: 11px 28px !important;
    font-size: 15px !important;
  }

  /* Chips on mobile — scale down from desktop 26px but keep readable */
  .entrance-chips {
    margin-bottom: 12px !important;
    gap: 7px !important;
    min-height: 0 !important;
    height: auto !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
    justify-content: center !important;
  }

  .entrance-chips span {
    font-size: 16px !important;
    padding: 5px 14px !important;
  }

  /* Hero headline tighter on mobile */
  .hero-headline-block {
    padding: 16px 16px 0 !important;
    margin-bottom: 8px !important;
  }

  /* Cards container padding */
  .home-role-cards {
    padding: 0 12px !important;
    margin-top: 12px !important;
  }
}

@media (max-width: 480px) {
  .entrance-block {
    min-height: 0 !important;
    padding: 20px 16px 18px !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .entrance-title {
    font-size: clamp(1rem, 6vw, 1.3rem) !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .entrance-chips span {
    font-size: 14px !important;
    padding: 4px 11px !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
  }
}

/* ── Explore button: full-width inside mobile nav ── */
@media (max-width: 768px) {
  .explore-nav-li {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
  }
  .explore-nav-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(59,130,246,0.10);
    border: 1px solid rgba(59,130,246,0.22);
  }

  /* ── Explore panel: full-width on mobile, no translateX centering ── */
  .explore-menu-panel {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    transform: translateY(-12px) !important;
    max-width: none !important;
  }
  .explore-menu.is-open .explore-menu-panel {
    transform: translateY(0) !important;
  }
}

