/* ------------------------------------------------------------------
VikBooking AI Search – Main Stylesheet
FIXED: Button spacing & location/description overlap
------------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500&display=swap');

/* ========== CONTAINER & INPUT ========== */
.srs-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    text-align: center;
    position: relative;
}
.srs-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Google-style search wrapper */
.srs-input-wrapper .search-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid transparent;
    border-radius: 40px;
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
    padding: 0 14px 0 20px;
    height: 56px;
    transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
}
.srs-input-wrapper .search-wrapper:hover {
    box-shadow: 0 4px 12px rgba(32, 33, 36, 0.22);
    border-color: rgba(223, 225, 229, 0.5);
}

/* AI MODE WRAPPER */
.srs-input-wrapper .search-wrapper.ai-mode-active {
    background: linear-gradient(145deg, #f8f9ff, #ffffff);
    border: 2px solid #1a73e8;
    border-radius: 40px;
    box-shadow: 0 4px 20px rgba(26, 115, 232, 0.28);
    height: 56px;
    padding: 0 14px 0 20px;
    max-width: 100%;
    margin: 0 auto;
}

/* Search icon */
.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #9aa0a6;
    transition: all 0.2s;
    flex-shrink: 0;
}
.ai-mode-active .search-icon {
    color: #1a73e8;
    transform: scale(1.1);
}
.search-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Search input */
#srs-query {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 18px;
    font-weight: 400;
    font-family: 'Google Sans', Arial, sans-serif;
    color: #202124;
    letter-spacing: 0.2px;
    padding: 8px 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    line-height: normal;
    box-sizing: border-box;
}
.ai-mode-active #srs-query {
    font-weight: 450;
    font-size: 18px;
}

/* Placeholder styling */
#srs-query::placeholder {
    color: #8e9196;
    font-weight: 400;
    font-size: 17px;
    transition: all 0.2s;
    font-style: normal;
    opacity: 1;
    font-family: 'Google Sans', Arial, sans-serif;
}
.ai-mode-active #srs-query::placeholder {
    color: #1a73e8;
    opacity: 0.8;
    font-weight: 450;
    font-style: normal;
}

/* Typing cursor animation */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 24px;
    background-color: #1a73e8;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Hide old search button */
.srs-search-btn {
    display: none;
}

/* Loading spinner */
.srs-loading {
    display: none;
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}
.srs-spinner {
    border: 2px solid #e8eaed;
    border-top: 2px solid #1a73e8;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Suggestions dropdown */
#srs-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-width: 100%;
    margin: 8px auto 0;
    right: 0;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    list-style: none;
    padding: 8px 0;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(32, 33, 36, 0.18);
    animation: slideDown 0.2s ease-out;
    text-align: left;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
#srs-suggestions li {
    padding: 12px 24px;
    cursor: pointer;
    font-size: 16px;
    color: #202124;
    transition: all 0.2s;
    border-bottom: none;
    text-align: left;
    font-family: 'Google Sans', Arial, sans-serif;
}
#srs-suggestions li:last-child {
    border-bottom: none;
}
#srs-suggestions li:hover,
#srs-suggestions li.active {
    background: #f1f3f4;
    color: #202124;
    padding-left: 28px;
}

/* OpenAI prediction suggestion */
.srs-openai-suggestion {
    background: #e8f0fe !important;
    color: #1a73e8 !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
    border-left: 3px solid #1a73e8 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    text-align: left !important;
    font-weight: 500 !important;
}
.srs-openai-suggestion:hover,
.srs-openai-suggestion.active {
    background: #d2e3fc !important;
    transform: translateX(0);
    box-shadow: none !important;
}
.srs-openai-suggestion::before {
    content: "✨ ";
    color: #1a73e8;
    font-weight: normal;
    margin-right: 4px;
}

/* Special suggestions */
.srs-special-suggestion {
    background: linear-gradient(145deg, #f8f9ff, #ffffff) !important;
    color: #1a73e8 !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
    border-left: 3px solid #1a73e8 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: none !important;
    text-align: left !important;
    font-weight: 500 !important;
}
.srs-special-suggestion:hover,
.srs-special-suggestion.active {
    background: #f1f3f4 !important;
    transform: translateY(0);
    box-shadow: none !important;
}
.srs-special-suggestion strong {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
}

/* Separator */
.srs-separator {
    padding: 0 !important;
    margin: 4px 0 !important;
    cursor: default !important;
    background: transparent !important;
}
.srs-separator hr {
    margin: 4px 0;
    border: none;
    border-top: 1px solid #e8eaed;
}

/* BACK BUTTON */
.toggle-bm25-mode-btn {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    background: linear-gradient(145deg, #5f6368, #3c4043);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    font-family: 'Google Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(95, 99, 104, 0.3);
    transition: all 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    line-height: 1;
    white-space: nowrap;
}
.toggle-bm25-mode-btn:hover {
    background: linear-gradient(145deg, #4a4e52, #2a2c2e);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 8px rgba(95, 99, 104, 0.4);
}

/* ========== POPUP OVERLAY ========== */
#srs-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: fadeIn 0.3s;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#srs-popup-overlay .srs-popup-content {
    max-width: 1400px;
    margin: 30px auto;
    padding: 30px;
    background: white;
    position: relative;
    border-radius: 16px;
    min-height: 80vh;
}

#srs-popup-overlay .srs-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s, transform 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
#srs-popup-overlay .srs-close-btn:hover {
    background: #1557b0;
    transform: rotate(90deg);
}

/* Layout */
#srs-popup-overlay .srs-popup-layout {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

/* FILTER PANEL */
#srs-popup-overlay .srs-filter-panel {
    width: 280px;
    flex-shrink: 0;
    background: #f8f5fa;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    text-align: left !important;
}
#srs-popup-overlay .srs-filter-search {
    margin-bottom: 25px;
    text-align: left !important;
}
#srs-popup-overlay #srs-filter-property {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 15px;
    transition: border-color 0.2s;
    text-align: left;
}
#srs-popup-overlay #srs-filter-property:focus {
    border-color: #1a73e8;
    outline: none;
}
#srs-popup-overlay .srs-filter-group {
    margin-bottom: 25px;
    text-align: left !important;
}
#srs-popup-overlay .srs-filter-group h4 {
    font-size: 16px;
    color: #1a73e8;
    margin: 0 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
    text-align: left !important;
}
#srs-popup-overlay .srs-filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    text-align: left !important;
}
#srs-popup-overlay .srs-filter-group input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #1a73e8;
    transform: scale(1.1);
    cursor: pointer;
}

/* VERTICAL RESULTS COLUMN */
#srs-popup-overlay .srs-results-column {
    flex: 1;
    min-width: 0;
    text-align: left !important;
}
#srs-popup-overlay .srs-results-vertical {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left !important;
}

/* Room row card - FIXED LAYOUT */
#srs-popup-overlay .srs-room-row {
    display: flex;
    background: #f9f9f9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 12px;
    gap: 15px;
    position: relative;
    align-items: flex-start;
    height: 180px;
    box-sizing: border-box;
}
#srs-popup-overlay .srs-room-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

/* Image */
#srs-popup-overlay .srs-row-photo {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
}
#srs-popup-overlay .srs-row-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* Content area - CRITICAL FIX: Theme override protection */
#srs-popup-overlay .srs-row-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important; /* INCREASED from 6px for better spacing */
    text-align: left !important;
    height: 150px !important;
    overflow: hidden !important;
    padding-right: 210px !important; /* INCREASED from 180px to prevent location overlap */
    box-sizing: border-box !important;
    all: initial !important;
    font-family: 'Google Sans', Arial, sans-serif !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    color: #333 !important;
}

/* Property Title - BLACK COLOR */
#srs-popup-overlay .srs-room-title {
    font-size: 16px !important;
    color: #000000 !important;
    margin: 0 !important;
    font-weight: 600 !important;
    text-align: left !important;
    line-height: 1.2 !important;
    font-family: 'Google Sans', Arial, sans-serif !important;
    display: block !important;
}

/* Description - SINGLE LINE ONLY */
#srs-popup-overlay .srs-room-desc {
    font-size: 13px !important;
    color: #555 !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    text-align: left !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 1.2em !important;
    font-family: 'Google Sans', Arial, sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: normal !important;
}

/* AI Analysis - Max 2 lines for better spacing */
#srs-popup-overlay .srs-ai-explanation {
    display: flex !important;
    align-items: flex-start !important;
    gap: 6px !important;
    background: #f0ebf5 !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    margin: 0 !important;
    margin-bottom: 4px !important; /* EXTRA BUFFER before button */
    border-left: 3px solid #1a73e8 !important;
    text-align: left !important;
    flex: 1 !important;
    overflow: hidden !important;
    font-family: 'Google Sans', Arial, sans-serif !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
}
#srs-popup-overlay .srs-ai-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #1a73e8;
    font-size: 16px;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(26, 115, 232, 0.6));
    animation: glow 2s infinite;
    flex-shrink: 0;
}
.spark-large {
    font-size: 18px;
    transform: rotate(-5deg);
    margin-bottom: -4px;
}
.spark-small {
    font-size: 14px;
    transform: rotate(8deg) translateX(4px);
    opacity: 0.9;
}
@keyframes glow {
    0% { filter: drop-shadow(0 0 2px rgba(26, 115, 232, 0.4)); }
    50% { filter: drop-shadow(0 0 8px rgba(26, 115, 232, 0.9)); }
    100% { filter: drop-shadow(0 0 2px rgba(26, 115, 232, 0.4)); }
}
#srs-popup-overlay .srs-explanation-text {
    font-size: 13px !important;
    color: #2c3e50 !important;
    line-height: 1.3 !important;
    flex: 1 !important;
    text-align: left !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-family: 'Google Sans', Arial, sans-serif !important;
}
#srs-popup-overlay .srs-why-bold {
    font-weight: 700 !important;
    color: #1a73e8 !important;
}
#srs-popup-overlay .srs-explanation-text.srs-skeleton {
    display: inline-block !important;
    height: 1.2em !important;
    width: 100% !important;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%) !important;
    background-size: 200% 100% !important;
    animation: skeleton-loading 1.5s infinite !important;
    border-radius: 4px !important;
    color: transparent !important;
    -webkit-line-clamp: unset !important;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* View Details Button - FIXED: Always visible at bottom */
#srs-popup-overlay .srs-room-link {
    align-self: flex-start !important;
    background: #1a73e8 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: background 0.2s, transform 0.2s !important;
    margin-top: auto !important;
    display: inline-block !important;
    border: 2px solid #1a73e8 !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    font-family: 'Google Sans', Arial, sans-serif !important;
}
#srs-popup-overlay .srs-room-link:hover {
    background: #1557b0 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.3) !important;
    color: #ffffff !important;
}

/* Location - RIGHT SIDE OF EACH ROW - OVERLAP FIX */
#srs-popup-overlay .srs-room-location {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
    background: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 5 !important; /* RAISED to sit above text */
    white-space: nowrap !important;
    max-width: 200px;
}
#srs-popup-overlay .location-icon {
    font-size: 14px;
}

/* Scrollbar styling */
#srs-suggestions::-webkit-scrollbar,
#srs-popup-overlay .srs-filter-panel::-webkit-scrollbar {
    width: 8px;
}
#srs-suggestions::-webkit-scrollbar-track,
#srs-popup-overlay .srs-filter-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
#srs-suggestions::-webkit-scrollbar-thumb,
#srs-popup-overlay .srs-filter-panel::-webkit-scrollbar-thumb {
    background: #1a73e8;
    border-radius: 4px;
}
#srs-suggestions::-webkit-scrollbar-thumb:hover,
#srs-popup-overlay .srs-filter-panel::-webkit-scrollbar-thumb:hover {
    background: #1557b0;
}

/* Responsive */
@media (max-width: 768px) {
    #srs-popup-overlay .srs-popup-layout {
        flex-direction: column;
    }
    #srs-popup-overlay .srs-filter-panel {
        width: 100%;
        max-height: none;
    }
    #srs-popup-overlay .srs-room-row {
        flex-direction: column;
        height: auto;
    }
    #srs-popup-overlay .srs-row-photo {
        width: 100%;
        height: 200px;
    }
    #srs-popup-overlay .srs-row-content {
        height: auto;
        padding-right: 0 !important;
    }
    #srs-popup-overlay .srs-room-location {
        position: relative;
        top: auto;
        right: auto;
        margin-top: 8px;
        align-self: flex-start;
    }
    .srs-container {
        padding: 0 1rem;
    }
    .srs-input-wrapper .search-wrapper,
    .srs-input-wrapper .search-wrapper.ai-mode-active {
        height: 52px;
        max-width: 100%;
    }
    #srs-suggestions {
        max-width: 100%;
        margin-left: 16px;
        margin-right: 16px;
        width: auto;
    }
}
@media (max-width: 550px) {
    .srs-input-wrapper .search-wrapper,
    .srs-input-wrapper .search-wrapper.ai-mode-active {
        height: 48px;
        padding: 0 12px 0 16px;
    }
    #srs-query {
        font-size: 16px;
    }
    #srs-query::placeholder {
        font-size: 15px;
    }
    .search-icon svg {
        width: 18px;
        height: 18px;
    }
    .toggle-bm25-mode-btn {
        right: 10px;
        font-size: 11px;
        padding: 2px 8px;
        height: 26px;
    }
}