/* ============================================
   COMPONENTS
   Buttons, cards, forms, lightbox, badges
   ============================================ */

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-8);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
  text-decoration: none;
  white-space: nowrap;
  border: none;
  border-radius: var(--radius-base);
  cursor: pointer;
  transition: all var(--transition-base) var(--ease-smooth);
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: var(--space-3) var(--space-4);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--accent-subtle);
  color: var(--accent-light);
}

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

.btn-lg {
  padding: var(--space-5) var(--space-12);
  font-size: var(--text-lg);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    transform var(--transition-base) var(--ease-smooth),
    border-color var(--transition-base) var(--ease-smooth),
    box-shadow var(--transition-base) var(--ease-smooth);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base) var(--ease-smooth);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--input-border-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--bg-elevated);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--input-placeholder);
}

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

.form-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  border-radius: var(--radius-full);
}

.badge-accent {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ===== LIGHTBOX ===== */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: var(--z-modal);
  opacity: 0;
  transition: opacity var(--transition-base);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lightbox-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.lightbox-container {
  position: relative;
  width: 90%;
  height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: lightboxZoomIn 0.3s var(--ease-out);
}

@keyframes lightboxZoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-close {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  width: 48px;
  height: 48px;
  background: rgba(10, 10, 11, 0.9);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: var(--text-2xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
}

.lightbox-close:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(10, 10, 11, 0.8);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: var(--text-xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
}

.lightbox-prev { left: var(--space-6); }
.lightbox-next { right: var(--space-6); }

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow-sm);
}

.lightbox-counter {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-5);
  background: rgba(10, 10, 11, 0.9);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  z-index: 10;
}

@media (max-width: 768px) {
  .lightbox-close {
    top: var(--space-4);
    right: var(--space-4);
    width: 40px;
    height: 40px;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
  }

  .lightbox-prev { left: var(--space-3); }
  .lightbox-next { right: var(--space-3); }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-base) var(--ease-out);
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  border-color: #10B981;
}

.toast-error {
  border-color: #EF4444;
}

/* ===== LOADER ===== */
.loader {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

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

/* ===== SITE BANNER (auth nudge) ===== */
.site-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--admin-space-3);
  padding: var(--admin-space-3) var(--admin-space-6);
  background: rgba(30, 30, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--admin-border);
  font-family: var(--admin-font);
  font-size: var(--admin-text-sm);
  color: var(--admin-text-secondary);
  text-align: center;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
}

.site-banner a {
  color: var(--admin-accent);
  text-decoration: none;
  font-weight: var(--admin-weight-semibold);
  cursor: pointer;
}

.site-banner a:hover {
  text-decoration: underline;
}

.site-banner-close {
  position: absolute;
  right: var(--admin-space-4);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--admin-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: var(--admin-space-1) var(--admin-space-2);
  line-height: 1;
  border-radius: var(--admin-radius-sm);
  transition: color 0.15s ease;
}

.site-banner-close:hover {
  color: var(--admin-text);
}

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border-color) 20%,
    var(--border-strong) 50%,
    var(--border-color) 80%,
    transparent 100%
  );
  margin: var(--space-8) 0;
}
