/* ==========================================================================
   UI COMPONENTS & CONTROLS
   ========================================================================== */

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.card-hoverable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.btn-subtle {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

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

.btn-danger {
  background: var(--accent-danger-light);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: var(--accent-danger);
  color: #ffffff;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-google-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.btn-google-auth:hover {
  background: var(--bg-surface-hover);
  border-color: #4285F4;
  box-shadow: 0 4px 14px rgba(66, 133, 244, 0.15);
  transform: translateY(-1px);
}

.btn-google-auth:active {
  transform: translateY(0);
}

[data-theme="dark"] .btn-google-auth {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

[data-theme="dark"] .btn-google-auth:hover {
  background: var(--bg-surface-hover);
  border-color: #4285F4;
  box-shadow: 0 4px 16px rgba(66, 133, 244, 0.25);
}

/* --------------------------------------------------------------------------
   Form Inputs & Labels
   -------------------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-field {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-prefix, .input-suffix {
  position: absolute;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.input-prefix {
  left: 0.9rem;
}

.input-suffix {
  right: 0.9rem;
}

.has-prefix .input-field {
  padding-left: 2.2rem;
}

.has-suffix .input-field {
  padding-right: 2.5rem;
}

/* Custom Select Dropdowns */
.select-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Segmented Controls / Tabs
   -------------------------------------------------------------------------- */
.segmented-control {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 2px;
  width: 100%;
}

.segment-btn {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: calc(var(--radius-md) - 2px);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.segment-btn:hover {
  color: var(--text-primary);
}

.segment-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Command Palette (Spotlight Search Modal)
   -------------------------------------------------------------------------- */
.cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.cmd-palette-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.cmd-palette {
  width: 100%;
  max-width: 600px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(-8px) scale(0.98);
  transition: transform var(--transition-fast);
}

.cmd-palette-backdrop.open .cmd-palette {
  transform: translateY(0) scale(1);
}

/* --------------------------------------------------------------------------
   Modal Dialog Card (Auth, Profile, and Popups)
   -------------------------------------------------------------------------- */
.cmd-palette-modal {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px var(--border-subtle);
  overflow: hidden;
  position: relative;
  z-index: 101;
  transform: translateY(-8px) scale(0.98);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-font-smoothing: antialiased;
}

.cmd-palette-backdrop.open .cmd-palette-modal {
  transform: translateY(0) scale(1);
}

[data-theme="dark"] .cmd-palette-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.cmd-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.75rem;
}

.cmd-input {
  flex: 1;
  font-size: 1.05rem;
  color: var(--text-primary);
  background: transparent;
}

.cmd-input::placeholder {
  color: var(--text-muted);
}

.cmd-results-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.5rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}

.cmd-item:hover, .cmd-item.selected {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.cmd-item.selected {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

.cmd-item-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.cmd-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.cmd-item-title {
  font-weight: 600;
  font-size: 0.925rem;
}

.cmd-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-footer {
  padding: 0.65rem 1rem;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cmd-hints {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cmd-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.15rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInToast 200ms cubic-bezier(0.16, 1, 0.3, 1);
  transition: all var(--transition-fast);
}

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

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

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

.toast-content {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

@keyframes slideInToast {
  from {
    transform: translateY(12px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
