/* Shared responsive rules for the test site. */
*, *::before, *::after { box-sizing: border-box; }

html { overflow-x: hidden; }
body { max-width: 100%; overflow-x: hidden; }
img, video, canvas, iframe { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }
textarea { resize: vertical; }

/* Shared layout polish for the public home and marketplace pages. */
.hero-content, .tech-text, .tech-image, .product-card, .gite-welcome-banner { min-width: 0; }
.hero-content { width: min(100%, 780px); }
.tech-text h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem) !important; line-height: 1.15; }
.market-hero h1 { max-width: 920px; margin-left: auto; margin-right: auto; }
.gite-welcome-text { min-width: 0; }
.gite-welcome-text h3, .gite-welcome-text p { overflow-wrap: anywhere; }
.marketplace-page { overflow-x: clip; }
.marketplace-page, .marketplace-page body { width: 100%; min-width: 0; }
.marketplace-page .market-hero,
.marketplace-page .market-controls,
.marketplace-page .market-controls-inner,
.marketplace-page .products-grid,
.marketplace-page .how-it-works { max-width: 100%; overflow-x: clip; }
.marketplace-page .market-hero { width: 100%; }
.marketplace-page .category-pills { max-width: 100%; overflow-x: auto; }

.table-responsive, .calendar-wrapper, .nav-menu, .nav-group, .nav-buttons, .admin-nav-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    body { padding-left: 0 !important; padding-right: 0 !important; }
    .container { width: 100% !important; max-width: 100% !important; }
    .card { max-width: 100%; }
    .header-bar { align-items: stretch !important; }
    .header-bar h1 { overflow-wrap: anywhere; }
    .header-bar > *, .header-bar > div { max-width: 100%; }
    .nav-menu, .nav-group, .nav-buttons { width: 100%; }
    .form-row, .filter-form, .filters-form, .filter-bar, .gps-inputs-row { gap: 10px !important; }
    .form-group, .filter-field { min-width: 100% !important; width: 100%; }
    .form-row > *, .filter-form > *, .filters-form > * { flex: 1 1 100%; }
    .btn, .btn-primary, .btn-filter, .btn-reset { width: 100%; }
    .modal-content, .qr-modal-box, .detail-modal-box { width: calc(100vw - 24px) !important; max-width: none !important; max-height: calc(100vh - 24px); overflow-y: auto; padding: 18px !important; }
    .market-hero, .hero { min-height: 55vh; padding-left: 14px; padding-right: 14px; }
    .gite-welcome-banner { align-items: flex-start; padding: 14px; }
    .gite-welcome-info { min-width: 0; }
    .gite-welcome-text { min-width: 0; overflow-wrap: anywhere; }
    .floating-cart-btn { right: 14px !important; bottom: 14px !important; max-width: calc(100vw - 28px); }
    .tech-image img { width: 100%; height: auto; }

    /* Accueil */
    .hero-content { width: 100%; }
    .hero h1 { max-width: 680px; margin-left: auto; margin-right: auto; }
    .tech-section { flex-direction: column !important; text-align: left; gap: 28px; }
    .tech-section .tech-text, .tech-section .tech-image { width: 100%; }
    .tech-section .tech-image { order: 2; }
    .tech-section .tech-text { order: 1; }
    .tech-section .check-list li { justify-content: initial; }
    .tech-section .btn-cta { width: 100%; }
    footer { padding-top: 36px; }

    /* Marketplace */
    .market-hero { padding-top: 34px; padding-bottom: 38px; }
    .market-hero h1 { font-size: clamp(2rem, 10vw, 3rem); }
    .market-hero p { line-height: 1.55; }
    .gite-welcome-banner { width: 100%; }
    .gite-welcome-info { flex: 1 1 100%; min-width: 0; }
    .gite-badge-verified { margin-left: 62px; }
    .market-controls { top: 0; padding: 10px 0; }
    .marketplace-page .market-hero,
    .marketplace-page .market-controls { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: 0; }
    .market-controls-inner { align-items: stretch !important; flex-direction: column; gap: 10px !important; }
    .marketplace-page .container { padding-left: 14px; padding-right: 14px; }
    .marketplace-page .nav-menu { max-width: 100vw; overflow-x: hidden; }
    .marketplace-page .navbar { width: 100%; min-width: 0; }
    .marketplace-page .navbar > a:first-child { min-width: 0; max-width: calc(100% - 58px); overflow: hidden; }
    .marketplace-page .navbar > a:first-child strong,
    .marketplace-page .navbar > a:first-child span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .marketplace-page .market-hero .container { width: 100%; min-width: 0; }
    .marketplace-page .market-hero h1,
    .marketplace-page .market-hero p { width: 100%; overflow-wrap: anywhere; }
    .category-pills { width: 100%; min-width: 0; }
    .search-box { width: 100%; min-width: 0 !important; max-width: none !important; }
    .products-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 16px; padding: 24px 0 100px; }
    .product-card { min-width: 0; }
    .product-content { min-width: 0; padding: 16px; }
    .product-title, .product-desc, .product-producer-tag { overflow-wrap: anywhere; }
    .product-footer { gap: 12px; flex-wrap: wrap; }
    .btn-add-cart { flex: 1 1 150px; justify-content: center; }
    .cart-item-row { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
    .cart-item-details { min-width: 0; }
    .cart-item-title { overflow-wrap: anywhere; }
    .cart-item-qty { margin-left: auto; }
    .cart-item-total { margin-left: auto; }
    .order-modal { width: 100% !important; max-height: calc(100vh - 24px); padding: 18px !important; border-radius: 12px; }
    .order-modal-header h3 { font-size: 1.2rem; }
}

@media (max-width: 480px) {
    h1 { font-size: clamp(1.35rem, 7vw, 1.8rem); }
    h2 { font-size: 1.35rem; }
    .card { padding: 14px !important; border-radius: 8px; }
    table { font-size: 0.88rem; }
    th, td { padding: 9px 10px !important; }
    .summary-grid, .stats-grid { grid-template-columns: 1fr !important; }
    .task-header { align-items: flex-start !important; flex-direction: column; gap: 6px; }
    .btn-group { flex-direction: column !important; }
    .mode-btn { width: 100%; }
    .hero { min-height: 72vh; }
    .hero h1 { font-size: clamp(1.85rem, 9vw, 2.35rem); }
    .section-header { margin-bottom: 28px; }
    .section-header p { font-size: 1rem; }
    .tech-section h2 { font-size: 1.75rem !important; }
    .gite-welcome-banner { padding: 14px !important; }
    .gite-badge-verified { margin-left: 0; }
    .product-image-wrap { height: 180px; }
    .product-footer { align-items: stretch; }
    .product-price-box, .btn-add-cart { flex: 1 1 100%; }
    .btn-add-cart { width: 100%; }
    .cart-drawer-header, .cart-drawer-body, .cart-drawer-footer { padding-left: 16px; padding-right: 16px; }
    .cart-item-img { width: 52px; height: 52px; }
    .cart-item-details { flex: 1 1 calc(100% - 70px); }
    .cart-item-qty, .cart-item-total { margin-left: 0; }
}
