/* ==========================================================
   Foundation — リセット・カスタムプロパティ・ベーススタイル
   ========================================================== */

/* --- Custom Properties --- */
:root {
  /* Primary */
  --color-primary:       #2563EB;
  --color-primary-dark:  #1D4ED8;
  --color-primary-light: #DBEAFE;
  --color-primary-50:    #EFF6FF;

  /* Semantic */
  /* -light は背景、-dark は その -light 背景の上に載せる文字色（バッジ等）に使う */
  --color-success:       #10B981;
  --color-success-light: #D1FAE5;
  /* -light 背景の上に載せる文字色。白文字を載せる塗りつぶし（同一棟バッジ等）にも使う
     （--color-success は明るすぎて白文字のコントラストが 2.6:1 しか出ない）。
     **以前は同じ名前を2回宣言していて（#059669 と #047857）、後勝ちで #047857 だけが
     効いていた**。用途が2つあっても名前は1つ＝どちらが効くかを偶然に任せない。 */
  --color-success-dark:  #047857;
  --color-warning:       #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-warning-dark:  #B45309;
  --color-danger:        #EF4444;
  --color-danger-light:  #FEE2E2;
  --color-danger-dark:   #DC2626;
  --color-info:          #3B82F6;
  --color-info-light:    #DBEAFE;

  /* Accent（KPI・ランクバッジ・ヒーローのグラデーション） */
  --color-accent-purple:       #7C3AED;
  --color-accent-purple-light: #EDE9FE;

  /* Sidebar */
  --color-sidebar-bg:    #1E293B;
  --color-sidebar-hover: #334155;
  --color-sidebar-text:  #CBD5E1;
  --color-sidebar-active:#2563EB;

  /* Background */
  --color-bg:            #F1F5F9;
  --color-bg-white:      #FFFFFF;
  --color-card-bg:       #FFFFFF;
  --color-bg-muted:      #F3F4F6;

  /* Text */
  --color-text:          #0F172A;
  --color-text-sub:      #334155;
  --color-text-muted:    #475569;
  --color-text-white:    #FFFFFF;
  --color-text-disabled: #D1D5DB;

  /* 事例ソース — 土地評価・事例評価のカード枠線とバッジで共用。
     値の割り当ての正典は App\Enums\Sales\ComparableSource（`--color-source-{value}`）。
     `-strong` は選択中カードの太い枠線用の濃色（以前は JS が生 hex を持っていた）。 */
  --color-source-mlit:           #9CA3AF; /* 国交省 */
  --color-source-mlit-strong:    #475569;
  --color-source-company:        #D97706; /* 基幹の自社成約 */
  --color-source-company-strong: #B45309;
  --color-source-listing:        #0891B2; /* 基幹の自社売出中（戸建） */
  --color-source-listing-strong: #0E7490;
  --color-source-master:         #059669; /* 事例マスタ */
  --color-source-master-strong:  #047857;

  /* Border */
  --color-border:        #CBD5E1;
  --color-border-light:  #E2E8F0;
  --color-border-input:  #94A3B8;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.04);

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transition */
  --transition-fast: .15s ease;
  --transition-base: .25s ease;
  --transition-slow: .35s ease;
  --transition-bounce: .4s cubic-bezier(.34,1.56,.64,1);

  /* Typography */
  --font-sans:  "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  "Inter", "SF Mono", "Fira Code", monospace;

  /* Sidebar width */
  --sidebar-width: 260px;
  --topbar-height: 64px;
}


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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
  letter-spacing: .02em;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--color-primary-dark);
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .01em;
  color: var(--color-text);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
}

/* Scrollbar (Webkit) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}


/* --- Focus Ring (共通) --- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none; /* form elements use box-shadow instead */
}


/* --- Global Keyframes --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes skeleton {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulseGlow {
  0%,100% { opacity: .6; }
  50%     { opacity: 1; }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulseBadge {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.15); }
}
