/* ==========================================================================
   침수차량 무료조회 (Flood Car Check) - 반응형 스타일시트
   Simple is Best, Mobile-First, SEO & AdSense Optimized
   ========================================================================== */

/* 1. Root & CSS Variables */
:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  
  /* Primary & Brand */
  --primary-color: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-dark: #172554;
  
  /* Status Colors */
  --safe-color: #059669;
  --safe-bg: #ecfdf5;
  --safe-border: #a7f3d0;
  
  --warning-color: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  
  --danger-color: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  /* Grays & Backgrounds */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* 2. Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-page);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, button, select, textarea {
  font: inherit;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 10px;
  background: var(--primary-color);
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  border-radius: var(--radius-sm);
  transition: top 0.2s;
  font-weight: 600;
}

.skip-link:focus {
  top: 10px;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Responsive Helper */
@media (max-width: 640px) {
  .hide-mobile {
    display: none;
  }
}

/* 3. Header */
.site-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
  line-height: 1;
}

.service-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
}

.service-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: none;
}

@media (min-width: 480px) {
  .service-tagline {
    display: block;
  }
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-free, .badge-no-sign {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.badge-free {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-no-sign {
  background-color: #f1f5f9;
  color: #475569;
}

/* 4. Main & Hero Section */
.site-main {
  flex: 1;
  padding: 24px 0 48px;
}

.search-section {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  text-align: center;
}

.search-hero-content {
  margin-bottom: 24px;
}

.hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  word-break: keep-all;
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 1.75rem;
  }
}

.hero-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  word-break: keep-all;
}

/* Plate Input & Form */
.search-form {
  max-width: 540px;
  margin: 0 auto;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 520px) {
  .input-group {
    flex-direction: row;
    align-items: stretch;
  }
}

.plate-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 2px 8px;
  flex: 1;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.plate-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.plate-badge {
  font-size: 0.75rem;
  font-weight: 800;
  background-color: #2563eb;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
  user-select: none;
  letter-spacing: 0.5px;
}

.car-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 1px;
  padding: 8px 4px;
}

.car-input::placeholder {
  font-size: 0.95rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0;
}

.clear-btn {
  color: #94a3b8;
  font-size: 1rem;
  padding: 4px 8px;
  transition: color 0.2s;
}

.clear-btn:hover {
  color: #475569;
}

.search-btn {
  background-color: var(--primary-color);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  transition: background-color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-height: 52px;
}

.search-btn:hover {
  background-color: var(--primary-hover);
}

.search-btn:active {
  transform: translateY(1px);
}

.search-btn:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
}

.input-guide {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.input-error {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  background-color: var(--danger-bg);
  color: var(--danger-color);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-align: left;
}

/* Test Presets (운영 화면 기본 숨김, 로컬 개발 환경에서만 활성화) */
.test-presets {
  display: none;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preset-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.preset-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.preset-btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.preset-indicator.safe, .preset-indicator.no-record { color: #2563eb; }
.preset-indicator.warning { color: var(--warning-color); }
.preset-indicator.danger { color: var(--danger-color); }

/* 5. AdSense Slot Styles (Optimized for CLS & Policy) */
.ad-container {
  margin: 20px 0;
  background-color: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 10px 12px 14px;
  text-align: center;
}

.ad-label {
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: #9ca3af;
  margin-bottom: 6px;
  font-weight: 600;
}

.ad-slot-box {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: var(--radius-sm);
  padding: 12px;
}

@media (min-width: 640px) {
  .ad-slot-box {
    min-height: 100px;
  }
}

.ad-placeholder-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b7280;
  text-align: left;
}

.ad-icon {
  font-size: 24px;
  opacity: 0.8;
}

.ad-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #4b5563;
}

.ad-sub {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2px;
}

/* 6. Results & State Cards */
.result-section {
  margin-bottom: 24px;
}

.state-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.state-icon {
  font-size: 40px;
  margin-bottom: 14px;
}

.state-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  word-break: keep-all;
}

.state-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
  word-break: keep-all;
}

.feature-bullets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  margin: 0 auto;
  text-align: left;
  background-color: var(--bg-page);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.bullet-check {
  color: var(--safe-color);
  font-weight: 800;
}

/* Loading Spinner */
.loading-spinner, .btn-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  margin: 0;
}

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

/* Result Card Component */
.result-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: fadeIn 0.3s ease-out;
}

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

/* Result Types */
.result-card.status-safe,
.result-card.status-no-record {
  border-color: #3b82f6;
}

.result-card.status-warning {
  border-color: var(--warning-color);
}

.result-card.status-danger {
  border-color: var(--danger-color);
}

/* Result Header Banner */
.result-header {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.status-safe .result-header,
.status-no-record .result-header {
  background-color: #f0f7ff;
}

.status-warning .result-header {
  background-color: var(--warning-bg);
}

.status-danger .result-header {
  background-color: var(--danger-bg);
}

.status-badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-safe .status-badge,
.status-no-record .status-badge {
  background-color: #2563eb;
  color: #ffffff;
}

.status-warning .status-badge {
  background-color: var(--warning-color);
  color: #ffffff;
}

.status-danger .status-badge {
  background-color: var(--danger-color);
  color: #ffffff;
}

.result-main-title {
  font-size: 1.35rem;
  font-weight: 800;
  word-break: keep-all;
}

.status-safe .result-main-title,
.status-no-record .result-main-title { color: #1e40af; }
.status-warning .result-main-title { color: #b45309; }
.status-danger .result-main-title { color: var(--danger-color); }

.result-sub-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.5;
  word-break: keep-all;
}

/* Vehicle Specs Table */
.result-body {
  padding: 24px 20px;
}

.section-subheading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  background-color: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

@media (min-width: 540px) {
  .info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #edf2f7;
  padding-bottom: 8px;
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.info-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
}

/* 데이터 출처 항목 줄바꿈 개선: 라벨 한 줄 고정, 출처 설명 자연스러운 개행 */
.info-item.info-item-source {
  align-items: flex-start;
  gap: 10px;
}

.info-item.info-item-source .info-label {
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 68px;
}

.info-item.info-item-source .info-val {
  word-break: keep-all;
  line-height: 1.45;
}

.val-highlight-safe { color: var(--safe-color); }
.val-highlight-warning { color: var(--warning-color); }
.val-highlight-danger { color: var(--danger-color); }

/* Flood Event Details Box */
.flood-detail-box {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.status-warning .flood-detail-box {
  border-left: 4px solid var(--warning-color);
}

.status-danger .flood-detail-box {
  border-left: 4px solid var(--danger-color);
}

.flood-detail-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 10px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.detail-table th, .detail-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.detail-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  width: 90px;
}

.detail-table td {
  color: var(--text-main);
}

.detail-table tr:last-child th,
.detail-table tr:last-child td {
  border-bottom: none;
}

/* Result Action / Reset Button */
.result-action-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

@media (min-width: 480px) {
  .result-action-bar {
    flex-direction: row;
    justify-content: center;
  }
}

.action-btn {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  transition: all 0.2s;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-print {
  background-color: #ffffff;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-print:hover {
  background-color: var(--primary-light);
}

/* 7. Inspection Guide Section */
.guide-section {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.section-header {
  text-align: center;
  margin-bottom: 28px;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary-color);
  background-color: var(--primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 8px;
  word-break: keep-all;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  word-break: keep-all;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .guide-grid {
    grid-template-columns: 1fr 1fr;
  }
  .guide-card:last-child {
    grid-column: span 2;
  }
}

.guide-card {
  background-color: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.guide-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.guide-num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary-color);
  background-color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.guide-icon {
  font-size: 1.5rem;
}

.guide-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  word-break: keep-all;
}

.guide-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  word-break: keep-all;
}

/* 8. FAQ Section */
.faq-section {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-page);
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item[open] {
  border-color: #cbd5e1;
  background-color: #ffffff;
}

.faq-question {
  padding: 16px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-toggle {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-light);
  transition: transform 0.2s;
}

.faq-item[open] .faq-toggle {
  transform: rotate(45deg);
  color: var(--primary-color);
}

.faq-answer {
  padding: 0 20px 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
  word-break: keep-all;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

/* 9. Disclaimer Section */
.disclaimer-section {
  margin-bottom: 32px;
}

.disclaimer-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.disclaimer-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

.disclaimer-text {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.6;
  word-break: keep-all;
}

/* 10. Footer */
.site-footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 32px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

@media (min-width: 640px) {
  .footer-container {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-title {
  color: var(--text-main);
  margin-bottom: 4px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--primary-color);
}

/* 11. Additional Status & Alert Helpers */
.badge-mock {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
  display: inline-block;
  margin-bottom: 4px;
}

.state-card.error-card {
  border-color: var(--danger-border);
  background-color: #fff;
}

.state-card.error-card .state-icon {
  color: var(--danger-color);
}

.error-retry-btn {
  margin-top: 14px;
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.2s;
}

.error-retry-btn:hover {
  background-color: var(--primary-hover);
}

.result-disclaimer-box {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.55;
  text-align: left;
}

.result-disclaimer-box strong {
  color: #78350f;
}

/* Print Stylesheet */
@media print {
  .site-header, .ad-container, .guide-section, .faq-section, .disclaimer-section,
  .site-footer, .test-presets, .search-section, .result-action-bar {
    display: none !important;
  }
  .result-card {
    border: 1px solid #000;
    box-shadow: none;
  }
  body {
    background: #fff;
  }
}
