/**
 * Frontend Caravan List Styles
 * Matches the dashboard browse-caravans design
 */

/* =====================================================
   BASE STYLES & BOX LAYOUT
===================================================== */
.lm-browse-wrapper {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    min-height: 60vh;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1f2937;
    line-height: 1.5;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Page background */
body:has(.lm-browse-wrapper) {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
}

/* Content container with proper padding */
#lm-caravan-list-app {
    padding: 0;
}

/* Remove sidebar on caravan list page */
body:has(.lm-browse-wrapper) #secondary,
body:has(.lm-browse-wrapper) .widget-area {
    display: none !important;
}

/* Hide page title only - NOT header/footer */
body:has(.lm-browse-wrapper) .entry-title,
body:has(.lm-browse-wrapper) .page-title,
body:has(.lm-browse-wrapper) .wp-block-post-title,
body:has(.lm-browse-wrapper) article>header .entry-title,
body:has(.lm-browse-wrapper) .ast-archive-description,
body:has(.lm-browse-wrapper) h1.wp-block-post-title,
body:has(.lm-browse-wrapper) .entry-header {
    display: none !important;
}

/* Theme container adjustments for box layout */
body:has(.lm-browse-wrapper) .ast-container,
body:has(.lm-browse-wrapper) .site-main,
body:has(.lm-browse-wrapper) #primary,
body:has(.lm-browse-wrapper) .entry-content {
    max-width: 1440px !important;
    margin: 0 auto !important;
    padding: 20px !important;
}

.lm-browse-wrapper *,
.lm-browse-wrapper *::before,
.lm-browse-wrapper *::after {
    box-sizing: border-box;
}

/* =====================================================
   FORM INPUT HEIGHT FIX - Cross Theme Compatibility
===================================================== */
.lm-browse-wrapper input[type="text"],
.lm-browse-wrapper input[type="number"],
.lm-browse-wrapper input[type="email"],
.lm-browse-wrapper input[type="url"],
.lm-browse-wrapper input[type="password"],
.lm-browse-wrapper input[type="search"],
.lm-browse-wrapper input[type="reset"],
.lm-browse-wrapper input[type="tel"],
.lm-browse-wrapper input[type="date"],
.lm-browse-wrapper select {
    height: 57px !important;
    min-height: 57px !important;
    box-sizing: border-box !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.lm-browse-wrapper input[type="text"]:focus,
.lm-browse-wrapper input[type="number"]:focus,
.lm-browse-wrapper input[type="email"]:focus,
.lm-browse-wrapper input[type="url"]:focus,
.lm-browse-wrapper input[type="password"]:focus,
.lm-browse-wrapper input[type="search"]:focus,
.lm-browse-wrapper input[type="tel"]:focus,
.lm-browse-wrapper input[type="date"]:focus,
.lm-browse-wrapper select:focus {
    outline: none !important;
    border-color: #7B6CF6 !important;
    box-shadow: 0 0 0 3px rgba(123, 108, 246, 0.15) !important;
}

.lm-browse-wrapper input::placeholder {
    color: #94a3b8 !important;
}

/* =====================================================
   HERO SECTION
===================================================== */
.lm-browse-hero {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    padding: 48px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.lm-browse-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.lm-browse-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.lm-browse-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.lm-browse-hero p {
    font-size: 1.125rem;
    color: #cbd5e1;
    margin: 0;
}

/* =====================================================
   SEARCH SECTION
===================================================== */
.lm-browse-search-section {
    max-width: 1200px;
    margin: -40px auto 0;
    padding: 0 24px;
    position: relative;
    z-index: 10;
}

.lm-search-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.lm-search-main {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.lm-search-input-wrap {
    flex: 1;
    position: relative;
}

.lm-search-input-wrap svg {
    display: none;
}

.lm-search-input-wrap input {
    width: 100%;
    padding: 18px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 1rem;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.lm-search-input-wrap input:focus {
    outline: none;
    border-color: #7B6CF6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(123, 108, 246, 0.1);
}

.lm-search-btn {
    padding: 18px 36px;
    background: linear-gradient(135deg, #7B6CF6 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(123, 108, 246, 0.3);
    text-decoration: none;
}

.lm-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(123, 108, 246, 0.4);
    color: #ffffff;
}

.lm-filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Row 2: Check-in, Check-out, Location, Guests - each 1 column */
.lm-filter-item:nth-child(1),
.lm-filter-item:nth-child(2),
.lm-filter-item:nth-child(3),
.lm-filter-item:nth-child(4) {
    grid-column: span 1;
}

/* Row 3: Min Price, Max Price, Sort By */
.lm-filter-item:nth-child(5),
.lm-filter-item:nth-child(6) {
    grid-column: span 1;
}

.lm-filter-item:nth-child(7) {
    grid-column: span 2;
}

.lm-filter-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.lm-filter-item select,
.lm-filter-item input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9375rem;
    color: #1e293b;
    background: #ffffff;
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.lm-filter-item select:focus,
.lm-filter-item input:focus {
    outline: none;
    border-color: #7B6CF6;
    box-shadow: 0 0 0 3px rgba(123, 108, 246, 0.1);
}

/* =====================================================
   RESULTS SECTION
===================================================== */
.lm-browse-results {
    width: 100%;
    padding: 32px 24px 48px;
    position: relative;
    min-height: 400px;
}

.lm-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
}

.lm-results-count {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.lm-results-count span {
    color: #7B6CF6;
}

.lm-clear-filters-btn {
    padding: 10px 20px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.lm-clear-filters-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

/* =====================================================
   CARDS GRID
===================================================== */
.lm-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
    max-width: 1800px;
    margin: 0 auto;
}

/* =====================================================
   PROFESSIONAL CARD DESIGN
===================================================== */
.lm-pro-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.lm-pro-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

.lm-pro-card-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
}

.lm-pro-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.lm-pro-card:hover .lm-pro-card-image img {
    transform: scale(1.08);
}

.lm-pro-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.lm-pro-card-badges {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    gap: 8px;
}

.lm-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lm-badge-featured {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #ffffff;
}

.lm-pro-card-price {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.98);
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lm-pro-card-price strong {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.lm-pro-card-price span {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 400;
}

.lm-pro-card-body {
    padding: 24px;
}

.lm-pro-card-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 8px;
}

.lm-pro-card-location svg {
    color: #7B6CF6;
}

.lm-pro-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lm-pro-card-specs {
    display: flex;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 16px;
}

.lm-spec-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #475569;
}

.lm-spec-item svg {
    color: #94a3b8;
}

.lm-spec-item strong {
    font-weight: 600;
    color: #1e293b;
}

.lm-pro-card-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.lm-amenity-tag {
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lm-pro-card-footer {
    display: flex;
    gap: 12px;
}

.lm-btn-view {
    flex: 1;
    padding: 14px 20px;
    background: linear-gradient(135deg, #7B6CF6 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.lm-btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(123, 108, 246, 0.35);
    color: #ffffff;
}

/* =====================================================
   LOADING STATE - CENTER OF PAGE
===================================================== */
.lm-loading-state {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    text-align: center;
}

.lm-loading-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid #e2e8f0;
    border-top-color: #7B6CF6;
    border-radius: 50%;
    animation: lm-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes lm-spin {
    to {
        transform: rotate(360deg);
    }
}

.lm-loading-state p {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
}

/* =====================================================
   EMPTY STATE
===================================================== */
.lm-empty-state {
    background: #ffffff;
    border-radius: 20px;
    padding: 80px 40px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    max-width: 600px;
    margin: 0 auto;
}

.lm-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.lm-empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

.lm-empty-state p {
    font-size: 1rem;
    color: #64748b;
    margin: 0 0 28px;
}

/* =====================================================
   PAGINATION
===================================================== */
.lm-pagination-wrap {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #e2e8f0;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
}

.lm-page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #475569;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-sizing: border-box;
}

a.lm-page-btn,
a.lm-page-btn:hover,
a.lm-page-btn:focus,
a.lm-page-btn:visited {
    text-decoration: none;
}

.lm-page-btn:hover {
    border-color: #7B6CF6;
    color: #7B6CF6;
}

.lm-page-btn.active {
    background: #7B6CF6;
    border-color: #7B6CF6;
    color: #ffffff;
}

.lm-page-btn.lm-page-arrow {
    padding: 0 12px;
}

.lm-page-btn.is-disabled,
.lm-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 1024px) {
    .lm-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }

    .lm-filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tablet layout: 2 columns, sort by spans 2 */
    .lm-filter-item:nth-child(7) {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .lm-browse-hero {
        padding: 32px 16px;
    }

    .lm-browse-hero h1 {
        font-size: 1.75rem;
    }

    .lm-browse-search-section {
        margin-top: -30px;
        padding: 0 16px;
    }

    .lm-search-card {
        padding: 20px;
    }

    .lm-search-main {
        flex-direction: column;
    }

    .lm-search-btn {
        width: 100%;
        justify-content: center;
    }

    .lm-filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* On mobile, all filter items take full width */
    .lm-filter-item:nth-child(1),
    .lm-filter-item:nth-child(2),
    .lm-filter-item:nth-child(3),
    .lm-filter-item:nth-child(4),
    .lm-filter-item:nth-child(5),
    .lm-filter-item:nth-child(6),
    .lm-filter-item:nth-child(7) {
        grid-column: span 1;
    }

    .lm-browse-results {
        padding: 24px 16px 40px;
    }

    .lm-results-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .lm-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .lm-pro-card-specs {
        flex-wrap: wrap;
        gap: 12px;
    }

    .lm-pagination-wrap {
        flex-wrap: wrap;
    }

    .lm-cl-amenities-grid {
        grid-template-columns: 1fr;
    }
}

/* Amenities Filter Section */
.lm-cl-amenities-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #e2e8f0;
}

.lm-cl-amenities-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
}

.lm-cl-amenities-header svg {
    color: #7B6CF6;
}

.lm-cl-amenities-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.lm-cl-amenity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: #ffffff;
}

.lm-cl-amenity-item:hover {
    border-color: #7B6CF6;
    background: #EEE9FE;
}

.lm-cl-amenity-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #7B6CF6;
    cursor: pointer;
    flex-shrink: 0;
}

.lm-cl-amenity-label {
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    flex: 1;
}

.lm-cl-amenity-item:has(input:checked) {
    border-color: #7B6CF6;
    background: #EEE9FE;
}

.lm-cl-amenity-item:has(input:checked) .lm-cl-amenity-label {
    color: #7B6CF6;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .lm-cl-amenities-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Portrait - Very Small Screens */
@media (max-width: 480px) {
    .lm-filters-grid {
        grid-template-columns: 1fr;
    }

    .lm-filter-item:nth-child(1),
    .lm-filter-item:nth-child(2),
    .lm-filter-item:nth-child(3),
    .lm-filter-item:nth-child(4),
    .lm-filter-item:nth-child(5),
    .lm-filter-item:nth-child(6),
    .lm-filter-item:nth-child(7) {
        grid-column: span 1;
    }

    .lm-cl-amenities-grid {
        grid-template-columns: 1fr;
    }
}