/* Enhanced Demo Interface Styles - Matching Landing Page Design */

body, html {
  font-family: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  height: 100%;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #333;
  line-height: 1.6;
}

.v2-badge {
  color:#6c757d;
  font-weight: 600;
}
    
.vertical-stack {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.main-content-row {
  display: flex;
  height: 100%;
  width: 100%;
  flex: 1;
}

.main-grids {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* ================================
   ENHANCED HEADER DESIGN
   ================================ */
.main-header {
  height: 90px;
  min-height: 90px;
  max-height: 90px;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 3px solid #e9ecef;
  padding: 0 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  position: relative;
}

.main-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #2a65aa 0%, #6c757d 50%, #28a745 100%);
}

.header-left {
  flex: 0 0 auto;
  margin-right: 30px;
}

.logo {
  height: 60px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.header-right {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  max-width: calc(100% - 120px);
}

.title-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.header-title {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
  text-align: right;
  letter-spacing: 0.8px;
  text-shadow: 0 1px 3px rgba(44, 62, 80, 0.15);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
  transition: font-size 0.2s ease;
}

.ai-text {
  color: #dc3545;
  text-shadow: 0 1px 2px rgba(220, 53, 69, 0.3);
}

.session-cost-label {
  font-size: 15px;
  color: #6c757d;
  text-align: right;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
  transition: font-size 0.2s ease;
}

.session-cost-value {
  font-weight: 700;
  color: #dc3545;
  text-shadow: 0 1px 2px rgba(220, 53, 69, 0.3);
}

/* ================================
   ENHANCED PANEL SYSTEM
   ================================ */
.top-row-grid, .bottom-row-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 0;
}

.top-row-grid {
  grid-template-columns: 1fr 8px 2fr;
  height: 40%;
  min-height: 120px;
}

.bottom-row-grid {
  grid-template-columns: 1fr 8px 2fr;
  flex: 1 1 0%;
  min-height: 150px;
}

.frame {
  display: flex;
  flex-direction: column;
  background: white;
  overflow: hidden;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid #dee2e6;
}

/* ================================
   MODERN PANEL TITLES
   ================================ */
.panel-title {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #dee2e6;
  padding: 8px 16px;
  position: relative;
  letter-spacing: 0.3px;
}

/* AI Panel Special Styling */
#ai-suggestion .panel-title,
#ai-preferences .panel-title {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  color: #1976d2;
  border-bottom: 2px solid #2196f3;
}

/* Cost Display Styling */
.panel-title .cost-display {
  font-weight: 500;
  color: #dc3545;
  font-size: 0.85em;
  text-shadow: 0 1px 2px rgba(220, 53, 69, 0.2);
}

/* ================================
   ENHANCED CONTENT AREAS
   ================================ */
.content {
  padding: 20px;
  overflow: auto;
  flex: 1;
  background: #ffffff;
  position: relative;
}

/* Panel-specific backgrounds */
#categories .content {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

#products .content {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

#viewHistory .content {
  background: linear-gradient(135deg, #fcfcfc 0%, #f8f9fa 100%);
}

#ai-suggestion .content,
#ai-preferences .content {
  background: linear-gradient(135deg, #fafaff 0%, #f8f9fa 100%);
}

#product-description .content {
  background: #ffffff;
}

/* ================================
   MODERN RESIZERS
   ================================ */
.resizer.vertical {
  background: linear-gradient(180deg, #dee2e6 0%, #adb5bd 50%, #dee2e6 100%);
  cursor: col-resize;
  width: 8px !important;
  height: 100%;
  z-index: 10;
  position: relative;
  transition: background 0.2s ease;
}

.resizer.vertical:hover {
  background: linear-gradient(180deg, #2a65aa 0%, #1e4d72 50%, #2a65aa 100%);
}

.resizer.vertical::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 30px;
  background: white;
  border-radius: 2px;
  opacity: 0.7;
}

.resizer.horizontal {
  background: linear-gradient(90deg, #dee2e6 0%, #adb5bd 50%, #dee2e6 100%);
  cursor: row-resize;
  height: 8px !important;
  width: 100%;
  z-index: 10;
  position: relative;
  transition: background 0.2s ease;
}

.resizer.horizontal:hover {
  background: linear-gradient(90deg, #2a65aa 0%, #1e4d72 50%, #2a65aa 100%);
}

.resizer.horizontal::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 3px;
  background: white;
  border-radius: 2px;
  opacity: 0.7;
}

/* ================================
   VIEW HISTORY AREA
   ================================ */
.view-history-outer {
  width: 25%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
}

.view-history-outer[style*="width: 0"] {
  border: none;
  min-width: 0;
}

#ai-preferences {
  height: 40%;
  min-height: 100px;
}

#viewHistory {
  flex: 1 1 0%;
  min-height: 100px;
}

/* ================================
   UNIFIED SELECTION STYLING
   ================================ */

.category-item {
  padding: 12px 18px;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-bottom: 6px;
  border: 1px solid #e9ecef;
  color: #2c3e50;
  font-weight: 500;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.product-item {
  padding: 10px 14px;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-bottom: 6px;
  border: 1px solid #e9ecef;
  color: #2c3e50;
  font-weight: 500;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
}

/* NEW: Product item layout for images */
.product-item-content {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.product-list-image {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e0e0e0;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.product-item-text {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  color: inherit;
  line-height: 1.3;
}

/* Unified hover state - soft blue based on #dde7ff */
.category-item:hover,
.product-item:hover {
  background: linear-gradient(135deg, #f8f9ff 0%, #eef2ff 100%);
  border-color: #c7d2fe;
  color: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(199, 210, 254, 0.4);
}

/* Unified selected state - richer version of #dde7ff with gradient */
.category-item.selected,
.product-item.selected,
.category-item.selected:hover,
.product-item.selected:hover {
  background: linear-gradient(135deg, #dde7ff 0%, #c7d2fe 100%);
  border-color: #a5b4fc;
  color: #3730a3;
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(221, 231, 255, 0.5);
}

/* ================================
   PRODUCT DESCRIPTION AREA
   ================================ */
.product-desc-header {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  gap: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.product-image {
  width: 180px;
  max-width: 33vw;
  max-height: 160px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border: 2px solid #e9ecef;
  flex-shrink: 0;
}

.product-nameprice-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 4px;
}

.product-name {
  font-size: 1.1em;
  font-weight: 700;
  margin-bottom: 4px;
  color: #2c3e50;
  line-height: 1.3;
}

.product-price {
  font-size: 1.1em;
  color: #2c3e50;
  font-weight: 600;
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(220, 53, 69, 0.2);
}

.product-desc-html {
  margin-top: 12px;
  font-size: 0.9em;
  line-height: 1.3;
  color: #495057;
}

/* ================================
   HISTORY ITEMS
   ================================ */
.history-item-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.history-item-image {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #e0e0e0;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.history-item-text {
  flex: 1;
  color: #2c3e50;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;        /* Tighter line spacing */
  min-width: 0;
  word-wrap: break-word;   /* Better text wrapping */
  overflow-wrap: break-word;
}

/* Update existing history item to work with new structure */
.history-item {
  display: flex;
  align-items: center;
  padding: 4px 6px 4px 2px;
  border-radius: 8px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.16s, border 0.16s;
  cursor: pointer;
  gap: 6px; /* Space between trash icon and content */
}

.history-item:hover {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border-color: #ffc107;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

.history-item .history-trash {
  margin-right: 3px;
  transition: filter 0.18s;
}

.history-item:hover .history-trash {
  background: rgba(220, 53, 69, 0.1);
  transform: scale(1.2);
}

.history-trash {
  background: transparent !important;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.history-item .history-product-name {
  flex: 1 1 auto;
  color: #2c3e50;
  font-size: 15px;
  font-weight: 500;
}

.history-view-count {
  color: #1976d2;
  font-weight: 700;
  margin-left: 6px;
  background: #e3f2fd;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 15px;         /* Slightly smaller to fit better */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;     /* Prevent count from wrapping */
}

/* ================================
   INFO PANELS
   ================================ */
.view-history-info {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #2196f3;
  border-radius: 12px;
  padding: 24px 32px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.15);
  text-align: center;
}

.info-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.info-text {
  color: #2c3e50;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
}

/* ================================
   AI LOADING SYSTEM
   ================================ */
.ai-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 12px;
}

.ai-loading-message {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 32px 40px;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border: 3px solid #2196f3;
  text-align: center;
  max-width: calc(100% - 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px;
  overflow: visible;
  animation: subtlePulse 3s ease-in-out infinite;
}

.ai-loading-with-hints {
  max-width: calc(100% - 20px);
  min-height: 200px;
  padding: 30px 40px;
  margin: 10px;
}

.loader-gif {
  width: 56px !important;
  height: 56px !important;
  margin-bottom: 20px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
}

.loader-text {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  line-height: 1.4;
  margin: 0 0 24px 0;
  text-align: center;
}

.loading-separator {
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #2196f3 20%, #2196f3 80%, transparent 100%);
  margin: 20px auto;
  display: block;
  border-radius: 1px;
}

.loading-hints-container {
  width: 100%;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-hint {
  font-size: 15px;
  color: #495057;
  line-height: 1.6;
  text-align: center;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
  max-width: 100%;
  word-wrap: break-word;
  display: block;
  min-height: 50px;
  font-weight: 500;
}

@keyframes subtlePulse {
  0%, 100% { 
    transform: scale(0.95); 
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  }
  50% { 
    transform: scale(1); 
    box-shadow: 0 14px 44px rgba(33, 150, 243, 0.2);
  }
}

/* ================================
   AI CONTENT STYLING
   ================================ */
.ai-preferences-text {
  font-size: 14px;
  line-height: 1.3;
  color: #1976d2;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
  font-weight: 400;
  box-shadow: none;
  text-align: left;
}

.ai-error {
  color: #721c24;
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  padding: 20px;
  border-radius: 12px;
  border: 2px solid #dc3545;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
}

.ai-empty {
  color: #6c757d;
  font-style: italic;
  text-align: center;
  padding: 32px 24px;
  font-size: 16px;
  font-weight: 500;
}

/* ================================
   SUGGESTION ITEMS
   ================================ */
.suggestion-item {
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  margin-bottom: 12px;
  border: 2px solid #e9ecef;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.08);
}

.suggestion-item:hover {
  background: linear-gradient(135deg, #f0f8ff 0%, #eef2ff 100%);
  border-color: #c7d2fe;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(33, 150, 243, 0.15);
}

.suggestion-item.selected {
  background: linear-gradient(135deg, #dde7ff 0%, #c7d2fe 100%);
  border-color: #a5b4fc;
  color: #3730a3 !important;
  transform: translateY(-3px);
  box-shadow: none;
}

.suggestion-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.3;
  color: inherit;
}

.suggestion-reason-container {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.suggestion-image {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  border: 2px solid #e9ecef;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.suggestion-item.selected .suggestion-image {
  border-color: rgba(255,255,255,0.5);
}

.suggestion-reason {
  font-size: 14px;
  color: #1976d2;
  line-height: 1.5;
  font-style: italic;
  font-weight: 500;
  flex: 1;
}

.suggestion-reason::before {
  content: "🤖 AI Reasoning: ";
  font-weight: 700;
  color: #0d47a1;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */
/* Container width-based responsive design for cross-browser compatibility */
.main-grids[style*="width: 8"] .header-title { font-size: 26px; }
.main-grids[style*="width: 8"] .session-cost-label { font-size: 14px; }

.main-grids[style*="width: 7"] .header-title { font-size: 24px; }
.main-grids[style*="width: 7"] .session-cost-label { font-size: 13px; }

.main-grids[style*="width: 6"] .header-title { font-size: 22px; }
.main-grids[style*="width: 6"] .session-cost-label { font-size: 12px; }

.main-grids[style*="width: 5"] .header-title { font-size: 20px; }
.main-grids[style*="width: 5"] .session-cost-label { font-size: 11px; }

.main-grids[style*="width: 4"] .header-title { font-size: 18px; }
.main-grids[style*="width: 4"] .session-cost-label { font-size: 10px; }

.main-grids[style*="width: 3"] .header-title { font-size: 16px; }
.main-grids[style*="width: 3"] .session-cost-label { font-size: 9px; }

.main-grids[style*="width: 2"] .header-title { font-size: 14px; }
.main-grids[style*="width: 2"] .session-cost-label { font-size: 8px; }

/* Additional selectors for more precise width matching */
.main-grids[style*="75%"] .header-title { font-size: 24px; }
.main-grids[style*="75%"] .session-cost-label { font-size: 13px; }

.main-grids[style*="70%"] .header-title { font-size: 22px; }
.main-grids[style*="70%"] .session-cost-label { font-size: 12px; }

.main-grids[style*="65%"] .header-title { font-size: 20px; }
.main-grids[style*="65%"] .session-cost-label { font-size: 11px; }

.main-grids[style*="60%"] .header-title { font-size: 18px; }
.main-grids[style*="60%"] .session-cost-label { font-size: 10px; }

.main-grids[style*="55%"] .header-title { font-size: 16px; }
.main-grids[style*="55%"] .session-cost-label { font-size: 9px; }

.main-grids[style*="50%"] .header-title { font-size: 14px; }
.main-grids[style*="50%"] .session-cost-label { font-size: 8px; }

@media (max-width: 1200px) {
  .header-title {
    font-size: 22px;
  }
  
  .logo {
    height: 50px;
  }
  
  .main-header {
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    padding: 0 20px;
  }
  
  .session-cost-label {
    font-size: 13px;
  }
  
  .header-right {
    max-width: calc(100% - 100px);
  }
  
  /* Adjust container-based scaling for smaller screens */
  .main-grids[style*="75%"] .header-title { font-size: 20px; }
  .main-grids[style*="70%"] .header-title { font-size: 18px; }
  .main-grids[style*="65%"] .header-title { font-size: 16px; }
  .main-grids[style*="60%"] .header-title { font-size: 14px; }
  .main-grids[style*="55%"] .header-title { font-size: 12px; }
  .main-grids[style*="50%"] .header-title { font-size: 11px; }
}

@media (max-width: 900px) {
  .header-title {
    font-size: 18px;
  }
  
  .session-cost-label {
    font-size: 12px;
  }
  
  .header-right {
    max-width: calc(100% - 80px);
  }
  
  /* Further adjust for mobile */
  .main-grids[style*="75%"] .header-title { font-size: 16px; }
  .main-grids[style*="70%"] .header-title { font-size: 14px; }
  .main-grids[style*="65%"] .header-title { font-size: 12px; }
  .main-grids[style*="60%"] .header-title { font-size: 11px; }
  .main-grids[style*="55%"] .header-title { font-size: 10px; }
  .main-grids[style*="50%"] .header-title { font-size: 9px; }
}

@media (max-width: 768px) {
  .main-header {
    flex-direction: column;
    height: auto;
    min-height: 100px;
    padding: 15px;
  }
  
  .header-left {
    margin-right: 0;
    margin-bottom: 10px;
  }
  
  .header-right {
    align-items: center;
  }
  
  .title-line {
    align-items: center;
  }
  
  .header-title {
    font-size: 20px;
    text-align: center;
  }
  
  .frame {
    margin: 4px;
  }
}