/**
 * AdssouQ Unified Design System
 * iOS-inspired, minimal, modern, responsive CSS architecture
 */

:root {
  /* Brand Colors */
  --ad-crimson: #ad1823;
  --ad-crimson-hover: #8e101a;
  --ad-crimson-dark: #5d0b12;
  --ad-crimson-soft: #fdf5f5;
  --ad-crimson-glow: rgba(173, 24, 35, 0.22);
  --ad-yellow: #fff000;
  --ad-navy: #430a10;

  /* Surfaces & Neutrals (iOS Light Mode) */
  --ad-bg-canvas: #f8fafc;
  --ad-bg-card: #ffffff;
  --ad-bg-subtle: #f1f5f9;
  --ad-bg-elevated: #ffffff;

  /* Typography Colors */
  --ad-text-primary: #0f172a;
  --ad-text-secondary: #475569;
  --ad-text-muted: #94a3b8;
  --ad-text-on-crimson: #ffffff;

  /* Borders & Dividers */
  --ad-border-subtle: #e2e8f0;
  --ad-border-light: rgba(15, 23, 42, 0.07);
  --ad-border-focus: #ad1823;

  /* Corner Radii (Consistent System) */
  --ad-radius-xs: 6px;
  --ad-radius-sm: 10px;
  --ad-radius-md: 14px;
  --ad-radius-lg: 20px;
  --ad-radius-xl: 28px;
  --ad-radius-pill: 9999px;

  /* Shadows (iOS Subtle Depth) */
  --ad-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --ad-shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --ad-shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --ad-shadow-crimson: 0 8px 24px -4px rgba(173, 24, 35, 0.28);
  --ad-shadow-modal: 0 24px 64px -12px rgba(15, 23, 42, 0.22);

  /* Typography */
  --ad-font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ad-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --ad-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ad-transition-fast: 150ms var(--ad-ease-out);
  --ad-transition-base: 240ms var(--ad-ease-out);
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ad-font-sans);
  background-color: var(--ad-bg-canvas);
  color: var(--ad-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--ad-transition-fast);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── BUTTON SYSTEM ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  padding: 12px 22px;
  border-radius: var(--ad-radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--ad-transition-fast);
  user-select: none;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(173, 24, 35, 0.25);
}

.btn-primary {
  background: var(--ad-crimson);
  color: #ffffff !important;
  box-shadow: var(--ad-shadow-crimson);
}
.btn-primary:hover {
  background: var(--ad-crimson-hover);
  transform: translateY(-1.5px);
  box-shadow: 0 10px 28px -4px rgba(173, 24, 35, 0.35);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--ad-bg-subtle);
  color: var(--ad-text-primary) !important;
}
.btn-secondary:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--ad-text-primary) !important;
  border-color: var(--ad-border-subtle);
}
.btn-outline:hover {
  background: var(--ad-bg-subtle);
  border-color: #cbd5e1;
}

.btn-destructive {
  background: #fef2f2;
  color: #dc2626 !important;
  border-color: #fee2e2;
}
.btn-destructive:hover {
  background: #fee2e2;
  color: #b91c1c !important;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--ad-radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ad-bg-subtle);
  color: var(--ad-text-secondary);
}
.btn-icon:hover {
  background: #e2e8f0;
  color: var(--ad-text-primary);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12.5px;
  border-radius: var(--ad-radius-pill);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 700;
}

.btn:disabled, .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── CARDS & PANELS ── */
.ad-card {
  background: var(--ad-bg-card);
  border-radius: var(--ad-radius-lg);
  border: 1px solid var(--ad-border-light);
  box-shadow: var(--ad-shadow-md);
  padding: 24px;
  transition: transform var(--ad-transition-base), box-shadow var(--ad-transition-base), border-color var(--ad-transition-base);
}

.ad-card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--ad-shadow-lg);
  border-color: rgba(173, 24, 35, 0.15);
}

/* ── BADGES & CHIPS ── */
.ad-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--ad-radius-pill);
  line-height: 1;
}

.ad-badge-crimson {
  background: var(--ad-crimson-soft);
  color: var(--ad-crimson);
  border: 1px solid rgba(173, 24, 35, 0.12);
}

.ad-badge-yellow {
  background: var(--ad-yellow);
  color: var(--ad-navy);
  font-weight: 800;
}

.ad-badge-slate {
  background: var(--ad-bg-subtle);
  color: var(--ad-text-secondary);
}

.ad-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--ad-radius-pill);
  background: #ffffff;
  border: 1px solid var(--ad-border-subtle);
  font-size: 13px;
  font-weight: 600;
  color: var(--ad-text-secondary);
  cursor: pointer;
  transition: all var(--ad-transition-fast);
}

.ad-chip:hover {
  border-color: #cbd5e1;
  color: var(--ad-text-primary);
}

.ad-chip.active {
  background: var(--ad-crimson);
  border-color: var(--ad-crimson);
  color: #ffffff;
}

/* ── FORM CONTROLS ── */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--ad-text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-control {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ad-text-primary);
  background: #ffffff;
  border: 1.5px solid var(--ad-border-subtle);
  border-radius: var(--ad-radius-sm);
  padding: 12px 14px;
  transition: border-color var(--ad-transition-fast), box-shadow var(--ad-transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--ad-crimson);
  box-shadow: 0 0 0 3px rgba(173, 24, 35, 0.12);
}

.form-control::placeholder {
  color: var(--ad-text-muted);
}

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

/* ── MODALS (iOS Sheet & Dialog) ── */
.ad-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--ad-transition-base);
}

.ad-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.ad-modal-sheet {
  background: #ffffff;
  border-radius: var(--ad-radius-xl);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--ad-shadow-modal);
  transform: scale(0.96) translateY(12px);
  transition: transform var(--ad-transition-base);
}

.ad-modal-backdrop.active .ad-modal-sheet {
  transform: scale(1) translateY(0);
}

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

.ad-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ad-text-primary);
  letter-spacing: -0.3px;
}

.ad-modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--ad-radius-pill);
  border: none;
  background: var(--ad-bg-subtle);
  color: var(--ad-text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ad-transition-fast);
}

.ad-modal-close:hover {
  background: #e2e8f0;
  color: var(--ad-text-primary);
}

.ad-modal-body {
  padding: 24px;
  overflow-y: auto;
}

.ad-modal-foot {
  padding: 16px 24px;
  background: var(--ad-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--ad-border-subtle);
}

/* ── GLOBAL TOAST NOTIFICATIONS ── */
#ad-toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100000;
  pointer-events: none;
}

.ad-toast {
  pointer-events: auto;
  background: #0f172a;
  color: #ffffff;
  padding: 13px 18px;
  border-radius: var(--ad-radius-pill);
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  animation: adToastIn 0.3s var(--ad-ease-out);
  max-width: 380px;
}

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

/* ── SKELETON LOADERS ── */
.skeleton {
  background: #e2e8f0;
  animation: skeletonPulse 1.5s ease-in-out infinite alternate;
  border-radius: var(--ad-radius-sm);
}

@keyframes skeletonPulse {
  0% { opacity: 0.55; }
  100% { opacity: 1; }
}

/* ── GLOBAL NAVBAR ── */
.ad-navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--ad-border-light);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.ad-navbar-container {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ad-navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -1px;
  color: #1a0f0f;
  flex-shrink: 0;
}

.ad-navbar-brand img {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow: 0 4px 12px rgba(173, 24, 35, 0.2);
}

.ad-navbar-brand span span {
  color: var(--ad-crimson);
}

.ad-navbar-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ad-text-secondary);
}

.ad-navbar-links a:hover {
  color: var(--ad-crimson);
}

.ad-navbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .ad-navbar-links {
    display: none;
  }
}

@media (max-width: 480px) {
  .ad-navbar {
    height: 62px;
  }
  .ad-navbar-container {
    width: calc(100% - 24px);
  }
  .ad-navbar-brand {
    font-size: 20px;
    gap: 8px;
  }
  .ad-navbar-brand img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  .ad-navbar-actions {
    gap: 8px;
  }
  .ad-navbar-actions .btn {
    padding: 7px 11px;
    font-size: 12px;
    border-radius: 10px;
  }
}
