/* =============================================================================
   SHARED CSS - Variables, resets, auth overlay, app-content transition
   Used by all apps in the Ted Todd Tools portal.
   ============================================================================= */

:root {
  --forest: #284e36;
  --brass: #c6aa76;
  --wheat: #f1eadb;
  --oat: #f8f5ed;
  --black: #000000;
  --white: #ffffff;
  --font-primary: "Helvetica Neue", "Helvetica", "Arial", sans-serif;

  /* Woodworks brand colors */
  --woodworks-primary: #232d37;
  --woodworks-accent: #b48c5a;
  --woodworks-bg: #fcfaf5;

  /* Karta brand colors */
  --karta-primary: #1e1e1e;
  --karta-accent: #c6946b;
  --karta-bg: #f5f2ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-primary);
  background: var(--oat);
  color: var(--black);
}

/* =============================================================================
   AUTH OVERLAY (Supabase Auth)
   ============================================================================= */

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--forest);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-modal {
  background: var(--white);
  border-radius: 24px;
  padding: 48px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.auth-modal--supabase {
  max-width: 440px;
}

.auth-logo {
  margin-bottom: 32px;
}

.auth-logo h1 {
  margin: 0;
  font-size: 2.2rem;
  color: var(--forest);
  letter-spacing: 0.05em;
  font-weight: 700;
}

.auth-logo span {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  color: var(--brass);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

/* Auth Tabs (Sign In / Sign Up) */
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: rgba(40, 78, 54, 0.08);
  padding: 4px;
  border-radius: 14px;
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(40, 78, 54, 0.5);
  transition: all 0.2s ease;
}

.auth-tab:hover {
  color: rgba(40, 78, 54, 0.8);
  background: rgba(40, 78, 54, 0.05);
}

.auth-tab--active {
  background: var(--white);
  color: var(--forest);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Auth Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label {
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.7);
  text-align: left;
  font-weight: 500;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  padding: 14px 18px;
  font-size: 1rem;
  border-radius: 12px;
  border: 2px solid rgba(40, 78, 54, 0.15);
  text-align: left;
  letter-spacing: 0.02em;
  font-family: inherit;
  background: var(--oat);
  color: var(--black);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input[type="email"]::placeholder,
.auth-form input[type="password"]::placeholder {
  color: rgba(0, 0, 0, 0.35);
  letter-spacing: 0.02em;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 4px rgba(40, 78, 54, 0.12);
}

/* OTP code input */
.auth-otp-input {
  padding: 16px 18px !important;
  font-size: 1.6rem !important;
  letter-spacing: 0.35em !important;
  text-align: center !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums;
  border-radius: 12px;
  border: 2px solid rgba(40, 78, 54, 0.15);
  background: var(--oat);
  color: var(--forest);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-otp-input::placeholder {
  font-size: 1rem !important;
  letter-spacing: 0.02em !important;
  font-weight: 400 !important;
  color: rgba(0, 0, 0, 0.35);
}

/* Submit button */
.auth-submit {
  background: var(--forest);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font-family: inherit;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(40, 78, 54, 0.25);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Text links (magic link, forgot password, back) */
.auth-form__links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.auth-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--brass);
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s ease;
}

.auth-link:hover {
  color: var(--forest);
}

/* Info text above forms */
.auth-form__info {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.55);
  line-height: 1.5;
}

/* Error messages */
.auth-error {
  color: #c53030;
  font-size: 0.85rem;
  margin: 4px 0 0;
  padding: 10px 14px;
  background: rgba(197, 48, 48, 0.08);
  border-radius: 8px;
  font-weight: 500;
  text-align: left;
}

/* Success messages */
.auth-success {
  color: var(--forest);
  font-size: 0.85rem;
  margin: 4px 0 0;
  padding: 10px 14px;
  background: rgba(40, 78, 54, 0.08);
  border-radius: 8px;
  font-weight: 500;
  text-align: left;
}

/* Hint text at bottom */
.auth-hint {
  margin: 20px 0 0;
  font-size: 0.8rem;
  color: rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Fade out animation for auth overlay */
.auth-overlay.fade-out {
  animation: authFadeOut 0.4s ease-out forwards;
}

@keyframes authFadeOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80% { transform: translateX(6px); }
}

/* App content wrapper */
.app-content {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.app-content.visible {
  opacity: 1;
}

/* Responsive auth */
@media (max-width: 960px) {
  .auth-modal {
    padding: 32px 24px;
  }
}

@media (max-width: 480px) {
  .auth-form__links {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}
