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

:root {
  --ink: #2c2319;
  --ink-light: #5a4a3a;
  --muted: #8b7a67;
  --accent: #e76f51;
  --accent-dark: #c94f35;
  --accent-light: #f4a261;
  --panel: #fdfaf7;
  --panel-strong: #f8f3ee;
  --panel-elevated: #ffffff;
  --border: rgba(107, 85, 68, 0.15);
  --border-strong: rgba(107, 85, 68, 0.25);
  --shadow-sm: 0 2px 8px rgba(44, 35, 25, 0.04);
  --shadow-md: 0 8px 24px rgba(44, 35, 25, 0.08);
  --shadow-lg: 0 16px 48px rgba(44, 35, 25, 0.12);
  --shadow-accent: 0 12px 32px rgba(231, 111, 81, 0.24);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, #fef9f4 0%, #fdf5ed 35%, #faf0e6 100%);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.orb-a {
  width: 480px;
  height: 480px;
  top: -180px;
  left: -120px;
  background: radial-gradient(circle, rgba(244, 162, 97, 0.4) 0%, rgba(244, 162, 97, 0) 70%);
  animation-delay: 0s;
}

.orb-b {
  width: 400px;
  height: 400px;
  right: -140px;
  top: 100px;
  background: radial-gradient(circle, rgba(231, 111, 81, 0.3) 0%, rgba(231, 111, 81, 0) 70%);
  animation-delay: -7s;
}

.orb-c {
  width: 520px;
  height: 520px;
  bottom: -200px;
  left: 35%;
  background: radial-gradient(circle, rgba(250, 200, 152, 0.35) 0%, rgba(250, 200, 152, 0) 70%);
  animation-delay: -14s;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
  position: relative;
  z-index: 1;
}

/* Header Styles */
.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(20px) saturate(180%);
  background: rgba(253, 250, 247, 0.92);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: all 0.3s ease;
}

.site-header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-header:hover::before {
  opacity: 1;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.3s ease;
}

.brand:hover {
  transform: translateY(-2px);
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 1.1rem;
  box-shadow: var(--shadow-accent);
  position: relative;
  overflow: hidden;
}

.brand-mark::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.brand-mark:hover::before {
  opacity: 1;
}

.brand-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-form {
  margin: 0;
}

.nav-button {
  background: transparent;
  border: none;
}

.nav-link {
  color: var(--ink-light);
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.nav-link:hover {
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.nav-link-ghost {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
}

.nav-link-ghost:hover {
  background: var(--panel-elevated);
  box-shadow: var(--shadow-md);
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 48px;
  align-items: center;
  padding: 60px 0 48px;
  animation: fadeInUp 0.8s ease;
}

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

.hero-text h1 {
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  margin: 0 0 20px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-text p {
  color: var(--ink-light);
  line-height: 1.7;
  font-size: 1.05rem;
  max-width: 540px;
}

.hero-text b {
  color: var(--accent);
  font-weight: 600;
}

.hero-card {
  display: grid;
  gap: 20px;
  animation: fadeInUp 0.8s ease 0.2s both;
}

/* Card Styles */
.card {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(231, 111, 81, 0.1);
  border-color: var(--accent-light);
}

.card:hover::before {
  transform: scaleX(1);
}

form label {
  font-weight: 600;
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: -0.01em;
}

textarea,
input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--panel);
  font-family: inherit;
  margin-bottom: 18px;
  transition: all 0.3s ease;
  font-size: 1rem;
  color: var(--ink);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel-elevated);
  box-shadow: 0 0 0 4px rgba(231, 111, 81, 0.08);
}

input[type="file"] {
  cursor: pointer;
  padding: 12px;
}

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 999px;
  text-decoration: none;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 40px rgba(231, 111, 81, 0.35);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary span,
.btn-secondary span {
  position: relative;
  z-index: 1;
}

.btn-secondary {
  border: 1.5px solid var(--border-strong);
  background: var(--panel-elevated);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--panel);
  border-color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.hint {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
  padding: 14px 18px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-light);
}

/* Grid Layouts */
.info-grid,
.excel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  margin-top: 32px;
}

.info-card,
.upload-card {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.info-card:hover,
.upload-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.info-card h2,
.upload-card h2,
.info-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-family: 'Crimson Pro', Georgia, serif;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.info-card h3 {
  font-size: 1.3rem;
}

.info-card p {
  color: var(--ink-light);
  line-height: 1.6;
}

/* Alerts */
.alerts {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
  animation: slideDown 0.4s ease;
}

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

.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--panel-elevated);
  border: 1.5px solid var(--border);
  border-left-width: 4px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.alert-error {
  background: #fff5f5;
  border-color: #feb2b2;
  border-left-color: #fc8181;
  color: #742a2a;
}

.alert-success {
  background: #f0fff4;
  border-color: #9ae6b4;
  border-left-color: #68d391;
  color: #22543d;
}

.alert-warn {
  background: #fffaf0;
  border-color: #fbd38d;
  border-left-color: #f6ad55;
  color: #744210;
}

/* Result Page */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 0;
  animation: fadeInUp 0.6s ease;
}

.result-header h2 {
  margin: 0;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 2rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.result-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Map Frame */
.map-frame {
  margin-top: 28px;
  background: var(--panel-elevated);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  min-height: 600px;
  animation: fadeInUp 0.8s ease 0.2s both;
}

.map-frame iframe {
  width: 100%;
  height: 700px;
  border: none;
  display: block;
}

/* File Meta */
.file-meta {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.file-meta li {
  margin-bottom: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--ink-light);
}

.file-meta li:last-child {
  border-bottom: none;
}

.file-meta b {
  color: var(--ink);
  font-weight: 600;
  margin-right: 8px;
}

/* Auth Page */
.auth-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
  align-items: start;
  padding: 40px 0;
  animation: fadeInUp 0.8s ease;
}

.auth-card {
  max-width: 480px;
}

.auth-card form p {
  margin: 0 0 18px;
}

.auth-card form label {
  font-size: 0.95rem;
  color: var(--ink-light);
}

.auth-side {
  padding: 32px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.auth-side h3 {
  margin-top: 0;
  font-family: 'Crimson Pro', Georgia, serif;
  color: var(--ink);
  font-size: 1.5rem;
}

.auth-side p {
  color: var(--ink-light);
  line-height: 1.7;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 32px 0;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 0;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero {
    gap: 32px;
    padding: 40px 0 32px;
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .card {
    padding: 24px;
  }

  .map-frame {
    min-height: 400px;
  }

  .map-frame iframe {
    height: 500px;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-actions {
    width: 100%;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }

  .brand-title {
    font-size: 1.2rem;
  }

  .brand-subtitle {
    font-size: 0.82rem;
  }

  .hero-text h1 {
    font-size: 1.75rem;
  }

  .info-grid,
  .excel-grid {
    grid-template-columns: 1fr;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .bg-orb,
  .site-header,
  .site-footer,
  .nav,
  .result-actions {
    display: none;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
