/* Plario Files 共通スタイル
   Plario Base の v2 デザイン（frontend/src/app/globals.css・shadcn new-york・slate＋indigo）に合わせている。
   色は Plario Base の値（oklch）と同じ Tailwind の slate / indigo を、古いブラウザでも出るように16進で書いている。 */

@font-face {
  font-family: "Inter";
  src: url("/assets/inter-latin.woff2?v=3") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
                 U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --background: #f8fafc;          /* slate-50 */
  --foreground: #0f172a;          /* slate-900 */
  --card: #ffffff;
  --brand: #020617;               /* 見出し（ロゴ色） */
  --wordmark: #0f1b2e;            /* ロゴの「Files」 */
  --primary: #4f46e5;             /* indigo-600 */
  --primary-hover: #4338ca;       /* indigo-700 */
  --primary-soft: #eef2ff;        /* indigo-50 */
  --primary-soft-fg: #4338ca;
  --muted: #f1f5f9;               /* slate-100 */
  --muted-foreground: #64748b;    /* slate-500 */
  --border: #cbd5e1;              /* slate-300（Plario Base と同じ・カードや入力欄の枠） */
  --border-soft: #e2e8f0;         /* slate-200（カード内の区切り線） */
  --input: #cbd5e1;
  --input-bg: transparent;
  --ring: rgba(79, 70, 229, .35);
  --destructive: #dc2626;         /* red-600 */
  --destructive-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #b45309;             /* amber-700（文字用） */
  --warning-soft: #fffbeb;
  --warning-border: #fcd34d;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, .08), 0 8px 10px -6px rgba(15, 23, 42, .08);
  --font-sans: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

/* 暗い表示（端末の設定に従う。ヘッダーの切り替えボタンで固定もできる） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #020617; --foreground: #f8fafc; --card: #0f172a; --brand: #ffffff; --wordmark: #ffffff;
    --primary: #4f46e5; --primary-hover: #6366f1; --primary-soft: rgba(99, 102, 241, .16); --primary-soft-fg: #a5b4fc;
    --muted: #1e293b; --muted-foreground: #94a3b8; --border: rgba(255, 255, 255, .1); --border-soft: rgba(255, 255, 255, .08);
    --input: rgba(255, 255, 255, .15); --input-bg: rgba(255, 255, 255, .04); --ring: rgba(99, 102, 241, .45);
    --destructive: #f87171; --destructive-soft: rgba(248, 113, 113, .12); --success: #4ade80; --success-soft: rgba(74, 222, 128, .12);
    --warning: #fbbf24; --warning-soft: rgba(251, 191, 36, .1); --warning-border: rgba(251, 191, 36, .35);
    --shadow: none; --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #020617; --foreground: #f8fafc; --card: #0f172a; --brand: #ffffff; --wordmark: #ffffff;
  --primary: #4f46e5; --primary-hover: #6366f1; --primary-soft: rgba(99, 102, 241, .16); --primary-soft-fg: #a5b4fc;
  --muted: #1e293b; --muted-foreground: #94a3b8; --border: rgba(255, 255, 255, .1); --border-soft: rgba(255, 255, 255, .08);
  --input: rgba(255, 255, 255, .15); --input-bg: rgba(255, 255, 255, .04); --ring: rgba(99, 102, 241, .45);
  --destructive: #f87171; --destructive-soft: rgba(248, 113, 113, .12); --success: #4ade80; --success-soft: rgba(74, 222, 128, .12);
  --warning: #fbbf24; --warning-soft: rgba(251, 191, 36, .1); --warning-border: rgba(251, 191, 36, .35);
  --shadow: none; --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { font-weight: 600; color: var(--brand); letter-spacing: -0.01em; margin: 0; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* ---- アイコン ---- */
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }

/* ---- 画面の骨組み（ヘッダー・本文・フッター） ---- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; }
.topbar .right { display: flex; align-items: center; gap: 4px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 32px; width: auto; display: block; }
.brand .product { margin-left: .14em; font-size: 21px; font-weight: 500; line-height: 1; letter-spacing: -0.025em; color: var(--wordmark); }
.brand.lg img { height: 48px; }
.brand.lg .product { font-size: 31px; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
.main { flex: 1; width: 100%; padding: 8px 24px 40px; }
.main.centered { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.site-footer { border-top: 1px solid var(--border-soft); padding: 20px 24px; font-size: 12px; color: var(--muted-foreground);
               display: flex; flex-direction: column; gap: 10px; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
@media (min-width: 1024px) {
  .topbar { padding: 16px 40px; }
  .main { padding: 8px 40px 48px; }
  .site-footer { flex-direction: row; align-items: center; justify-content: space-between; padding: 20px 40px; }
}

/* ---- カード ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.card.elevated { box-shadow: var(--shadow-xl); }

/* ---- ボタン ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px;
       border-radius: 10px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 500; line-height: 1;
       cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s;
       -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--card); border-color: var(--input); color: var(--foreground); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-danger { background: transparent; color: var(--destructive); }
.btn-danger:hover { background: var(--destructive-soft); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 16px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; border-radius: 8px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn:focus-visible, .input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* ---- 入力欄 ---- */
.label { display: block; font-size: 14px; font-weight: 500; margin: 0 0 6px; color: var(--foreground); }
.label .optional { color: var(--muted-foreground); font-weight: 400; font-size: 12px; margin-left: 4px; }
.input { display: block; width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--input); border-radius: 10px;
         background: var(--input-bg); color: var(--foreground); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--muted-foreground); opacity: 1; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
textarea.input { height: auto; min-height: 84px; padding: 8px 12px; line-height: 1.6; resize: vertical; }
select.input { padding-right: 8px; cursor: pointer; }
.input-lg { height: 44px; }
.hint { font-size: 12px; color: var(--muted-foreground); margin-top: 6px; }
.field-pw { position: relative; }
.field-pw .input { padding-right: 44px; }
.field-pw .reveal { position: absolute; inset: 0 0 0 auto; width: 44px; display: flex; align-items: center; justify-content: center;
                    border: 0; background: none; color: var(--muted-foreground); cursor: pointer; }
.field-pw .reveal:hover { color: var(--foreground); }

/* ---- 小物 ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px;
         font-size: 11px; font-weight: 500; line-height: 1; background: var(--muted); color: var(--muted-foreground); white-space: nowrap; }
.badge .icon { width: 12px; height: 12px; }
.badge-primary { background: var(--primary-soft); color: var(--primary-soft-fg); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.6; }
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--destructive-soft); color: var(--destructive); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--primary-soft); color: var(--primary-soft-fg); }
.muted { color: var(--muted-foreground); }
.nb { display: inline-block; }  /* 言葉の途中で改行しないまとまり（日本語の見出し・案内文用） */
.divider { height: 1px; background: var(--border-soft); border: 0; margin: 0; }
.icon-circle { width: 48px; height: 48px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
               background: var(--primary-soft); color: var(--primary-soft-fg); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(8px); z-index: 50;
         display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; font-size: 13px;
         background: var(--foreground); color: var(--background); box-shadow: var(--shadow-xl);
         opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
