:root {
  --bg-dark: #08060c;
  --bg-gradient: radial-gradient(circle at 50% 0%, #170d28 0%, #08060c 75%);
  --panel-bg: rgba(18, 13, 29, 0.72);
  --panel-bg-light: rgba(255, 255, 255, 0.035);
  --panel-border: rgba(255, 255, 255, 0.07);
  --panel-border-hover: rgba(168, 85, 247, 0.35);
  --accent-primary: #a855f7;
  --accent-secondary: #ec4899;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --bubble-user: linear-gradient(135deg, #7c3aed, #db2777);
  --bubble-ai: rgba(255, 255, 255, 0.035);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  overflow: hidden;
  position: relative;
}

/* Ambient Lighting Blobs */
.background-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  filter: blur(140px);
  opacity: 0.22;
  border-radius: 50%;
}

.blob-1 {
  width: 550px;
  height: 550px;
  background: #7000ff;
  top: -12%;
  left: -5%;
}

.blob-2 {
  width: 650px;
  height: 650px;
  background: #ff5277;
  bottom: -18%;
  right: -5%;
}

/* ── App Container (PC 기본: 2단 그리드) ── */
.app-container {
  position: relative;
  z-index: 10;
  width: 98vw;
  max-width: 1600px;
  height: 96vh;
  height: 96dvh;
  margin: 2vh auto;
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 14px;
  overflow: hidden;
}

/* Glassmorphism Styles */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(28px) saturate(210%);
  -webkit-backdrop-filter: blur(28px) saturate(210%);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.glass-light {
  background: var(--panel-bg-light);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
}

/* ── Left Sidebar ── */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  align-items: center;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.profile-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.2));
  border: 1px solid rgba(236, 72, 153, 0.45);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #f472b6;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.2);
}

.select-container {
  width: 100%;
  margin-bottom: 12px;
}

.glass-select {
  width: 100%;
  padding: 9px 12px;
  background: #1c152e !important;
  border: 1px solid rgba(168, 85, 247, 0.35) !important;
  border-radius: 12px;
  color: #ffffff !important;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}
.glass-select:hover, .glass-select:focus {
  border-color: #ec4899 !important;
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.3);
}
.glass-select option {
  background: #150f24;
  color: #ffffff;
  padding: 8px;
}

.avatar-container {
  position: relative;
  width: 78px;
  height: 78px;
  margin: 6px auto 10px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-wrapper {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  background: #110d1a;
}

#assistant-avatar, .avatar-wrapper img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}

.pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  opacity: 0.35;
  animation: pulse-ring 2.5s infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% { transform: scale(0.96); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0.15; }
  100% { transform: scale(0.96); opacity: 0.5; }
}

#assistant-name {
  font-size: 1.18rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.bio {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.035);
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-dot.active {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
  animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.sidebar-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.control-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.25s ease;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.control-btn.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(236, 72, 153, 0.35));
  border-color: rgba(236, 72, 153, 0.55);
  color: #fff;
  box-shadow: 0 0 18px rgba(236, 72, 153, 0.25);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  width: 100%;
}

.isabel-link-card {
  display: block;
  padding: 9px 8px;
  border-radius: 12px;
  background: rgba(255, 82, 119, 0.08);
  border: 1px solid rgba(255, 82, 119, 0.25);
  text-decoration: none;
  color: #f472b6;
  font-size: 0.75rem;
  text-align: center;
  transition: all 0.2s;
}
.isabel-link-card:hover {
  background: rgba(255, 82, 119, 0.15);
  border-color: rgba(255, 82, 119, 0.5);
  transform: translateY(-1px);
}

/* ── Right Main Chat Panel ── */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ── Top Header ── */
.chat-header {
  height: 54px;
  min-height: 54px;
  max-height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--panel-border);
  gap: 12px;
}

.header-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tab-btn {
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 0.86rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 14px rgba(219, 39, 119, 0.4);
}

.calendar-tab-btn {
  background: rgba(56, 189, 248, 0.1) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.calendar-tab-btn:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: rgba(56, 189, 248, 0.65) !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35) !important;
  transform: translateY(-1px);
}

.dashboard-tab-btn {
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.38) !important;
  color: #34d399 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all 0.2s ease !important;
}

.dashboard-tab-btn:hover {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: rgba(16, 185, 129, 0.7) !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4) !important;
  transform: translateY(-1px);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* ── Group Participants Bar ── */
.group-participants {
  padding: 8px 16px;
  display: flex;
  gap: 7px;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--panel-border);
  overflow-x: auto;
  white-space: nowrap;
  flex-wrap: nowrap;
  scrollbar-width: none;
  flex-shrink: 0;
}
.group-participants::-webkit-scrollbar { display: none; }

.participant-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.participant-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.participant-chip.selected {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.35), rgba(219, 39, 119, 0.35));
  border-color: #a855f7;
  color: #f3e8ff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.25);
}
.participant-chip img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

/* ── View Container & Chat History ── */
.view-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-history::-webkit-scrollbar {
  width: 6px;
}
.chat-history::-webkit-scrollbar-track {
  background: transparent;
}
.chat-history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

/* ── Message Bubble ── */
.message-bubble {
  max-width: 82%;
  font-size: 0.94rem;
  line-height: 1.68;
  letter-spacing: -0.01em;
  padding: 13px 18px;
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  word-break: break-word;
}

.message-bubble strong {
  color: #fff;
  font-weight: 700;
}

/* ── Bottom Input Footer (절대 짤림 방지 flex-shrink: 0) ── */
.chat-footer {
  flex-shrink: 0;
  padding: 10px 18px 14px 18px;
  background: rgba(11, 8, 19, 0.85);
  border-top: 1px solid var(--panel-border);
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: all 0.25s ease;
}

.input-wrapper:focus-within {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent-primary);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.3);
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.92rem;
  padding: 7px 4px;
}
.input-wrapper input::placeholder {
  color: #64748b;
}

.clip-btn, .mic-btn, .send-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clip-btn:hover, .mic-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.mic-btn.active {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.2);
  animation: pulse-mic 1.2s infinite;
}

@keyframes pulse-mic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.send-btn {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.8rem;
  box-shadow: 0 2px 12px rgba(219, 39, 119, 0.45);
}
.send-btn:hover {
  transform: scale(1.06);
}

.stt-status-msg {
  font-size: 0.76rem;
  color: #f472b6;
  margin-top: 4px;
  text-align: center;
  display: none;
}

/* ══════════════════════════════════════════════════════════
   📱 모바일 전용 반응형 완벽 레이아웃 (@media max-width: 900px)
   하단 입력창 짤림 100% 원천 차단 & 100dvh 꽉 찬 뷰
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .app-container {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  /* 모바일 상단 미니 사이드바 헤더 */
  .sidebar {
    height: auto !important;
    max-height: 115px !important;
    padding: 8px 12px !important;
    border-radius: 0 !important;
    border-bottom: 1px solid var(--panel-border) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    background: rgba(14, 10, 23, 0.95) !important;
  }

  .profile-header {
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    width: auto !important;
    margin-bottom: 0 !important;
  }

  .badge {
    display: none !important;
  }

  .avatar-container {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
  }

  .avatar-wrapper {
    width: 44px !important;
    height: 44px !important;
  }

  #assistant-name {
    font-size: 0.98rem !important;
  }

  .bio {
    display: none !important;
  }

  .status-indicator {
    padding: 2px 6px !important;
    font-size: 0.68rem !important;
  }

  .select-container {
    width: 155px !important;
    margin-bottom: 0 !important;
  }

  .glass-select {
    padding: 6px 8px !important;
    font-size: 0.76rem !important;
    border-radius: 8px !important;
  }

  .sidebar-controls {
    flex-direction: row !important;
    width: auto !important;
    margin-top: 0 !important;
    gap: 6px !important;
  }

  .control-btn {
    padding: 5px 10px !important;
    font-size: 0.72rem !important;
    border-radius: 8px !important;
  }

  .sidebar-footer {
    display: none !important;
  }

  /* 모바일 메인 채팅 영역 */
  .chat-panel {
    flex: 1 !important;
    height: 100% !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .chat-header {
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 12px !important;
  }

  .tab-btn {
    padding: 5px 12px !important;
    font-size: 0.78rem !important;
  }

  .chat-history {
    padding: 12px 14px !important;
    gap: 12px !important;
  }

  .message-bubble {
    max-width: 92% !important;
    font-size: 0.88rem !important;
    line-height: 1.6 !important;
    padding: 10px 14px !important;
  }

  /* 모바일 하단 입력창 (절대 짤리지 않고 홈 인디케이터 여백 지원) */
  .chat-footer {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 12px !important;
    background: rgba(8, 6, 12, 0.98) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  .input-wrapper {
    padding: 4px 10px !important;
    border-radius: 24px !important;
  }

  .input-wrapper input {
    font-size: 0.88rem !important;
    padding: 6px 2px !important;
  }
}
