/* XBurg AI Realtor - Fullscreen Layout */

/* Complete CSS reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 
 * NOTICE: CSS variables are now centralized in styles.css
 * This file uses those variables but doesn't redefine them
 * See styles.css for all available variables
 */

/* Main container */
.app-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  background-color: var(--white);
}

/* Content container - standardized across all pages */
.content-container {
  flex: 1;
  width: 100%;
  height: calc(100% - 60px); /* Account for header height */
  overflow: hidden; /* Changed from overflow-y: auto to prevent scrolling issues */
  display: flex;
  flex-direction: row; /* Changed from column to row for side-by-side panels */
}

/* Override for detail pages (project-detail.html and property-detail.html) to allow vertical scrolling */
.property-detail-container {
  overflow-y: auto;
  padding-bottom: 40px; /* Add some padding at the bottom for better scrolling */
}

/* Styling for detail pages with content containers */
.detail-page .content-container,
.content-container .property-detail-container {
  overflow-y: auto;
}

/* Specific styling for different page types */
.detail-page .content-container {
  flex-direction: column; /* For detail pages, use column layout */
}

/* Main header - full width */
.main-header {
  width: 100%;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background-color: var(--white);
  border-bottom: 1px solid var(--medium-grey);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  z-index: 200;
}

/* Logo in header */
.main-header .logo {
  display: flex;
  align-items: center;
}

.main-header .logo-img {
  height: 24px;
  margin-right: 10px;
}

.main-header .logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--xburg-purple);
  letter-spacing: 0.5px;
}

/* Header tagline */
.header-tagline {
  flex: 1;
  text-align: center;
  margin: 0 20px;
}

.header-tagline blockquote {
  margin: 0;
  padding: 8px 20px;
  background: linear-gradient(135deg, rgba(79, 15, 135, 0.05), rgba(79, 15, 135, 0.1));
  border-radius: 20px;
}

.header-tagline blockquote p {
  font-size: 13px;
  color: var(--xburg-purple);
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

/* Header controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-chat, .btn-comparison {
  padding: 8px 16px;
  border: none;
  background-color: var(--light-grey);
  color: var(--text-color);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative; /* For badge positioning */
}

/* Initially hide comparison button until there are projects to compare */
.btn-comparison {
  display: none;
}

.btn-chat:hover, .btn-comparison:hover {
  background-color: var(--medium-grey);
}

/* Active state for header buttons */
.btn-chat.active, .btn-comparison.active {
  background-color: var(--xburg-purple);
  color: var(--white);
}

/* Comparison count badge */
.comparison-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: var(--xburg-purple); /* Red badge color */
  color: white;
  border-radius: 50%; /* Perfect circle */
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid white; /* White border for visibility */
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  z-index: 10; /* Ensure it appears above button */
}

.btn-voice {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--white);
  border: 1px solid var(--medium-grey);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-voice:hover {
  background-color: var(--light-grey);
}

.btn-voice i {
  color: var(--xburg-purple);
  font-size: 14px;
}

/* Content container - holds chat and map - specific to the index page */
.index-page .content-container {
  display: flex;
  flex: 1;
  width: 100%;
  height: calc(100% - 60px);
  overflow: hidden;
  min-height: 500px; /* Add minimum height to ensure visibility */
}

/* Chat panel */
.chat-panel {
  width: 25%;
  height: 100%;
  border-right: 1px solid var(--medium-grey);
  overflow: hidden;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  background-color: var(--white);
  transition: opacity 0.3s ease; /* Smooth transition for visibility changes */
}

/* Chat header */
.chat-header {
  height: 60px;
  padding: 0 15px;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 24px;
  margin-right: 8px;
}

.logo-text {
  font-weight: bold;
  color: var(--xburg-purple);
}

.chat-controls {
  display: flex;
  gap: 10px;
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background-color: #f7f7f7;
}

/* Message styles */
.message {
  margin-bottom: 15px;
  display: flex;
}

.ai-message {
  justify-content: flex-start;
}

.user-message {
  justify-content: flex-end;
}

.message-content {
  max-width: 100%;
  padding: 10px 15px;
  border-radius: 12px;
}

.ai-message .message-content {
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 12px 12px 12px 0;
}

.user-message .message-content {
  background-color: var(--xburg-purple);
  color: white;
  border-radius: 12px 12px 0 12px;
}

/* Property cards in chat */
.property-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 10px;
  padding: 5px 0;
}

.property-card {
  flex: 0 0 auto;
  width: 160px;
  background-color: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
  padding: 10px;
}

.property-price {
  font-weight: bold;
  color: var(--xburg-purple);
  margin-bottom: 5px;
}

/* Chat input area */
.chat-input {
  height: auto;
  padding: 15px;
  background-color: #fff;
  border-top: 1px solid #eee;
}

.input-container {
  display: flex;
  background-color: #f5f5f5;
  border-radius: 20px;
  padding: 5px;
  overflow: hidden;
}

.input-container input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  outline: none;
}

.input-container button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: var(--xburg-purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #eee;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Map panel */
.map-panel {
  width: 75%;
  height: 100%; 
  position: relative;
  flex: 1;
  transition: width 0.3s ease; /* Smooth transition for width changes */
}

/* Ensure the map container takes full height */
#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  min-height: 500px; /* Add minimum height to ensure visibility */
}

/* Fixed popup container for project details */
#custom-popup-container {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 999;
  max-width: 340px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transition: all 0.3s ease;
  display: none; /* Hidden by default */
}

#custom-popup-container.visible {
  display: block;
}

/* Close button for fixed popup */
#custom-popup-container .popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: white;
  border: none;
  font-size: 25px;
  color: var(--xburg-purple);
  cursor: pointer;
  z-index: 1000;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

#custom-popup-container .popup-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

/* Media queries for responsive design */
@media (max-width: 768px) {
  /* Set base width for mobile view */
  .app-container {
    min-width: 375px;
    flex-direction: column;
  }
  
  /* Make sure content container has proper flex settings for mobile */
  .content-container {
    display: flex;
    flex-direction: column; /* Normal column order: map top, chat bottom */
    height: calc(100vh - 100px); /* Account for mobile header height + tagline space */
    overflow: hidden;
    margin-top: 50px; /* Increased space for the tagline below header */
  }
  
  /* Move tagline below header on mobile */
  .header-tagline {
    position: absolute;
    top: 50px; /* Below the mobile header (50px height) */
    left: 0;
    right: 0;
    margin: 0;
    padding: 5px 10px 8px 10px; /* Reduced top/bottom padding */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(79, 15, 135, 0.1);
    z-index: 1000;
  }
  
  .header-tagline blockquote {
    padding: 6px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(79, 15, 135, 0.08), rgba(79, 15, 135, 0.12));
  }
  
  .header-tagline blockquote p {
    font-size: 12px;
    letter-spacing: 0.2px;
    line-height: 1.3;
    text-align: center;
  }
  
  /* Update panel heights for 50/50 split */
  .chat-panel {
    width: 100%;
    height: 50%; /* Changed to 50% for equal split */
    order: 2; /* Chat at bottom */
    border-right: none;
    border-top: 1px solid var(--medium-grey);
    border-radius: 20px 20px 0 0; /* Rounded top corners for free vibe */
    overflow: hidden; /* Ensure content respects rounded corners */
  }
  
  /* Map panel takes remaining height when chat is visible, full height when hidden */
  .map-panel {
    width: 100%;
    height: 50%; /* Changed to 50% for equal split */
    order: 1; /* Map at top */
  }
  
  /* When chat is hidden on mobile, map should take full height */
  .chat-panel[style*="display: none"] + .map-panel,
  .chat-panel[style="display: none;"] + .map-panel,
  .map-panel:only-child {
    height: 100% !important;
  }
  
  /* Make sure map actually displays */
  #map {
    display: block;
    width: 100%;
    height: 100%;
    z-index: 10;
  }

  /* Mobile-specific UI adjustments */
  .main-header {
    height: 50px; /* Slightly smaller header on mobile */
    padding: 0 10px;
  }
  
  .main-header .logo-img {
    height: 20px;
  }
  
  .btn-chat, .btn-comparison {
    padding: 4px 10px;
    font-size: 12px;
  }

  /* Chat input adjustments */
  .chat-input {
    padding: 8px;
  }

  .input-container {
    padding: 3px;
  }

  .input-container input {
    padding: 8px;
    font-size: 14px;
  }

  .chat-actions {
    margin-top: 6px;
    gap: 10px;
  }

  .action-btn, .btn-voice {
    width: 28px;
    height: 28px;
  }

  /* Comparison section limited to 2 items */
  .comparison-overlay .property-card:nth-child(n+3) {
    display: none;
  }
  
  /* Chat message styling for mobile */
  .chat-messages {
    padding: 12px 10px;
    gap: 0px; /* Reduced gap between messages */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Thin scrollbar for Firefox */
    scroll-behavior: smooth; /* Smooth scrolling when programmatically scrolled */
  }
  
  /* Scrollbar styling for mobile */
  .chat-messages::-webkit-scrollbar {
    width: 4px; /* Thinner scrollbar for mobile */
  }
  
  .chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2); /* More subtle scrollbar */
    border-radius: 4px;
  }
  
  /* Message bubbles styling */
  .message-content {
    padding: 10px 14px;
    font-size: 15px; /* Slightly larger for better readability */
    border-radius: 16px; /* Slightly reduced border radius */
  }
  
  /* AI message specific styling */
  .ai-message .message-content {
    border-radius: 16px 16px 16px 4px;
  }
  
  /* User message specific styling */
  .user-message .message-content {
    border-radius: 16px 16px 4px 16px;
    margin-left: 10px; /* Add some left margin */
  }
  
  /* Mobile responsiveness for fixed popup */
  #custom-popup-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: 250px;
    width: auto;
  }
}
