/* Guild Team Store Pro — Design System Tokens (Exact Brand Palette, Mobile-First, RTL, Reduced Motion) */

:root {
  --bg: #0C0D10;
  --surface: #15171C;
  --surface-2: #1C1F25;
  --border: #272A31;
  --border-strong: #353944;
  --text: #F5F5F7;
  --text-muted: #9298A3;
  --accent: #D9F8FF;
  --accent-ink: #0C0D10;
  --accent-subtle: rgba(217, 248, 255, 0.10);
  --success: #34D399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --warning: #FBBF24;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --error: #F87171;
  --error-bg: rgba(248, 113, 113, 0.12);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --header-h-mobile: 54px;
  --header-h-desktop: 60px;
  --sidebar-w: 220px;
  --container-max: 1240px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --ease-fast: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

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

/* Shared Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: transform var(--ease-fast), background-color var(--ease-fast), border-color var(--ease-fast), opacity var(--ease-fast);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .btn {
    min-height: 38px;
    padding: 0 14px;
  }
}

.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: #232730;
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: #c3f1fc;
  border-color: #c3f1fc;
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.35);
}

.btn-success:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.20);
}

.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.35);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(248, 113, 113, 0.35);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.22);
}

.btn-sm {
  min-height: 36px;
  padding: 0 11px;
  font-size: 12.5px;
}

@media (min-width: 768px) {
  .btn-sm {
    min-height: 32px;
  }
}

.btn-block {
  width: 100%;
}

/* Form Controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--ease-fast);
}

@media (min-width: 768px) {
  .input, .select {
    min-height: 38px;
    padding: 8px 12px;
  }
}

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

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid transparent;
}

.badge-success { background: var(--success-bg); color: var(--success); border-color: rgba(52, 211, 153, 0.25); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(251, 191, 36, 0.25); }
.badge-error { background: var(--error-bg); color: var(--error); border-color: rgba(248, 113, 113, 0.25); }
.badge-accent { background: var(--accent-subtle); color: var(--accent); border-color: rgba(217, 248, 255, 0.25); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* Cards & Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.mono {
  font-family: var(--font-mono);
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 7, 10, 0.78);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease-fast);
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 16px;
  }
}

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

.modal-panel {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(14px);
  transition: transform 190ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (min-width: 640px) {
  .modal-panel {
    border-radius: var(--radius-lg);
    padding: 20px;
    transform: scale(0.97);
  }
}

.modal-backdrop.open .modal-panel {
  transform: none;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* Toast Notifications */
.toast-stack {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 28px);
  width: 340px;
  pointer-events: none;
}

html[dir="rtl"] .toast-stack {
  right: auto;
  left: 14px;
}

.toast {
  pointer-events: auto;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: fadeSlideIn 160ms ease-out;
}

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

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #242832 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}

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

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

.view-fade {
  animation: fadeSlideIn 150ms ease-out;
}

.hidden {
  display: none !important;
}

/* Loading spinner inside buttons */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.6s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
