/* ============================================================
 * Base Styles v2.0 — Reset + RTL + Focus Visible
 * ============================================================ */

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

/* ---------- HTML / Body ---------- */
html {
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

html[dir="ltr"] {
  direction: ltr;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: var(--font-regular);
  color: var(--text-primary);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(212, 168, 67, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(52, 211, 153, 0.04) 0%, transparent 50%);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-block-end: var(--space-4);
}

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

a:hover {
  color: var(--accent-gold-hover);
  text-decoration: underline;
}

/* ---------- Focus Visible (WCAG 2.4.7) ---------- */
/* Universal focus ring for keyboard navigation */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* For elements with rounded corners */
button:focus-visible,
.btn:focus-visible,
.seat:focus-visible,
.card:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-ring-offset);
}

/* Remove focus ring for mouse users (when :focus-visible not supported fallback) */
@supports not selector(:focus-visible) {
  *:focus {
    outline: var(--focus-outline);
    outline-offset: var(--focus-ring-offset);
  }
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  inset-block-start: -40px;
  inset-inline-start: 0;
  background: var(--accent-gold);
  color: var(--text-on-accent);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  font-weight: var(--font-bold);
  z-index: var(--z-tooltip);
  border-radius: 0 0 var(--radius-md) 0;
  transition: inset-block-start var(--transition-fast);
}

.skip-link:focus {
  inset-block-start: 0;
  color: var(--text-on-accent);
}

/* ---------- Form Elements ---------- */
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

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

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

input,
select,
textarea {
  background: var(--bg-surface);
  border: var(--border-thin);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: var(--touch-target);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(212, 168, 67, 0.4);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

input[dir="rtl"],
textarea[dir="rtl"] {
  text-align: right;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="search"] {
  width: 100%;
}

/* ---------- Selection ---------- */
::selection {
  background-color: rgba(212, 168, 67, 0.35);
  color: var(--text-primary);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-gold-active);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

html {
  scrollbar-color: var(--accent-gold-active) var(--bg-primary);
  scrollbar-width: thin;
}

/* ---------- Images / Media ---------- */
img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  fill: currentColor;
}

/* ---------- Lists ---------- */
ul,
ol {
  list-style: none;
}

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  width: 100%;
}

/* ---------- Utility Classes ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-gold     { color: var(--accent-gold); }
.text-success  { color: var(--accent-emerald); }
.text-error    { color: var(--accent-red); }
.text-info     { color: var(--accent-blue); }

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.grid { display: grid; }

.hidden { display: none !important; }

/* ---------- Loading Skeleton ---------- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-block-end: var(--space-2);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
}

.skeleton-seat {
  width: var(--seat-size-mobile);
  height: var(--seat-size-mobile);
  border-radius: var(--radius-full);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25%      { transform: scale(1.1); }
  50%      { transform: scale(1); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(212, 168, 67, 0.3); }
  50%      { box-shadow: 0 0 24px rgba(212, 168, 67, 0.6); }
}

.animate-fadeIn   { animation: fadeIn var(--transition-normal) ease-out; }
.animate-slideUp  { animation: slideUp var(--transition-normal) ease-out; }
.animate-slideDown { animation: slideDown var(--transition-normal) ease-out; }
.animate-pulse    { animation: pulse 2s ease-in-out infinite; }
.animate-rotate   { animation: rotate 2s linear infinite; }
.animate-heartbeat { animation: heartbeat 1.5s ease-in-out infinite; }
.animate-glow     { animation: glow 2s ease-in-out infinite; }
