/**
 * assets/css/ui-components.css
 * ═════════════════════════════════════════════════════════════
 * Production UI component styles
 */

/* ─────────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.2);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.04));
}

.toast-success .fa-check-circle {
  color: var(--green);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.2);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.04));
}

.toast-error .fa-exclamation-circle {
  color: var(--red);
}

.toast-warning {
  border-color: rgba(245, 158, 11, 0.2);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.04));
}

.toast-warning .fa-exclamation-triangle {
  color: var(--amber);
}

.toast-info {
  border-color: rgba(24, 119, 242, 0.2);
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.08), rgba(24, 119, 242, 0.04));
}

.toast-info .fa-info-circle {
  color: var(--blue);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--text);
}

.toast-exit {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(400px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(400px);
  }
}

/* ─────────────────────────────────────────────────────────────
   MODALS
───────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal-overlay.modal-exit {
  animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}

.modal-overlay.modal-exit .modal-content {
  animation: modalOut 0.3s ease forwards;
}

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

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px;
  color: var(--text2);
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  font-family: inherit;
}

.modal-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.modal-btn-primary {
  background: var(--blue);
  color: #fff;
}

.modal-btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ─────────────────────────────────────────────────────────────
   LOADING STATES
───────────────────────────────────────────────────────────────── */

.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9100;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

.loader-overlay.loader-exit {
  animation: fadeOut 0.3s ease forwards;
}

.loader-content {
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-message {
  color: var(--text);
  font-size: 14px;
  margin: 12px 0 0;
}

/* Skeleton Loaders */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  height: 12px;
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    var(--surface3) 50%,
    var(--surface2) 75%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 2s infinite;
}

.skeleton-line:last-child {
  width: 85%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─────────────────────────────────────────────────────────────
   FORM ELEMENTS
───────────────────────────────────────────────────────────────── */

.field-error {
  border-color: var(--red) !important;
}

.field-valid {
  border-color: var(--green) !important;
}

.field-error-msg {
  display: none;
  color: var(--red);
  font-size: 12px;
  margin-top: 4px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   TOOLTIPS
───────────────────────────────────────────────────────────────── */

.tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 7000;
  box-shadow: var(--shadow);
  animation: tooltipIn 0.2s ease;
}

.tooltip-fade {
  animation: tooltipOut 0.2s ease forwards;
}

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

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

/* ─────────────────────────────────────────────────────────────
   PROGRESS BAR
───────────────────────────────────────────────────────────────── */

.progress-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(24, 119, 242, 0.4);
}

/* ─────────────────────────────────────────────────────────────
   BADGES & PILLS
───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-dim);
  border: 1px solid rgba(24, 119, 242, 0.2);
  color: #60a5fa;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: var(--green);
}

.badge-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--red);
}

/* ─────────────────────────────────────────────────────────────
   BUTTONS - ENHANCED
───────────────────────────────────────────────────────────────── */

button,
.btn {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.1);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE
───────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .toast-container {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    font-size: 12px;
    padding: 10px 12px;
  }

  .modal-content {
    width: 95%;
    border-radius: var(--radius-lg);
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-btn {
    width: 100%;
  }
}
