@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #f4f6f8;
  --panel-bg: #ffffff;
  --card-bg: #ffffff;
  --card-hover-bg: #ffffff;
  --border-color: #e9ebed;
  --border-hover: #00a950;
  
  --text-primary: #2d3136;
  --text-secondary: #5e656d;
  --text-muted: #8a929a;
  
  --alser-green: #00a950;
  --alser-orange: #ff6f00;
  --alser-red: #e53935;
  
  --font-sans: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
  --transition-smooth: all 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Top Utility Bar */
.top-utility-bar {
  background: #ffffff;
  border-bottom: 1px solid #e9ebed;
  padding: 0.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #5e656d;
}

.utility-left {
  display: flex;
  gap: 1.5rem;
}

.utility-left a {
  color: #5e656d;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.utility-left a:hover {
  color: var(--alser-green);
}

.utility-right {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.utility-right span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.utility-right span:hover {
  color: var(--alser-green);
}

header {
  display: none;
}

.logo-container-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.75rem;
}

.main-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1.5rem;
}

.logo-container-alser {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.alser-logo-main {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--alser-green);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.alser-logo-kz {
  color: var(--alser-orange);
}

.logo-subtext {
  font-size: 0.7rem;
  font-weight: 700;
  color: #5e656d;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: -4px;
}

.catalog-btn-alser {
  background: var(--alser-green);
  color: white;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.catalog-btn-alser:hover {
  background: #008f43;
}

.search-bar-alser {
  flex: 1;
  max-width: 500px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-alser {
  position: absolute;
  left: 1rem;
  color: #8a929a;
  width: 18px;
  height: 18px;
}

.search-bar-alser input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1px solid #e9ebed;
  border-radius: 24px;
  background: #f8f9fa;
  font-size: 0.9rem;
  color: #2d3136;
  outline: none;
  transition: var(--transition-smooth);
}

.search-bar-alser input:focus {
  border-color: var(--alser-green);
  background: #ffffff;
}

.header-actions-alser {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.action-item-alser {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: #5e656d;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.action-item-alser svg {
  width: 22px;
  height: 22px;
}

.action-item-alser:hover {
  color: var(--alser-green);
}

/* Settings Controls in Header */
.settings-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid #e9ebed;
  padding-top: 0.5rem;
}

.settings-bar input, .settings-bar select {
  background: #f8f9fa;
  border: 1px solid #e9ebed;
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition-smooth);
}

.settings-bar input:focus, .settings-bar select:focus {
  border-color: var(--alser-green);
  background: #ffffff;
}

.key-input {
  width: 260px;
}

/* Main Layout */
.app-container {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  gap: 1.5rem;
  padding: 1.5rem;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar / Assistant Panel */
.assistant-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.assistant-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.assistant-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.assistant-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Voice Interface Section */
.voice-interface {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 169, 80, 0.05);
}

.live-btn {
  width: 100%;
  max-width: 280px;
  padding: 1rem;
  border-radius: 12px;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: var(--transition-smooth);
  outline: none;
  background-color: var(--alser-green);
  color: white;
}

.live-btn:hover {
  background-color: #008f43;
}

.live-btn.connected {
  background-color: #ef4444;
}

.live-btn.connected:hover {
  background-color: #dc2626;
}

.mic-status-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  height: 20px;
  text-align: center;
}

.mic-status-text.active {
  color: var(--alser-green);
  font-weight: 600;
}

/* Mute Control styling */
.mute-control-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.mute-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
  background: #f8f9fa;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.mute-label:hover {
  border-color: var(--alser-green);
  color: var(--text-primary);
}

.mute-label input[type="checkbox"] {
  accent-color: var(--alser-green);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.mute-text {
  font-weight: 500;
}

/* Waveform Visualizer */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  opacity: 0;
  transition: var(--transition-smooth);
}

.waveform.active {
  opacity: 1;
}

.wave-bar {
  width: 3px;
  height: 4px;
  background-color: var(--alser-green);
  border-radius: 3px;
  animation: wave-bounce 1s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-bar:nth-child(6) { animation-delay: 0.3s; }
.wave-bar:nth-child(7) { animation-delay: 0.2s; }
.wave-bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes wave-bounce {
  0% { height: 4px; }
  100% { height: 24px; }
}

/* Chat Messages Area */
.chat-container {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.message {
  max-width: 85%;
  padding: 0.875rem 1.125rem;
  border-radius: 12px;
  font-size: 0.925rem;
  line-height: 1.4;
}

.message.user {
  align-self: flex-end;
  background: #f3f4f6;
  border: 1px solid var(--border-color);
  border-bottom-right-radius: 4px;
  color: var(--text-primary);
}

.message.assistant {
  align-self: flex-start;
  background: #e8f7ee;
  border: 1px solid rgba(0, 169, 80, 0.2);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.message.system {
  align-self: center;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: center;
  max-width: 100%;
}

.loading-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 8px;
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: dot-pulse 1.4s infinite ease-in-out both;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* Chat Input Bar */
.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  background: #ffffff;
}

.chat-input-area input {
  flex: 1;
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  font-family: var(--font-sans);
  transition: var(--transition-smooth);
}

.chat-input-area input:focus {
  border-color: var(--alser-green);
}

.send-btn {
  background: var(--alser-green);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.send-btn:hover {
  background: #008f43;
  transform: scale(1.05);
}

/* Main Display / Products Panel */
.products-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.panel-title h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-title p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.results-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Products Grid */
.products-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: max-content;
  gap: 1.25rem;
  padding-bottom: 1.5rem;
}

.products-grid::-webkit-scrollbar {
  width: 6px;
}

.products-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* No Results State */
.no-results {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem;
  color: var(--text-secondary);
  background: var(--panel-bg);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
}

.no-results svg {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.no-results h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.no-results p {
  max-width: 400px;
  font-size: 0.9rem;
}

/* Product Card */
.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.product-card:hover {
  transform: translateY(-2px);
  background: var(--card-hover-bg);
  border-color: var(--border-hover);
}

.product-image-container {
  aspect-ratio: 1.2;
  width: 100%;
  background: #fff;
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.product-image {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--alser-orange);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: white;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  flex-shrink: 0;
}

.product-brand {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

.product-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.7em;
}

.product-price-section {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: auto;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.product-price-old {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.product-loan {
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.loan-logo {
  height: 14px;
  object-fit: contain;
}

.loan-text {
  color: var(--text-secondary);
}

.loan-price {
  font-weight: 700;
  color: var(--alser-green);
}

.buy-btn {
  width: 100%;
  background: var(--alser-green);
  border: none;
  color: white;
  padding: 0.75rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.buy-btn:hover {
  background: #008f43;
}

/* Speak Response Overlay Alert */
.speaking-overlay {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.speaking-indicator {
  display: flex;
  gap: 3px;
  align-items: center;
}

.speaking-dot {
  width: 4px;
  height: 12px;
  background: var(--alser-green);
  animation: speaking-bounce 0.8s infinite ease-in-out alternate;
}

.speaking-dot:nth-child(2) { animation-delay: 0.15s; }
.speaking-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes speaking-bounce {
  from { height: 4px; }
  to { height: 16px; }
}

/* Reset focus outlines to avoid browser default purple/blue outline rings */
a, button, input, select, textarea {
  outline: none !important;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--alser-green) !important;
  outline-offset: 1px;
}
