/* File: css/styles.css */

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

:root {
  --bg-main: #020617;
  --bg-glass: rgba(30, 41, 59, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --user-msg: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --bot-msg: rgba(30, 41, 59, 0.8);
  --success: #10b981;
  --danger: #ef4444;
}

/* --- RESET & GLOBAL STYLES --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background: radial-gradient(circle at top right, #0f172a, #020617);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

button, 
.nav-btn, 
.dashboard-btn, 
.quiz-option, 
.file-upload-label,
a {
  -webkit-tap-highlight-color: transparent; /* Mobile tap blue highlight hatayega */
  outline: none !important; /* Click outline hatayega */
}

/* Text selection ko chhodkar click selection ko block karne ke liye */
.nav-btn, button {
  user-select: none;
}

/* --- HEADER --- */
header {
  padding: 18px 20px;
  text-align: center;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}
header i { color: var(--primary); font-size: 1.4rem; }

/* --- PAGES --- */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 100px; /* Space for navbar */
  animation: fadeIn 0.3s ease-out forwards;
}
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- GLASS CARDS --- */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

h3 {
  margin-bottom: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
h3 i { color: var(--primary); }

/* --- BUTTONS & INPUTS --- */
button {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

input[type="file"] {
  display: none;
}
.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  border: 2px dashed rgba(59, 130, 246, 0.5);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(59, 130, 246, 0.05);
}
.file-upload-label:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}
.file-upload-label i { font-size: 3rem; color: var(--primary); margin-bottom: 12px; }

#uploadStatus {
  margin-top: 16px;
  color: var(--success);
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

/* --- CHAT UI --- */
#chatPage {
  display: none;
  flex-direction: column;
  padding: 0;
}
#chatPage.active { display: flex; }

#chat {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 0.95rem;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-out;
}

.user {
  background: var(--user-msg);
  margin-left: auto;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.bot {
  background: var(--bot-msg);
  margin-right: auto;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-glass);
  position: relative;
  padding-bottom: 40px; /* Copy button ke liye space */
}

/* Markdown Styles within Bot Messages */
.bot p { margin-bottom: 8px; }
.bot p:last-child { margin-bottom: 0; }
.bot strong { color: white; }
.bot ul, .bot ol { margin-left: 20px; margin-bottom: 8px; }
.bot code { background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.bot pre { background: rgba(0,0,0,0.5); padding: 12px; border-radius: 8px; overflow-x: auto; margin-top: 8px; }

.chat-input-wrapper {
  padding: 15px 20px 85px 20px;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  gap: 8px; /* Thoda gap buttons ke beech */
  position: relative;
}

.chat-input-wrapper input {
  flex: 1;
  padding: 14px 20px;
  border-radius: 99px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}
.chat-input-wrapper input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
}

.chat-input-wrapper button {
  border-radius: 99px;
  width: 48px;
  height: 48px;
  padding: 0;
}
.chat-input-wrapper button i { font-size: 1.2rem; }

/* Mic Button Styling */
#micBtn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#micBtn.listening {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 15px var(--danger);
    animation: pulse-mic 1.5s infinite;
}

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

/* Copy button bot messages ke liye */
.copy-btn {
  position: absolute;
  bottom: 8px;
  right: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
  color: var(--text-muted);
  width: auto;
  height: auto;
}
.copy-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* 🔊 Voice Status Pill */
.voice-pill {
    position: absolute;
    bottom: 85px; /* Input wrapper ke theek upar */
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(59, 130, 246, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--primary);
    padding: 8px 16px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    color: var(--text-main);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.voice-pill.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: all;
}

/* 🎵 Small Wave Animation inside Pill */
.wave-lines {
    display: flex;
    gap: 2px;
    align-items: center;
}
.wave-lines span {
    width: 2px;
    height: 10px;
    background: var(--primary);
    border-radius: 2px;
    animation: wave-grow 1s infinite ease-in-out;
}
.wave-lines span:nth-child(2) { animation-delay: 0.2s; height: 14px; }
.wave-lines span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave-grow {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.5); }
}

#stopVoiceBtn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}
#stopVoiceBtn:hover {
    background: var(--danger);
}

/* --- TYPING INDICATOR --- */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* --- QUIZ UI --- */
.quiz-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.quiz-question {
  font-weight: 600;
  margin-bottom: 16px;
  font-size: 1.05rem;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-option {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  text-align: left;
  padding: 14px 16px;
  justify-content: flex-start;
  color: var(--text-main);
}
.quiz-option:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}
.quiz-option.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--success) !important;
  color: var(--success);
}
.quiz-option.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--danger) !important;
  color: var(--danger);
}

/* Progress Bar Styling */
.progress-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  height: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--user-msg);
  transition: width 0.3s ease;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.final-score-card {
  text-align: center;
  padding: 30px;
  background: var(--bg-glass);
  border-radius: 16px;
  border: 1px solid var(--border-glass);
}
.final-score-card h2 {
  color: var(--primary);
  font-size: 2rem;
  margin: 15px 0;
}

/* --- LOADING SPINNER --- */
.loader {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 10px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-glass);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- NAVBAR --- */
.navbar {
  position: fixed;
  bottom: 0;
  width: 100%;
  display: flex;
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 20;
}

.nav-btn {
  flex: 1;
  background: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-radius: 12px;
}
.nav-btn i { font-size: 1.4rem; transition: transform 0.2s; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-main); }
.nav-btn.active { color: var(--primary); }
.nav-btn.active i { transform: scale(1.1); }

/* --- DASHBOARD STYLES --- */
.dashboard {
  padding: 30px;
  color: white;
}

.cards {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.card {
  flex: 1;
  padding: 20px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.1);
  text-align: center;
}

.chart-container {
  background: rgba(255,255,255,0.1);
  padding: 20px;
  border-radius: 15px;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

 white;
}
