/* ==========================================================================
   SpoonFlow Base Styles & Reset
   Accessibility-first layout & 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(--font-current);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Accessible Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: var(--border-focus);
  color: #000;
  padding: 0.5rem 1rem;
  font-weight: 700;
  z-index: 9999;
  border-radius: var(--radius-sm);
  transition: top var(--transition-fast);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid #fff;
}

/* Accessible Focus Outlines */
:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

p {
  color: var(--text-secondary);
  font-size: var(--text-base);
}

a {
  color: var(--spoon-lavender);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--spoon-emerald);
}

/* Form Inputs & Buttons Reset */
button, input, select, textarea {
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
}

button {
  cursor: pointer;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

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

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  color: var(--text-primary);
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
  outline: none;
}

/* App Container Layout */
.app-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  flex: 1;
}

/* Header & Nav */
.app-header {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
  margin-bottom: 2rem;
}

.header-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--spoon-lavender), var(--spoon-emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-lavender);
}

.brand-logo-icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.brand-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #f8fafc, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(129, 140, 248, 0.15);
  color: var(--spoon-lavender);
  border: 1px solid rgba(129, 140, 248, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Button Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--spoon-lavender), #6366f1);
  color: #ffffff;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-lavender);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--spoon-emerald), #059669);
  color: #ffffff;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
}

.btn-emerald:hover {
  box-shadow: var(--shadow-glow-emerald);
  filter: brightness(1.1);
}

.btn-amber {
  background: linear-gradient(135deg, var(--spoon-amber), #d97706);
  color: #111827;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
}

.btn-amber:hover {
  box-shadow: var(--shadow-glow-amber);
  filter: brightness(1.08);
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--bg-surface-elevated);
}

/* Screen reader only utility */
.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;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-left: 4px solid var(--spoon-lavender);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 380px;
  animation: slideInUp 0.25s ease-out;
}

.toast.toast-success {
  border-left-color: var(--spoon-emerald);
}

.toast.toast-warning {
  border-left-color: var(--spoon-amber);
}

.toast.toast-rest {
  border-left-color: var(--spoon-cyan);
}
