/* ------------------------------------------------------------------
VikBooking AI Search – Main Stylesheet
FIXED: Search bar dimension consistency between BM25 and AI modes
------------------------------------------------------------------ */
/* Google Sans font import */
@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 - EXACT DIMENSIONS MATCH TO BM25 MODE */
.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; /* Google's exact height */
transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
width: 100%;
max-width: 100%; /* Changed from 760px to match BM25 */
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 - same dimensions, just different colors */
.srs-input-wrapper .search-wrapper.ai-mode-active {
background: linear-gradient(145deg, #f8f9ff, #ffffff);
border: 2px solid #1a73e8;
border-radius: 40px; /* Keep same radius */
box-shadow: 0 4px 20px rgba(26, 115, 232, 0.28);
height: 56px; /* Same height as normal mode */
padding: 0 14px 0 20px; /* Same padding as normal mode */
max-width: 100%; /* Changed from 760px to match BM25 */
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; /* Keep same size */
}

/* 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;
}

/* Blinking cursor effect */
.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 - repositioned */
.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%; /* Changed from 760px to match BM25 */
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 - CRITICAL FIX: Positioned identically to BM25 toggle 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 – Filter panel + vertical results */
.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-content {
max-width: 1400px;
margin: 30px auto;
padding: 30px;
background: white;
position: relative;
border-radius: 16px;
min-height: 80vh;
}

.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-close-btn:hover {
background: #1557b0;
transform: rotate(90deg);
}

/* Layout: filter panel left, results right */
.srs-popup-layout {
display: flex;
gap: 30px;
margin-top: 20px;
}

/* FILTER PANEL */
.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-filter-search {
margin-bottom: 25px;
text-align: left !important;
}

#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-filter-property:focus {
border-color: #1a73e8;
outline: none;
}

.srs-filter-group {
margin-bottom: 25px;
text-align: left !important;
}

.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-filter-group label {
display: block;
margin-bottom: 8px;
font-size: 14px;
color: #333;
cursor: pointer;
text-align: left !important;
}

.srs-filter-group input[type="checkbox"] {
margin-right: 8px;
accent-color: #1a73e8;
transform: scale(1.1);
cursor: pointer;
}

/* VERTICAL RESULTS COLUMN */
.srs-results-column {
flex: 1;
min-width: 0;
text-align: left !important;
}

.srs-results-vertical {
display: flex;
flex-direction: column;
gap: 15px;
text-align: left !important;
}

/* Room row card - TIGHT LAYOUT */
.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-room-row:hover {
transform: translateY(-2px);
box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

/* Image - FIXED SIZE */
.srs-row-photo {
width: 200px;
height: 150px;
flex-shrink: 0;
}

.srs-row-photo img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 8px;
}

/* Increase right padding to give enough room for the location badge */
.srs-row-content {
flex: 1;
display: flex;
flex-direction: column;
gap: 4px;
text-align: left !important;
height: 150px;
overflow: hidden;
padding-right: 200px;
}

/* Property Title - BLACK COLOR */
.srs-room-title {
font-size: 16px;
color: #000000;
margin: 0;
font-weight: 600;
text-align: left !important;
line-height: 1.2;
}

/* Description - SINGLE LINE ONLY */
.srs-room-desc {
font-size: 13px;
color: #555;
margin: 0;
line-height: 1.3;
text-align: left !important;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* AI Analysis - Max 3 lines */
.srs-ai-explanation {
display: flex;
align-items: flex-start;
gap: 6px;
background: #f0ebf5;
padding: 8px 10px;
border-radius: 8px;
margin: 0;
border-left: 3px solid #1a73e8;
text-align: left !important;
flex: 1;
overflow: hidden;
}

.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-explanation-text {
font-size: 13px;
color: #2c3e50;
line-height: 1.3;
flex: 1;
text-align: left !important;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* ONLY "Why this property?" is bold */
.srs-why-bold {
font-weight: 700;
color: #1a73e8;
}

/* Skeleton loader for AI explanation */
.srs-explanation-text.srs-skeleton {
display: inline-block;
height: 1.2em;
width: 100%;
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: skeleton-loading 1.5s infinite;
border-radius: 4px;
color: transparent;
-webkit-line-clamp: unset;
}

@keyframes skeleton-loading {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}

/* View Details Button */
.srs-room-link {
align-self: flex-start;
background: #1a73e8;
color: #ffffff;
text-decoration: none;
padding: 6px 14px;
border-radius: 20px;
font-size: 13px;
font-weight: 500;
transition: background 0.2s, transform 0.2s;
margin-top: 0;
display: inline-block;
border: 2px solid #1a73e8;
}

.srs-room-link:hover {
background: #1557b0;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(26, 115, 232, 0.3);
color: #ffffff;
}

/* Location - RIGHT SIDE OF EACH ROW */
.srs-room-location {
position: absolute;
top: 12px;
right: 12px;
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: 1;
white-space: nowrap;
max-width: 200px;
}

.location-icon {
font-size: 14px;
}

/* Scrollbar styling */
#srs-suggestions::-webkit-scrollbar,
.srs-filter-panel::-webkit-scrollbar {
width: 8px;
}

#srs-suggestions::-webkit-scrollbar-track,
.srs-filter-panel::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 4px;
}

#srs-suggestions::-webkit-scrollbar-thumb,
.srs-filter-panel::-webkit-scrollbar-thumb {
background: #1a73e8;
border-radius: 4px;
}

#srs-suggestions::-webkit-scrollbar-thumb:hover,
.srs-filter-panel::-webkit-scrollbar-thumb:hover {
background: #1557b0;
}

/* Responsive */
@media (max-width: 768px) {
.srs-popup-layout {
flex-direction: column;
}

.srs-filter-panel {
width: 100%;
max-height: none;
}

.srs-room-row {
flex-direction: column;
height: auto;
}

.srs-row-photo {
width: 100%;
height: 200px;
}

.srs-row-content {
height: auto;
padding-right: 0;
}

.srs-room-location {
position: relative;
top: auto;
right: auto;
margin-top: 8px;
align-self: flex-start;
}

.srs-container {
padding: 0 1rem;
}

/* Mobile search bar adjustments */
.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;
}
}