:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #8b5cf6;
  --accent-color: #06b6d4;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
  --bg-primary: #1f2937;
  --bg-secondary: #111827;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --border-color: #374151;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, color 0.3s;
}

.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.header-right {
  justify-content: flex-end;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  justify-content: center;
  flex: 2;
}

.timer,
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

#timerDisplay {
  font-weight: 500;
  font-family: monospace;
  font-size: 1.1rem;
}

.timer-options {
  display: flex;
  gap: 10px;
  margin-left: 15px;
}

.timer-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.timer-btn:hover,
.timer-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.theme-toggle button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 5px;
  border-radius: 50%;
  transition: var(--transition);
}

.theme-toggle button:hover {
  color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.user-menu {
  position: relative;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.main-container {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.sidebar {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 90px;
  bottom: 20px;
}

.sidebar-section {
  margin-bottom: 20px;
}

.webcam-section {
  margin-top: 20px;
}

.webcam-container {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 2px solid var(--border-color);
}

.webcam-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.webcam-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 2rem;
}

.mic-toggle {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.mic-toggle-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.mic-toggle-btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.mic-toggle-btn.muted {
  background-color: var(--error-color);
  color: white;
}

.interview-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-container {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.chat-input-area {
  padding: 15px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.chat-input-form {
  display: flex;
  gap: 10px;
}

.chat-input-form textarea {
  flex-grow: 1;
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: "Inter", sans-serif;
  resize: none;
  height: 50px;
  transition: var(--transition);
}

.chat-input-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.chat-input-form button {
  background: var(--primary-color);
  border: none;
  color: white;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.chat-input-form button:hover {
  background: var(--primary-dark);
}

.message.bot-message .message-bubble {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 30px 20px;
  text-align: center;
  transition: var(--transition);
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.05);
}

.upload-area.file-uploaded {
  border-color: var(--success-color);
  background: rgba(16, 185, 129, 0.05);
}

.upload-icon {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}
.upload-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 15px;
}
.upload-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
}

.file-info {
  display: none;
  background: var(--success-color);
  color: white;
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 0.9rem;
}

.chat-header {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  padding: 20px;
  text-align: center;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.message {
  margin-bottom: 20px;
  display: flex;
}
.message-bubble {
  max-width: 80%;
  padding: 15px 20px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
}
.bot-message {
  justify-content: flex-start;
}
.user-message {
  justify-content: flex-end;
}
.user-message .message-bubble {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  border-bottom-right-radius: 6px;
}
.controls {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 20px;
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}
.transcript-area {
    margin-top: 1rem;
    padding: 1rem;
    border-top: 1px solid #ccc;
    font-size: 0.9rem;
    max-height: 200px;
    overflow-y: auto;
    background-color: #f9f9f9;
}
.transcript-line {
    margin-bottom: 0.5rem;
}
.transcript-line.bot {
    color: #444;
}
.transcript-line.user {
    color: #007bff;
}
.control-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.btn-start {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
  color: white;
}
.btn-stop {
  background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
  color: white;
}
.btn-ask-again {
  background: linear-gradient(135deg, var(--accent-color) 0%, #0891b2 100%);
  color: white;
}
.btn-report {
  background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
  color: white;
}
.control-btn:disabled {
  background: var(--border-color);
  color: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}

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

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

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

@media (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 15px;
  }

  .timer-options {
    flex-direction: column;
    gap: 5px;
  }
}

.bot-msg {
    background: #f1f1f1;
    padding: 10px;
    margin: 5px;
    border-radius: 8px;
    text-align: left;
}

.user-msg {
    background: #007bff;
    color: white;
    padding: 10px;
    margin: 5px;
    border-radius: 8px;
    text-align: right;
}
