/* =============================================================================
   VizaAI — UI Component Library (components.css)
   ============================================================================= */

@import url('./variables.css');

/* ── 1. Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: var(--transition-default);
  outline: none;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.btn-md {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  color: #FFFFFF;
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error);
  color: #FFFFFF;
}

.btn-danger:hover {
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── 2. Form Elements ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  width: 100%;
}

.input-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.input-field, .input-textarea, .input-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: var(--transition-default);
  outline: none;
}

.input-field:focus, .input-textarea:focus, .input-select:focus {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-glow);
  background-color: var(--bg-surface);
}

.input-field.invalid, .input-textarea.invalid {
  border-color: var(--error);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.input-textarea {
  min-height: 120px;
  resize: vertical;
}

.input-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%94A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 16px;
  padding-right: var(--space-10);
}

.input-error-msg {
  font-size: var(--text-xs);
  color: var(--error);
  margin-top: var(--space-1);
}

/* File Drag & Drop Box */
.input-file-container {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  background: var(--glass-bg);
  cursor: pointer;
  transition: var(--transition-default);
}

.input-file-container:hover, .input-file-container.dragover {
  border-color: var(--primary-light);
  background: rgba(79, 70, 229, 0.1);
  box-shadow: var(--shadow-glow);
}

/* ── 3. Cards (Glassmorphism) ── */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: var(--transition-default);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-job, .card-university, .card-sponsor {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.card-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-surface);
  border: var(--border-glass);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.card-stat {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.card-stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  color: #FFFFFF;
}

.card-stat-number {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
}

/* ── 4. Badges & Tags ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-visa {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-remote {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-funding {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.tag-skill {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--glass-border);
}

/* ── 5. Navigation ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
}

.sidebar {
  width: 260px;
  height: calc(100vh - 70px);
  position: fixed;
  top: 70px;
  left: 0;
  background: var(--bg-card);
  border-right: var(--border-glass);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  z-index: 90;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition-fast);
  margin-bottom: var(--space-2);
}

.sidebar-nav-item:hover, .sidebar-nav-item.active {
  background: var(--gradient-primary);
  color: #FFFFFF;
}

.tabs {
  display: flex;
  gap: var(--space-4);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-6);
}

.tab-item {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.tab-item.active {
  color: var(--primary-light);
}

.tab-item.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
}

/* ── 6. Match Score Progress Ring ── */
.progress-ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-text {
  position: absolute;
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--text-primary);
}

/* ── 7. Chat Interface ── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 600px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: var(--border-glass);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-bubble-user {
  align-self: flex-end;
  max-width: 75%;
  padding: var(--space-3) var(--space-4);
  background: var(--gradient-primary);
  color: #FFFFFF;
  border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.chat-bubble-ai {
  align-self: flex-start;
  max-width: 75%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 0;
  border: var(--border-glass);
}

.chat-input-area {
  padding: var(--space-4);
  background: var(--bg-dark);
  border-top: var(--border-glass);
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.chat-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
}

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

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

/* ── 8. Modal Windows ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: var(--backdrop-blur);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-default);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border: var(--border-glass);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-card);
  transform: scale(0.95);
  transition: var(--transition-bounce);
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: var(--space-6);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: var(--border-glass);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ── 9. Skeleton Loaders ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-2);
  width: 100%;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* ── 10. Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-card);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  animation: slideIn 0.3s ease-out forwards;
  min-width: 280px;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-info { border-left: 4px solid var(--info); }

/* ── 15. API Fallback Card ── */
.api-fallback-card {
  padding: 24px;
  text-align: center;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-lg, 12px);
  margin: 16px 0;
  backdrop-filter: blur(10px);
}
