/* Material Design 3 - Dynamic Theme */
/* Default theme (Orange) - Overridden by Firestore data */

:root {
  /* Primary */
  --md-sys-color-primary: #8B5000;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #FFDCBE;
  --md-sys-color-on-primary-container: #2C1600;

  /* Secondary */
  --md-sys-color-secondary: #735941;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #FFDCBE;
  --md-sys-color-on-secondary-container: #29150A;

  /* Tertiary */
  --md-sys-color-tertiary: #586339;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #DCE8B4;
  --md-sys-color-on-tertiary-container: #161E00;

  /* Error */
  --md-sys-color-error: #BA1A1A;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #FFDAD6;
  --md-sys-color-on-error-container: #410002;

  /* Surface & Background */
  --md-sys-color-surface: #FFF8F5;
  --md-sys-color-on-surface: #211A14;
  --md-sys-color-surface-variant: #F3DFD2;
  --md-sys-color-on-surface-variant: #51443A;
  --md-sys-color-background: #FFF8F5;
  --md-sys-color-on-background: #211A14;

  /* Outline */
  --md-sys-color-outline: #847468;
  --md-sys-color-outline-variant: #D6C3B6;

  /* Inverse */
  --md-sys-color-inverse-surface: #372F28;
  --md-sys-color-inverse-on-surface: #FCEDE3;
  --md-sys-color-inverse-primary: #FFB86F;

  /* Others */
  --md-sys-color-shadow: #000000;
  --md-sys-color-surface-tint: #8B5000;
  --md-sys-color-scrim: #000000;

  /* Shape */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* Elevation */
  --md-sys-elevation-level1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
  --md-sys-elevation-level2: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
  --md-sys-elevation-level3: 0 1px 3px rgba(0,0,0,0.3), 0 4px 8px 3px rgba(0,0,0,0.15);
}

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

/* Base */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  line-height: 24px;
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page Background Gradient */
.page-background {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    135deg,
    var(--md-sys-color-primary-container) 0%,
    var(--md-sys-color-secondary-container) 50%,
    var(--md-sys-color-tertiary-container) 100%
  );
  z-index: -1;
}

/* Card */
.card {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 48px 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--md-sys-elevation-level3);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Loading */
.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--md-sys-color-surface);
  border-top-color: var(--md-sys-color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Logo */
.logo-container {
  margin: 0 auto 24px;
  text-align: center;
}

.logo {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Icon Fallback */
.icon-container {
  width: 88px;
  height: 88px;
  background-color: var(--md-sys-color-primary-container);
  border-radius: var(--md-sys-shape-corner-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.icon-container svg {
  width: 44px;
  height: 44px;
  fill: var(--md-sys-color-on-primary-container);
}

/* Typography */
.headline-medium {
  font-size: 28px;
  font-weight: 500;
  line-height: 36px;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.title-large {
  font-size: 22px;
  font-weight: 500;
  line-height: 28px;
  color: var(--md-sys-color-primary);
  margin-bottom: 16px;
  word-break: break-all;
}

.body-large {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 32px;
}

/* Divider */
.divider {
  height: 1px;
  border: none;
  background-color: var(--md-sys-color-outline-variant);
  margin: 24px 0;
}

/* Footer */
.footer {
  font-size: 14px;
  line-height: 20px;
  color: var(--md-sys-color-on-surface-variant);
}

.footer strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  display: block;
  margin-bottom: 4px;
}

.footer a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--md-sys-color-secondary);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
  .card {
    padding: 40px 24px;
    border-radius: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: none;
  }

  .headline-medium {
    font-size: 24px;
    line-height: 32px;
  }

  .title-large {
    font-size: 16px;
    line-height: 24px;
  }
}
