* {
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #0b1a1f, #162b33, #1f3b44);
  color: white;
}

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR (DESKTOP DEFAULT) ===== */
.sidebar {
  width: 260px;
  background: rgba(0,0,0,0.9);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.3s ease;
  position: relative;
  overflow-y:scroll;
  z-index: 20;
}

/* Hide sidebar (slide out) */
.sidebar.hidden {
  transform: translateX(-100%);
}

/* ===== TOGGLE BUTTON ===== */
.toggle-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1000;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 20px;
  cursor: pointer;
  
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.toggle-btn:hover {
  opacity: 0.9;
}

/* ===== NEW CHAT BUTTON ===== */
#newChat {
  margin-top: 50px;
  background: #00ffd5;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
}

/* ===== CHAT LIST ===== */
#chatList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 10px;
  background: rgba(225,225,225,0.08);
  cursor: pointer;
}

.chat-item.active {
  background: #00ffd5;
  color: black;
}

.chat-item span {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-delete {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.6;
}

.chat-delete:hover {
  opacity: 1;
}

/* ===== APP ===== */
.app {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.5);
}

/* Header */
h1 {
  margin: 0;
  text-align: center;
}

.subtitle {
  text-align: center;
  opacity: 0.6;
}

/* Chat area */
#response {
  flex: 1;
  background: transparent;
  border-radius: 14px;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Messages */
.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
}

.message.user {
  align-self: flex-end;
  background: #00ffd5;
  color: black;
}

.message.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.12);
}

/* Input */
.input-area {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

textarea {
  flex: 1;
  height: 70px;
  border-radius: 10px;
  padding: 10px;
  border: none;
  background: rgba(0,0,0,0.25);
  color: white;
}

/* Send button */
#send {
  width: 90px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
}

/* Header icon */
.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.app-icon {
  width: 48px;
}

/* Empty state */
#emptyState {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.empty-orb {
  width: 24px;
  margin-bottom: 12px;
}

.empty-text {
  font-style: italic;
  opacity: 0.8;
}

.thinking {
  opacity: 0.6;
  font-style: italic;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 0.8; }
  100% { opacity: 0.4; }
}


/* ================================================= */
/* =============== MOBILE FIX ONLY ================= */
/* ================================================= */

@media (max-width: 768px) {

  /* Sidebar becomes overlay drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 75vw;
    max-width: 260px;
    transform: translateX(-100%);
    z-index: 999;
  }

  /* When visible */
  .sidebar:not(.hidden) {
    transform: translateX(0);
  }

  /* App ALWAYS full width */
  .app {
    width: 100%;
    padding: 16px;
  }
}

