@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;700&display=swap');

:root {
  --bg: #F8F8F6;
  --surface: #FFFFFF;
  --border: #E2E2DD;
  --accent-red: #C8102E;
  --accent-blue: #003F87;
  --accent-gold: #D4AF37;
  --text-primary: #1A1A1A;
  --text-muted: #6B6B6B;
  --win: #2D7A3A;
  --draw: #B8860B;
  --loss: #C8102E;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

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

a:hover {
  opacity: 0.8;
}

/* Auth Page layout */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  background-color: var(--bg);
  background-image: radial-gradient(circle at top right, rgba(0, 63, 135, 0.03), transparent),
                    radial-gradient(circle at bottom left, rgba(200, 16, 46, 0.02), transparent);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--accent-blue);
  color: var(--surface);
  font-size: 28px;
  border-radius: 50%;
  margin-bottom: 16px;
  font-weight: bold;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-size: 36px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 63, 135, 0.1);
  background: var(--surface);
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.form-checkbox {
  margin-right: 8px;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.auth-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-blue);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
  box-shadow: var(--shadow-sm);
}

.auth-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-error {
  background: rgba(200, 16, 46, 0.05);
  border: 1px solid rgba(200, 16, 46, 0.2);
  color: var(--accent-red);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}

/* Config Modal style for Supabase Configuration */
.config-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.config-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.config-header {
  margin-bottom: 20px;
  text-align: center;
}

.config-title {
  font-size: 28px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.config-desc {
  font-size: 14px;
  color: var(--text-muted);
}

/* Header style for App */
.app-header {
  position: sticky;
  top: 0;
  background: rgba(248, 248, 246, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  height: 72px;
}

.app-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--accent-blue);
  background: transparent;
  padding: 4px 8px;
  border: 2px solid var(--accent-blue);
  letter-spacing: 0.05em;
  font-weight: 900;
}

.app-title {
  font-size: 24px;
}

.app-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.save-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: var(--transition);
}

.save-status.saving {
  background: rgba(0, 63, 135, 0.05);
  color: var(--accent-blue);
  border-color: rgba(0, 63, 135, 0.2);
}

.save-status.failed {
  background: rgba(200, 16, 46, 0.05);
  color: var(--accent-red);
  border-color: rgba(200, 16, 46, 0.2);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover {
  background: var(--accent-red);
  color: var(--surface);
  border-color: var(--accent-red);
}

/* Global Tooltips */
.tooltip {
  position: relative;
  border-bottom: 1px dashed var(--text-muted);
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1A1A1A;
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  white-space: normal;
  width: 200px;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10000;
  font-family: var(--font-body);
  font-weight: normal;
  line-height: 1.4;
}

.tooltip:hover::after, .tooltip:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Toast message for global exceptions */
.global-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent-red);
  color: var(--surface);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 99999;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-toast.show {
  transform: translateY(0);
}

.global-toast .close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  margin-left: 8px;
}
