@media (max-width: 1100px) {
    .hero-layout {
        grid-template-columns: 1fr;
    }

    .hero-copy {
        text-align: center;
    }

    .hero p {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-mini-stats {
        justify-content: center;
    }

    .booking-layout {
        grid-template-columns: 1fr;
    }

    .search-grid-compact {
        grid-template-columns: 1.8fr 1fr 1fr 1fr;
    }

    .search-actions-inline {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .hero {
        padding: 18px 0 14px;
    }

    .properties-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .section-intro-wrap,
    .bottom-cta-wrap {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-grid-three,
    .form-grid-two {
        grid-template-columns: 1fr;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding-right: 56px;
    }

    .main-image {
        height: 340px;
    }

    .modal-details {
        grid-template-columns: 1fr;
    }

    .search-grid-compact {
        grid-template-columns: 1fr 1fr;
    }

    .owner-edit-grid,
    .owner-property-grid,
    .owner-booking-grid,
    .owner-dashboard-stats,
    .premium-calendar-grid,
    .property-hero,
    .feature-grid,
    .related-grid,
    .top-rated-grid {
        grid-template-columns: 1fr !important;
    }

    .owner-property-actions,
    .owner-hero-actions,
    .review-actions-row {
        flex-direction: column;
    }

    .owner-property-actions > *,
    .owner-hero-actions > *,
    .review-actions-row > * {
        width: 100%;
    }

    .owner-property-cover,
    .card-image,
    .booking-cover,
    .hero-image,
    .main-image {
        height: auto !important;
        max-height: 280px;
    }

    .top-bar,
    .admin-header {
        position: sticky;
        top: 0;
        z-index: 1200;
    }

    .admin-table,
    .admin-bookings-table {
        min-width: 980px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .top-bar {
        padding: 10px 0;
    }

    .nav-shell {
        gap: 12px;
        align-items: center;
    }

    .header-actions {
        gap: 8px;
        position: relative;
    }

    .whatsapp-btn span,
    .auth-btn:not(.primary),
    .logo-sub {
        display: none;
    }

    .logo i {
        width: 44px;
        height: 44px;
        font-size: 22px;
        border-radius: 14px;
    }

    .logo-title {
        font-size: 18px;
    }

    .search-box {
        padding: 14px;
    }

    .search-box-head {
        margin-bottom: 12px;
    }

    .search-box-head h3 {
        font-size: 17px;
    }

    .properties-grid {
        grid-template-columns: 1fr;
    }

    .form-actions,
    .booking-actions {
        flex-direction: column;
    }

    .contact-btn-large,
    .favorite-btn-modal,
    .copy-link-btn,
    .reset-search-btn,
    .search-btn,
    .btn-primary,
    .btn-secondary,
    .booking-submit,
    .booking-direct-btn,
    .booking-success-btn {
        min-width: 100%;
        width: 100%;
    }

    .auth-box {
        padding: 28px;
    }

    .hero h1 {
        font-size: 48px;
    }

    .card-actions-3 {
        flex-direction: column !important;
    }

    .card-actions-3 > * {
        width: 100% !important;
    }

    .card-badges {
        flex-direction: column;
        align-items: flex-start;
        right: auto;
    }

    .admin-section {
        padding: 22px;
    }

    .booking-manage-top,
    .admin-section-head,
    .compact-head {
        flex-direction: column;
        align-items: stretch;
    }

    .booking-owner-actions {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 12px;
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-height: 92vh;
        border-radius: 26px 26px 0 0;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-body::before {
        margin-bottom: 16px;
    }

    .modal-header {
        padding-right: 54px;
        margin-bottom: 18px;
    }

    .modal-header h2 {
        font-size: 26px;
    }

    .modal-price {
        font-size: 22px;
        padding: 12px 15px;
        margin-right: 0;
    }

    .main-image {
        height: 250px;
        border-radius: 20px;
    }

    .image-thumbnails img {
        width: 74px;
        height: 56px;
        border-radius: 12px;
    }

    .modal-actions,
    .modal-actions.modal-actions-split {
        grid-template-columns: 1fr;
    }

    .modal-close {
        top: 14px;
        right: 14px;
        width: 40px;
        height: 40px;
    }

    .user-menu {
        position: relative;
    }

    .user-btn {
        min-height: 42px;
        padding: 9px 12px;
    }

    .user-btn span {
        max-width: 82px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-dropdown {
        position: fixed;
        top: 70px;
        right: 12px;
        left: 12px;
        min-width: 0;
        width: auto;
        max-width: none;
        z-index: 99999;
        border-radius: 18px;
    }

    .user-dropdown a {
        padding: 15px 16px;
    }

    .admin-header .container {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-header .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .admin-header .admin-nav-btn,
    .admin-header .theme-toggle {
        width: 100%;
        justify-content: center;
    }

    .property-card .card-actions {
        grid-template-columns: 1fr;
    }

    .property-card .premium-map-btn {
        width: 100%;
        justify-content: center;
    }

    .property-card .card-content h3 {
        min-height: unset;
    }

    .search-tags-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .header-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .header-actions > * {
        flex: 0 0 auto;
    }

    .owner-checkboxes,
    .rating-buttons,
    .premium-rating-buttons,
    .owner-form-grid,
    .form-row,
    .owner-gallery-grid {
        grid-template-columns: 1fr !important;
    }

    .owner-thumbs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .card-actions,
    .card-actions-3,
    .form-actions,
    .actions,
    .inline-form {
        flex-direction: column !important;
        display: flex !important;
    }

    .card-actions > *,
    .card-actions-3 > *,
    .form-actions > *,
    .actions > *,
    .inline-form > * {
        width: 100% !important;
    }

    .property-card .premium-map-btn,
    .property-card .card-actions a {
        width: 100%;
        justify-content: center;
    }

    .search-grid-compact {
        grid-template-columns: 1fr;
    }

    .search-actions-inline {
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .search-actions-inline .search-btn,
    .search-actions-inline .reset-search-btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .admin-header .header-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .price-inputs {
        flex-direction: column;
    }

    .price-inputs span {
        display: none;
    }

    .tags-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .tag-checkbox {
        justify-content: flex-start;
        width: 100%;
    }

    .tag-checkbox span {
        width: 100%;
        justify-content: flex-start;
    }

    .hero h1 {
        font-size: 42px;
    }

    .hero p {
        font-size: 17px;
    }

    .logo i {
        width: 46px;
        height: 46px;
    }

    .logo-title {
        font-size: 19px;
    }

    .theme-toggle,
    .whatsapp-btn,
    .auth-btn.primary,
    .user-btn {
        min-height: 44px;
    }

    .location-badge,
    .price-badge {
        font-size: 13px;
        padding: 8px 12px;
    }

    .card-content {
        padding: 18px;
    }

    .card-content h3 {
        font-size: 21px;
    }

    .modal-header h2 {
        font-size: 28px;
    }

    .modal-price {
        font-size: 30px;
    }
}

/* Extra device hardening for phone / tablet / desktop */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

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

.table-responsive,
.owner-gallery-grid,
.owner-thumbs,
.thumbs,
.search-tags-row,
.header-actions {
    scrollbar-width: thin;
}

@media (max-width: 1024px) {
    .container { padding-left: 18px; padding-right: 18px; }
    .nav-shell { flex-wrap: wrap; }
    .header-actions { flex-wrap: wrap; justify-content: flex-end; }
    .search-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .owner-edit-grid,
    .owner-view-grid,
    .property-hero,
    .booking-layout,
    .hero-layout,
    .footer-grid,
    .profile-layout,
    .settings-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 820px) {
    .top-bar .container,
    .nav-shell { align-items: center; }
    .header-actions { width: 100%; justify-content: stretch; }
    .header-actions > * { flex: 1 1 auto; }
    .search-box,
    .auth-box,
    .admin-section,
    .owner-card,
    .glass,
    .glass-card,
    .section-block { border-radius: 24px !important; }
    .table-responsive { margin-left: -2px; margin-right: -2px; }
}

@media (max-width: 640px) {
    body { overflow-x: hidden; }
    .container { padding-left: 14px; padding-right: 14px; }
    .top-bar { padding: 10px 0; }
    .nav-shell { gap: 10px; }
    .logo-text { min-width: 0; }
    .logo-title,
    .logo-sub,
    .user-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .search-box,
    .auth-box,
    .owner-card,
    .admin-section,
    .section-block,
    .gallery-card,
    .sidebar { padding: 16px !important; }
    .crumbs { gap: 10px; }
    .back-btn,
    .chip,
    .big-btn,
    .auth-btn,
    .theme-toggle,
    .whatsapp-btn,
    .search-btn,
    .reset-search-btn { min-height: 46px; }
    .hero h1 { font-size: clamp(32px, 9vw, 44px); line-height: 1.04; }
    .hero p { font-size: 15px; }
    .price-pill,
    .modal-price { font-size: 22px !important; }
    .headline { gap: 14px; }
    .headline h1,
    .section-title h2,
    .modal-header h2,
    .card-content h3 { font-size: clamp(20px, 5.8vw, 28px) !important; }
    .meta-inline,
    .tag-list,
    .stats-grid,
    .feature-grid,
    .related-grid,
    .top-rated-grid { gap: 10px !important; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-image,
    .owner-property-cover,
    .main-image { border-radius: 18px !important; }
    .hero-image { aspect-ratio: 4 / 3 !important; max-height: none !important; }
    .gallery-arrow { width: 42px !important; height: 42px !important; }
    .thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 8px !important; }
    .thumbs button { border-radius: 12px !important; }
    .thumbs button img { aspect-ratio: 1 / 1; }
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .admin-table,
    .admin-bookings-table { min-width: 760px !important; }
}

@media (max-width: 480px) {
    .header-actions { gap: 8px; }
    .header-actions > * { min-width: calc(50% - 4px); }
    .search-grid-compact,
    .owner-form-grid,
    .form-grid-two,
    .form-grid-three,
    .owner-meta-grid,
    .stats-grid,
    .booking-owner-actions { grid-template-columns: 1fr !important; }
    .thumbs,
    .owner-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .user-dropdown { top: 68px; left: 10px; right: 10px; border-radius: 16px; }
    .gallery-open-btn,
    .image-counter { font-size: 12px; }
}


@media (min-width: 1280px) {
    .container {
        width: min(100%, 1740px);
        max-width: 1740px;
        padding-left: 18px;
        padding-right: 18px;
    }
}

@media (max-width: 992px) {
    body.has-floating-back {
        padding-top: 82px;
    }

    .floating-back-btn {
        min-height: 46px;
        padding: 0 14px;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .floating-back-btn {
        left: 12px;
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        min-height: 44px;
        padding: 0 13px;
        gap: 8px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    body.has-floating-back {
        padding-top: 82px;
    }

    .floating-back-btn {
        top: 14px;
        left: 14px;
        min-height: 44px;
        padding: 0 15px;
        border-radius: 14px;
        font-size: 14px;
    }

    .scroll-to-top-btn {
        right: 14px;
        bottom: 14px;
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }
}

@media (max-width: 560px) {
    .site-logo-mark { width: 44px; height: 44px; border-radius: 14px; }
    .logo.full-logo .logo-title { font-size: 20px; letter-spacing: .12em; }
}
