:root {
  /* BLUE THEME VARIABLES */
  --primary: #1976d2;
  --primary-dark: #0d47a1;
  --primary-light: #bbdefb;
  --accent: #00e5ff;
  --bg-color: #f0f4f8;
  --white: #ffffff;
  --text-dark: #102a43;
  --text-light: #627d98;
  --shadow: 0 4px 6px rgba(25, 118, 210, 0.1);
  --shadow-hover: 0 12px 24px rgba(25, 118, 210, 0.15);
  --ease-smooth: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* RESET & SCROLLBARS */
* { box-sizing: border-box; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(25, 118, 210, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-color);
  margin: 0;
  color: var(--text-dark);
  height: 100vh;
  height: 100dvh; /* Mobile fix */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  padding: 15px 30px;
  box-shadow: 0 4px 15px rgba(25, 118, 210, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  flex-shrink: 0;
}
header h1 { margin: 0; font-size: 1.5rem; display: flex; gap: 10px; align-items: center; }
.subtitle { font-size: 0.85rem; background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 20px; }

/* Layout */
.container { display: flex; flex: 1; padding: 20px; gap: 20px; overflow: hidden; position: relative; }

/* Sidebar */
.sidebar { flex: 0 0 380px; display: flex; flex-direction: column; gap: 15px; height: 100%; min-width: 0; }

/* Search Panel */
.search-panel { background: var(--white); padding: 20px; border-radius: 16px; box-shadow: var(--shadow); flex-shrink: 0; }
.input-group { display: flex; gap: 10px; }
#pincode-input {
  flex: 1; padding: 12px; border: 2px solid var(--primary-light); border-radius: 10px; outline: none; transition: 0.3s;
}
#pincode-input:focus { border-color: var(--primary); }
button { cursor: pointer; border: none; border-radius: 10px; transition: 0.2s; font-family: inherit; }
#search-btn { background: var(--primary); color: white; padding: 0 20px; }
#search-btn:hover { background: var(--primary-dark); }
.outline-btn { background: transparent; border: 2px solid var(--primary); color: var(--primary); padding: 10px; width: 100%; font-weight: 600; }
.outline-btn:hover { background: var(--primary-light); }
.divider { display: flex; align-items: center; color: var(--text-light); font-size: 0.8rem; margin: 10px 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid #ddd; }
.divider span { padding: 0 10px; }

/* Map */
#map { flex: 1; border-radius: 16px; box-shadow: var(--shadow); border: 4px solid var(--white); z-index: 1; }

/* Lists & Cards */
#hospital-list { flex: 1; overflow-y: auto; padding: 5px; }
.hospital-card {
  background: var(--white); padding: 15px; margin-bottom: 12px; border-radius: 12px;
  border-left: 5px solid var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  cursor: pointer; position: relative; transition: 0.3s;
}
.hospital-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.distance-tag { position: absolute; top: 15px; right: 15px; background: #e3f2fd; color: var(--primary); font-size: 0.75rem; padding: 4px 8px; border-radius: 12px; font-weight: bold; }
.empty-state { text-align: center; color: var(--text-light); margin-top: 50px; }

/* Details Panel */
#hospital-details { background: var(--white); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; height: 100%; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
#back-btn { background: transparent; color: var(--text-light); padding: 15px; text-align: left; font-weight: 600; width: 100%; }
#back-btn:hover { color: var(--primary); background: #f8fbff; }
#detail-name { color: var(--primary-dark); margin: 10px 20px; line-height: 1.2; }
.info-section { padding: 20px; overflow-y: auto; flex: 1; }
.info-item { display: flex; margin-bottom: 15px; padding: 15px; background: #f8fbff; border-radius: 10px; align-items: flex-start; }
.info-item .icon { margin-right: 15px; color: var(--primary); font-size: 1.2rem; margin-top: 2px; }
.info-item span, .info-item a { font-size: 0.9rem; color: var(--text-dark); word-break: break-word; }

/* AI Assistant */
.ai-fab { position: fixed; bottom: 30px; right: 80px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.ai-tag { background: var(--text-dark); color: white; padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; }
#ai-toggle-btn {
  /* Change background to white */
  background: #ffffff; 
  
  /* Change icon color to your primary blue */
  color: var(--primary); 
  
  /* Keep the rest the same... */
  width: 60px; height: 60px; border-radius: 50%;
  border: none;
  box-shadow: 0 8px 20px rgba(25, 118, 210, 0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
#ai-toggle-btn:hover { transform: scale(1.1); }

.ai-modal {
  position: fixed; bottom: 100px; right: 30px; width: 350px; height: 500px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3); z-index: 1001;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transform: translateY(20px) scale(0.95); transition: 0.3s;
}
.ai-modal.active { opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }
.ai-header { background: var(--primary); color: white; padding: 15px; border-radius: 20px 20px 0 0; display: flex; justify-content: space-between; align-items: center; }
#close-ai { background: transparent; color: white; font-size: 1.2rem; }
.ai-body { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: #f0f4f8; }
.ai-msg { padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; max-width: 85%; line-height: 1.4; }
.ai-msg.bot { background: white; color: var(--text-dark); border-bottom-left-radius: 2px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.ai-msg.user { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.ai-input-area { padding: 10px; background: white; display: flex; gap: 10px; border-radius: 0 0 20px 20px; border-top: 1px solid #eee; }
#ai-input { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 20px; outline: none; }
#ai-send-btn { background: var(--primary); color: white; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

@media (max-width: 768px) {
  .container { flex-direction: column-reverse; padding: 10px; }
  .sidebar { height: auto; min-height: 50vh; width: 100%; flex: 1; }
  #map { height: 40vh; min-height: 300px; flex: none; }
  .ai-modal { width: 90%; right: 5%; bottom: 90px; height: 60vh; }
}