/* AI Interview Coach - CSS Styles */

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #6b7280;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-dark: #f1f5f9;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo i {
  font-size: 1.75rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-width: fit-content;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface-dark);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-light);
}

.btn-secondary.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-icon {
  padding: 0.5rem;
  min-width: auto;
}

/* Welcome Section */
.welcome-section {
  padding: 3rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: 2rem;
  border-radius: var(--radius-lg);
}

.welcome-section.hidden {
  display: none;
}

.welcome-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.welcome-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.welcome-content p {
  font-size: 1.125rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.feature i {
  font-size: 1.25rem;
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem;
  scroll-behavior: smooth;
}

/* Messages */
.message {
  display: flex;
  margin-bottom: 1.5rem;
  animation: slideIn 0.3s ease-out;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.message-content {
  max-width: 70%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.message.user .message-content {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.message.assistant .message-content {
  margin-left: 3rem;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.8;
}

.message-sender {
  font-weight: 600;
}

.message-time {
  font-size: 0.7rem;
}

.message-text {
  line-height: 1.6;
  word-wrap: break-word;
}

.message-text code {
  background: rgba(0, 0, 0, 0.1);
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
}

.message.user .message-text code {
  background: rgba(255, 255, 255, 0.2);
}

.message-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-right: 0.5rem;
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.message.error .message-content {
  background: var(--error-color);
  color: white;
  border-color: var(--error-color);
}

/* Loading Indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.loading-indicator.hidden {
  display: none;
}

.typing-animation {
  display: flex;
  gap: 0.25rem;
}

.typing-animation span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-animation span:nth-child(1) { animation-delay: -0.32s; }
.typing-animation span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Input Section */
.input-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.input-container {
  max-width: 100%;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--primary-color);
}

#messageInput {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  background: transparent;
  color: var(--text-primary);
  min-height: 20px;
  max-height: 120px;
}

#messageInput::placeholder {
  color: var(--text-secondary);
}

.input-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.input-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.voice-hint {
  font-style: italic;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-body {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Voice Animation */
.voice-animation {
  position: relative;
  display: inline-block;
  margin: 2rem 0;
}

.voice-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.voice-circle::before {
  content: "🎤";
  font-size: 2rem;
}

.voice-wave {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: voiceWave 2s infinite;
}

@keyframes voiceWave {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

.voice-transcript {
  background: var(--surface-dark);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
  text-align: left;
  font-family: monospace;
  font-size: 0.875rem;
  line-height: 1.4;
  min-height: 60px;
}

/* Toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid;
  z-index: 1001;
  max-width: 400px;
  animation: slideInFromRight 0.3s ease-out;
}

.toast.hidden {
  display: none;
}

.toast-error {
  border-left-color: var(--error-color);
}

.toast-success {
  border-left-color: var(--success-color);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.toast-error .toast-content i {
  color: var(--error-color);
}

.toast-success .toast-content i {
  color: var(--success-color);
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-container {
    height: 100vh;
    border-radius: 0;
  }

  .header {
    padding: 0.75rem 1rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .welcome-section {
    margin: 1rem;
    padding: 2rem 1rem;
  }

  .welcome-content h2 {
    font-size: 1.5rem;
  }

  .welcome-content p {
    font-size: 1rem;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .feature {
    padding: 0.75rem;
  }

  .chat-container {
    padding: 0.75rem;
  }

  .message-content {
    max-width: 85%;
  }

  .message.assistant .message-content {
    margin-left: 2.5rem;
  }

  .input-section {
    padding: 0.75rem 1rem;
  }

  .input-wrapper {
    padding: 0.5rem;
  }

  .input-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .modal-content {
    margin: 1rem;
    width: calc(100% - 2rem);
    padding: 1.5rem;
  }

  .voice-animation {
    margin: 1.5rem 0;
  }

  .voice-circle {
    width: 60px;
    height: 60px;
  }

  .voice-circle::before {
    font-size: 1.5rem;
  }

  .voice-wave {
    width: 60px;
    height: 60px;
  }

  .toast {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .header-content {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .header-actions {
    justify-content: center;
  }

  .welcome-section {
    margin: 0.5rem;
    padding: 1.5rem 0.75rem;
  }

  .features {
    margin-top: 1rem;
  }

  .feature {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }

  .message-content {
    max-width: 95%;
  }

  .message.assistant .message-content {
    margin-left: 2rem;
  }

  .message-avatar {
    width: 2rem;
    height: 2rem;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-error {
  color: var(--error-color);
}

.text-success {
  color: var(--success-color);
}

.text-secondary {
  color: var(--text-secondary);
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--surface-dark);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Focus states for accessibility */
.btn:focus-visible,
#messageInput:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #000000;
    --text-secondary: #000000;
    --shadow: 0 0 0 1px #000000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}