@charset "UTF-8";

/* =========================================
   VARIABLES & RESET
   ========================================= */
:root {
  /* Ultra-Premium Dark Theme (Slate/Zinc) */
  --bg-app: #020617;
  /* Slate 950 - Deepest background */
  --bg-sidebar: rgba(15, 23, 42, 0.6);
  /* Slate 900 with transparency */
  --bg-surface: #1e293b;
  /* Slate 800 - Cards/Bubbles */
  --bg-input: #1e293b;
  /* Input field background */

  --text-primary: #f1f5f9;
  /* Slate 100 */
  --text-secondary: #94a3b8;
  /* Slate 400 */
  --text-accent: #38bdf8;
  /* Sky 400 */

  --accent-color: #3b82f6;
  /* Blue 500 */
  --accent-hover: #2563eb;
  /* Blue 600 - darker for hover */
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);

  --border-color: rgba(255, 255, 255, 0.08);
  /* Subtle border */

  --glass-blur: blur(12px);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-main);
  margin: 0;
  overflow: hidden;
  /* App-like feel */
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* =========================================
   LAYOUT
   ========================================= */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at top right, #1e293b 0%, var(--bg-app) 40%);
}

/* Sidebar */
.sidebar {
  width: 260px;
  /* Slightly more compact */
  background-color: var(--bg-sidebar);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.brand:hover {
  opacity: 1;
}

.brand-logo {
  height: 24px;
  width: auto;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.sidebar-content {
  /* padding: 1.5rem; */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-surface) transparent;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
  opacity: 0.8;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: transparent;
  /* Allows gradient to show through */
}

.chat-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2rem 0 8rem 0;
  /* Bottom padding for input area */
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-surface) transparent;
}

.messages-list {
  width: 100%;
  max-width: 768px;
  /* Classic readable width */
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* =========================================
   COMPONENTS
   ========================================= */

/* Timers & Progress */
.timer-display {
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.75rem;
  font-weight: 300;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.02em;
}

.timer-display i {
  font-size: 1.1rem;
  color: var(--text-accent);
  opacity: 0.8;
}

.progress-track {
  height: 4px;
  /* Thinner line */
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
  font-family: monospace;
}

.topic-badge {
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-accent);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  box-shadow: 0 0 4px currentColor;
}

.status-badge[data-state="active"] .status-dot {
  background-color: #22c55e;
  color: #22c55e;
}

.status-badge[data-state="thinking"] .status-dot {
  background-color: #38bdf8;
  color: #38bdf8;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.5;
    transform: scale(0.9);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
  }

  100% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

/* Audio Recording Pulse - Green (Success) */
@keyframes pulse-green {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }

  /* tailwind green-500 */
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.mic-active {
  color: #22c55e !important;
  /* Green */
  animation: pulse-green 1.5s infinite;
  border-radius: 50%;
}

.mic-paused {
  color: #f59e0b !important;
  /* Orange */
}

.mic-muted {
  color: #ef4444 !important;
  /* Red */
}

.mic-inactive {
  color: #6c757d !important;
  /* Grey */
}

/* Messages */
.msg-wrapper {
  display: flex;
  width: 100%;
  gap: 1rem;
  animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.msg-wrapper.user {
  flex-direction: row;
  /* Keep standard alignment */
  justify-content: flex-end;
}

.msg-wrapper.assistant {
  flex-direction: row;
  justify-content: flex-start;
}

/* Icons/Avatars */
.msg-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  /* Squircle */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  margin-top: 4px;
}

.msg-wrapper.assistant .msg-icon {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-accent);
  border: 1px solid var(--border-color);
}

.msg-wrapper.user .msg-icon {
  background: var(--bg-surface);
  color: var(--text-primary);
  display: none;
  /* Hide user icon for cleaner look, optional */
}

/* Bubbles */
.msg {
  max-width: 80%;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.msg:hover {
  box-shadow: var(--shadow-md);
}

.msg-wrapper.user .msg {
  background: var(--accent-gradient);
  color: white;
  border-radius: 18px 18px 4px 18px;
  /* Modern shape */
  font-weight: 500;
}

.msg-wrapper.assistant .msg {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 18px 18px 18px 4px;
}

.msg-wrapper.assistant .msg p {
  margin-bottom: 0.75rem;
}

.msg-wrapper.assistant .msg p:last-child {
  margin-bottom: 0;
}

/* QCM Styling */
.exam-qcm {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 1rem;
}

.exam-qcm h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.form-check {
  margin-bottom: 0.75rem;
  padding-left: 2rem;
  position: relative;
}

.form-check-label {
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s;
  display: block;
}

.form-check:hover .form-check-label {
  background: rgba(255, 255, 255, 0.03);
}

.form-check-input {
  width: 1.2em;
  height: 1.2em;
  background-color: var(--bg-app);
  border-color: var(--text-secondary);
  margin-top: 0.6em;
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

.form-check-input:focus {
  box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
  border-color: var(--accent-color);
}

/* Input Area */
.input-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 1rem;
  background: linear-gradient(to top, var(--bg-app) 20%, transparent);
  pointer-events: none;
  /* Let clicks pass through transparent parts */
  display: flex;
  justify-content: center;
  z-index: 50;
}

.input-container {
  width: 100%;
  max-width: 768px;
  position: relative;
  pointer-events: auto;
}

.composer-form {
  background: rgba(30, 41, 59, 0.85);
  /* Semi-transparent */
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  /* Pill shapeish */
  padding: 0.6rem 0.75rem 0.6rem 1.25rem;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.composer-form:focus-within {
  border-color: var(--accent-color);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.composer-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  resize: none;
  padding: 0.5rem 0;
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.5;
  max-height: 200px;
  outline: none;
}

.composer-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.send-btn {
  background: var(--text-primary);
  color: var(--bg-app);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  /* Circle button */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  background: white;
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.send-btn:disabled {
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.5;
}

.composer-actions {
  position: absolute;
  bottom: 100%;
  right: 1.5rem;
  margin-bottom: 0.75rem;
}

.reset-link {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-link:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 0.5rem 1rem;
  margin-left: 3rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

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

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Utilities */
.text-accent {
  color: var(--text-accent);
}

.btn-accent {
  background: var(--accent-gradient);
  color: white;
  border: none;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.btn-accent:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-md);
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .sidebar-content {
    display: none;
    /* Keep hidden on mobile by default */
  }

  .sidebar-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
  }

  .chat-container {
    padding: 1rem 0 6rem 0;
  }

  .messages-list {
    padding: 0 1rem;
    gap: 1rem;
  }

  .msg {
    border-radius: 16px;
    padding: 0.75rem 1rem;
    max-width: 85%;
  }

  .input-area {
    padding: 0.75rem;
    background: var(--bg-app);
    /* Solid bg on mobile for better performance */
    border-top: 1px solid var(--border-color);
  }

  .composer-form {
    border-radius: 20px;
    padding: 0.5rem 0.75rem;
  }
}

button.copy-btn {
  border: none;
  background: transparent;
  font-size: 9px;
}

button.copy-btn:hover {
  color: #75b798;
}