/* style_listing.css */

/* =========================================================================
   1. GLOBAL CONTAINERS & BREADCRUMBS
   ========================================================================= */

.details-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    margin-bottom: 20px;
    padding: 15px 20px; 
    border-bottom: 1px solid #2a3042;
    background-color: #161b29; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.2); 
    border-radius: 8px;
    /* Ensure it is not sticky and sits correctly */
    position: relative; 
    top: auto;
    z-index: 1; 
}

.breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #a0a5b9;
}

.breadcrumb-list li { display: flex; align-items: center; }
.breadcrumb-list li a { color: #0066cc; text-decoration: none; transition: color 0.2s; }
.breadcrumb-list li a:hover { color: #fff; text-decoration: underline; }
.breadcrumb-list li.sep { color: #555; font-size: 0.8rem; margin: 0 4px; }
.breadcrumb-list li.current { color: #e0e0e0; font-weight: 500; }

.details-title {
    font-size: 2.2rem;
    color: white;
    margin-bottom: 5px;
    line-height: 1.2;
}

/* =========================================================================
   2. MAIN LAYOUT GRID (Desktop 2-Col / Mobile Re-ordered)
   ========================================================================= */

.listing-core-grid {
    display: grid;
    /* Desktop: 66% Content | 33% Sidebar */
    grid-template-columns: 2fr 1fr; 
    grid-template-rows: auto auto;
    gap: 30px;
    margin-top: 20px;
    align-items: start;
}

/* 1. Gallery Area (Top Left) */
.gallery-area {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    /* CRITICAL FIX FOR SCROLLING: Allows child flex container to scroll inside Grid */
    min-width: 0; 
}

/* 2. Sidebar Area (Right - Spans full height) */
.sidebar-area {
    grid-column: 2 / 3;
    grid-row: 1 / 3; /* Spans adjacent to both gallery and description */
    position: sticky;
    top: 90px; /* Sticky sidebar on desktop */
    height: fit-content;
    min-width: 0; /* Prevents sidebar blowout */
}

/* 3. Description Area (Bottom Left) */
.description-area {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    min-width: 0;
}

/* --- MOBILE RESPONSIVE REORDERING (Max-width 991px) --- */
@media (max-width: 991px) {
    .listing-core-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ORDER 1: Pictures */
    .gallery-area {
        order: 1;
        width: 100%;
    }

    /* ORDER 2: Sidebar (Price, Forms, Map) */
    .sidebar-area {
        order: 2;
        position: static; /* Remove sticky on mobile */
        width: 100%;
    }

    /* ORDER 3: Description & Specs */
    .description-area {
        order: 3;
        width: 100%;
    }
}

/* =========================================================================
   3. GALLERY STYLES
   ========================================================================= */

.gallery-section {
    width: 100%;
    margin-bottom: 30px;
}

.main-image-frame {
    width: 100%;
    height: 400px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid #2a3042;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbnail-row {
    display: flex;
    gap: 12px;
    overflow-x: auto; /* Forces horizontal scroll */
    padding-bottom: 10px;
    scroll-behavior: smooth;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #2a3042 #0f111a; /* Firefox */
    
    /* Ensure flex items stay in a row */
    flex-wrap: nowrap; 
    
    /* Standard Webkit Scrollbar Styling */
    -webkit-overflow-scrolling: touch; 
}

/* Webkit Scrollbar Customization for Thumbnails */
.thumbnail-row::-webkit-scrollbar {
    height: 8px;
}
.thumbnail-row::-webkit-scrollbar-track {
    background: #0f111a;
    border-radius: 4px;
}
.thumbnail-row::-webkit-scrollbar-thumb {
    background: #2a3042;
    border-radius: 4px;
}
.thumbnail-row::-webkit-scrollbar-thumb:hover {
    background: #0066cc;
}

.thumb {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.2s;
    border: 2px solid transparent;
    
    /* CRITICAL FIX: Prevents thumbnails from shrinking to fit */
    flex-shrink: 0; 
    flex-grow: 0;
}

.thumb.active, .thumb:hover {
    opacity: 1;
    border-color: #0066cc;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================================================
   4. SIDEBAR COMPONENTS (Price, Forms, Map)
   ========================================================================= */

.sidebar-item-box {
    margin-bottom: 25px;
    width: 100%;
}

/* Info Sidebar Box */
.info-sidebar {
    background: #161b29; /* card-bg */
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #2a3042;
}

/* Price Display */
.price-box {
    background: rgba(0, 102, 204, 0.1);
    border: 1px solid #0056b3;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.price-val { 
    font-size: 2rem; 
    font-weight: 700; 
    color: white; 
    margin: 2px 0; 
}

/* Group Buy Progress Bar */
.group-progress-box {
    background: rgba(44, 62, 80, 0.3);
    border: 1px solid #2a3042;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    margin-top: 15px;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #161b29;
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
    border: 1px solid #2a3042;
}

.progress-fill {
    height: 100%;
    background: #4cd964;
    width: 0%; 
    transition: width 0.5s ease;
}

.group-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #a0a5b9;
}

.status-highlight {
    color: #4cd964;
    font-weight: 700;
}

/* Seller Info Box */
.seller-info-box {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #2a3042;
    font-size: 0.9rem;
    color: #a0a5b9;
    text-align: center;
}

/* Location Card Styles */
.location-details-box {
    margin-top: 10px;
}

.loc-biz-name {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
    text-decoration: none;
    transition: color 0.2s;
}

.loc-biz-name.link:hover { color: #64b5f6; }

.loc-address-block {
    color: #d1d5db;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.loc-badge-row {
    padding-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.loc-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 50px;
    border: 1px solid #3e4459;
}

.loc-badge.night { border-color: #0066cc; color: #64b5f6; background: rgba(0, 102, 204, 0.1); }
.loc-badge.standard { border-color: #6c757d; color: #a0a5b9; }

/* Map in Sidebar */
.sidebar-map-frame {
    height: 250px;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #161b29;
    border: 1px solid #2a3042;
    overflow: hidden;
}

/* =========================================================================
   5. DESCRIPTION & CONTENT AREA
   ========================================================================= */

.details-main-text {
    background: transparent;
}

.section-heading {
    font-size: 1.3rem;
    color: white;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a3042;
    margin-top: 30px;
}

.description-text {
    color: #d1d5db;
    line-height: 1.8;
    margin-bottom: 40px;
    font-size: 1rem;
}

/* Narrative Text Box */
.availability-narrative {
    background: #161b29;
    border-left: 3px solid #0066cc;
    padding: 20px 25px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 30px;
}

.narrative-p {
    color: #d1d5db;
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 12px;
}
.narrative-p strong { color: white; font-weight: 600; }
.narrative-p:last-child { margin-bottom: 0; }

/* Specs Table */
.specs-table {
    background: #0f111a;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid #2a3042;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #2a3042;
}
.spec-row:last-child { border-bottom: none; }
.spec-row span:first-child { color: #a0a5b9; }
.spec-row span:last-child { color: white; font-weight: 500; }

/* Media Links */
.media-links-row {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.media-link {
    display: inline-block;
    padding: 10px 20px;
    background: #1e2538;
    color: white;
    text-decoration: none;
    border: 1px solid #2a3042;
    border-radius: 6px;
    transition: 0.2s;
}
.media-link:hover {
    border-color: #0066cc;
    background: #161b29;
}

/* =========================================================================
   6. UI ELEMENTS (Buttons, Inputs, Badges)
   ========================================================================= */

/* Hybrid Input (Dark Theme) */
.hybrid-input {
    width: 100%;
    background: #0f111a;
    border: 1px solid #2a3042;
    color: #d1d5db;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: 0.2s;
    font-family: inherit;
}
.hybrid-input:focus {
    outline: none;
    border-color: #0066cc;
}

/* Contact Button */
.btn-contact {
    display: block;
    width: 100%;
    padding: 14px;
    background: #0066cc;
    color: white;
    text-align: center;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1rem;
}
.btn-contact:hover { background: #0052a3; }

/* Phone Button */
.btn-phone {
    display: block;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid #2a3042;
    color: white;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    transition: 0.2s;
}
.btn-phone:hover { border-color: #0066cc; }

/* Reserve Button */
.btn-reserve {
    display: block;
    width: 100%;
    padding: 16px;
    background: #28a745;
    color: white;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
.btn-reserve:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
}
.btn-reserve:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.reserve-subtext {
    text-align: center;
    font-size: 0.75rem;
    color: #a0a5b9;
    margin-top: 8px;
    margin-bottom: 25px;
}

/* Group Buy Badge */
.badge-group-buy-lg {
    display: inline-block;
    vertical-align: middle;
    background-color: #2c3e50;
    color: white;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 4px;
    margin-left: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Info Icon */
.info-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #2a3042;
    color: #a0a5b9;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 6px;
    font-weight: bold;
    transition: 0.2s;
    vertical-align: middle;
    position: relative; 
    z-index: 50; 
}
.info-icon:hover {
    background: #0066cc;
    color: white;
}

/* =========================================================================
   7. SHARE BUTTONS
   ========================================================================= */

.share-section {
    margin-top: 25px;
    border-top: 1px solid #2a3042;
    padding-top: 15px;
}
.share-label {
    color: #a0a5b9;
    font-size: 0.8rem;
    margin-bottom: 10px;
    font-weight: 600;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.share-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap; 
}
.share-btn {
    flex: 1 0 40px; 
    height: 40px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
    text-decoration: none;
    background: #161b29;
}
.share-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Brand Colors */
.share-native { background: #0066cc; border: 1px solid #005bb5; width: 100%; font-weight: 600; letter-spacing: 0.5px; }
.share-native:hover { background: #0052a3; }
.share-fb { background: #1877f2; }
.share-x { background: #000; border: 1px solid #333; }
.share-wa { background: #25d366; }
.share-li { background: #0077b5; }
.share-rd { background: #ff4500; }
.share-em { background: #555; }
.share-copy { background: #2a3042; color: #a0a5b9; position: relative; }
.share-copy:hover { color: white; background: #3a4155; }

.share-copy::after {
    content: "Copied!";
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.share-copy.copied::after { opacity: 1; top: -38px; }

/* =========================================================================
   8. MODAL STYLES
   ========================================================================= */

.modal-overlay, .status-modal-overlay {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}
.modal-overlay.active, .status-modal-overlay.active {
    display: flex !important;
}

.custom-modal, .status-modal-box {
    background: #161b29;
    border: 1px solid #2a3042;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    max-width: 500px;
    width: 90%;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Status Modal Specifics */
.status-modal-box {
    padding: 40px;
    text-align: center;
    align-items: center;
    display: block; /* Override flex */
    animation: modalPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.status-icon { font-size: 3rem; margin-bottom: 15px; display: block; }
.status-title { color: white; font-size: 1.5rem; font-weight: 700; margin-bottom: 10px; }
.status-text { color: #a0a5b9; font-size: 1rem; line-height: 1.5; margin-bottom: 25px; }
.status-btn {
    background: #0066cc;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.status-btn:hover { background: #0052a3; }

/* General Modal Parts */
.modal-header { padding: 20px; border-bottom: 1px solid #2a3042; background: #0f111a; border-radius: 12px 12px 0 0; }
.modal-title { font-size: 1.1rem; color: white; font-weight: 600; margin: 0; }
.modal-body { padding: 20px; color: #d1d5db; overflow-y: auto; font-size: 1rem; line-height: 1.6; }
.modal-footer { padding: 15px 20px; background: #0f111a; border-top: 1px solid #2a3042; display: flex; justify-content: flex-end; border-radius: 0 0 12px 12px; }
.modal-btn-cancel { background: transparent; color: #a0a5b9; border: 1px solid #2a3042; padding: 8px 16px; border-radius: 6px; cursor: pointer; }
.modal-btn-cancel:hover { border-color: white; color: white; }

@keyframes modalPopIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
/* =========================================================================
   9. FORM & EDITING UTILITIES (Restored for list-it.php & edit-listing.php)
   ========================================================================= */

/* Main Containers */
.form-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.hero-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 60px 20px;
    background: linear-gradient(180deg, rgba(15,17,26,0) 0%, rgba(0,102,204,0.1) 100%);
    border-bottom: 1px solid #2a3042;
}
.hero-title { font-size: 2.5rem; margin-bottom: 10px; color: white; }
.hero-sub { color: #a0a5b9; font-size: 1.1rem; }

/* Section Wrappers */
.section-wrapper {
    background: #161b29;
    border: 1px solid #2a3042;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
}
.section-title {
    font-size: 1.3rem;
    color: white;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a3042;
    margin-top: 0;
    font-weight: 600;
}

/* Grid System for Forms */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-inline-4 { display: grid; grid-template-columns: 120px 100px 1fr 1fr; gap: 20px; align-items: start; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-inline-4 { grid-template-columns: 1fr; }
}

/* Form Inputs & Groups */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #a0a5b9; font-size: 0.9rem; font-weight: 500; }

.form-control {
    width: 100%;
    background: #0f111a;
    border: 1px solid #2a3042;
    color: #d1d5db;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: #0066cc; }

/* Selection Cards (Sale vs Group Buy) */
.listing-type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.type-card {
    background: rgba(22, 27, 41, 0.6);
    border: 1px solid #2a3042;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.type-card:hover { transform: translateY(-2px); border-color: #4a5568; }
.type-card.active { background: rgba(0, 102, 204, 0.1); border: 2px solid #0066cc; }

.type-icon { font-size: 2.5rem; margin-bottom: 15px; display: block; }
.type-title { font-weight: 700; color: white; font-size: 1.2rem; display: block; margin-bottom: 8px; }
.type-desc { font-size: 0.9rem; color: #a0a5b9; display: block; }

/* Image Upload Manager */
.file-upload-box {
    border: 2px dashed #2a3042;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(22, 27, 41, 0.4);
    transition: border-color 0.2s;
}
.file-upload-box:hover { border-color: #0066cc; }

.image-manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.img-card {
    position: relative;
    height: 140px;
    border: 1px solid #2a3042;
    border-radius: 6px;
    overflow: hidden;
    background: #0f111a;
    /* Sortable.js styles */
    cursor: grab; 
    transition: transform 0.2s, box-shadow 0.2s; 
}
.img-card:active { cursor: grabbing; }
.img-card img { width: 100%; height: 100px; object-fit: cover; display: block; }

.img-actions {
    height: 40px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #1e2538;
    border-top: 1px solid #2a3042;
}

.action-icon {
    background: none; border: none; cursor: pointer; color: #a0a5b9; font-size: 1.1rem; padding: 5px;
}
.action-icon:hover { color: white; }
.action-icon.delete:hover { color: #ff6b6b; }

/* Edit Listing Specifics */
.main-photo-container { 
    border: 2px dashed #0066cc; 
    background: rgba(0, 102, 204, 0.05); 
    padding: 20px; 
    border-radius: 8px; 
    text-align: center; 
    margin-bottom: 30px; 
}
.current-main-img { 
    max-width: 100%; 
    max-height: 300px; 
    border-radius: 6px; 
    border: 1px solid #2a3042; 
    margin: 0 auto 10px auto; 
    display: block; 
}

/* Days of Week Selector */
.days-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
    border-left: 3px solid #0066cc;
}

/* Switches & Toggles */
.switch-wrap { display: flex; align-items: center; gap: 10px; margin-top: 10px; margin-bottom: 10px; }
.switch-label { color: white; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.switch-wrap input[type="checkbox"], .switch-wrap input[type="radio"], .days-grid input {
    accent-color: #0066cc; width: 18px; height: 18px; cursor: pointer;
}

/* Helpers */
.hidden-panel { display: none; margin-top: 10px; padding: 15px; background: rgba(0,0,0,0.2); border-radius: 6px; border-left: 3px solid #0066cc; margin-bottom: 15px; }
.helper-text { display: block; color: #a0a5b9; font-size: 0.8rem; margin-top: 4px; }
.submit-btn {
    display: block; width: 100%; padding: 16px; font-size: 1.1rem;
    font-weight: 700; background: #0066cc; color: white; border: none;
    border-radius: 6px; cursor: pointer; margin-top: 30px; transition: 0.2s;
}
.submit-btn:hover { background: #0052a3; }
.ai-btn { 
    background: transparent; border: 1px solid #0066cc; color: #0066cc; 
    padding: 4px 10px; border-radius: 4px; font-size: 0.8rem; cursor: pointer; 
}
.ai-btn:hover { background: rgba(0, 102, 204, 0.1); }