/* ============================================================
   style.css — 日経225 決算ナビ
   water.css をベースに上書き
   ============================================================ */

:root {
    --c-primary: #1a5276;
    --c-accent: #2e86c1;
    --c-success: #1e8449;
    --c-danger: #c0392b;
    --c-warning: #d4ac0d;
    --c-bg-card: #ffffff;
    --c-bg-page: #f8f9fa;
    --c-border: #dee2e6;
    --c-text: #2c3e50;
    --c-text-muted: #7f8c8d;
}

body {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    background: var(--c-bg-page);
    color: var(--c-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

/* --- ナビゲーション --- */
nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 2rem;
}
.site-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--c-primary);
    text-decoration: none;
}
.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}
.nav-links a { color: var(--c-text); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: var(--c-accent); }

/* --- サブタイトル --- */
.subtitle { color: var(--c-text-muted); margin-top: -0.5rem; }

/* --- フィルタバー --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
    align-items: center;
}
.filter-bar .btn {
    padding: 0.4rem 1rem;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    background: var(--c-bg-card);
    color: var(--c-text);
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
}
.filter-bar .btn.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}
.filter-sep { color: var(--c-border); }
.filter-note { font-size: 0.85rem; color: var(--c-accent); margin-top: -0.5rem; }

/* --- 決算カード --- */
.earnings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.earnings-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 1rem;
    transition: box-shadow 0.2s;
}
.earnings-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.card-positive { border-left: 4px solid var(--c-success); }
.card-negative { border-left: 4px solid var(--c-danger); }

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.card-header a { text-decoration: none; color: var(--c-text); }
.card-header a:hover { color: var(--c-accent); }
.sec-code { color: var(--c-text-muted); font-size: 0.85rem; }
.badge {
    background: var(--c-accent);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}
.disclosure-date { margin-left: auto; font-size: 0.8rem; color: var(--c-text-muted); }

.card-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
}
.card-metrics .metric { text-align: center; }
.card-metrics .label { display: block; font-size: 0.75rem; color: var(--c-text-muted); }
.card-metrics .value { font-size: 1rem; font-weight: 600; }

.card-forecast {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--c-border);
    font-size: 0.85rem;
    color: var(--c-text-muted);
}
.card-footer {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8rem;
}
.industry { color: var(--c-text-muted); }
.pdf-link { color: var(--c-accent); }

/* --- 主要指標グリッド --- */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}
.metric-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
}
.metric-card .label { display: block; font-size: 0.8rem; color: var(--c-text-muted); margin-bottom: 0.25rem; }
.metric-card .value { font-size: 1.3rem; font-weight: 600; color: var(--c-primary); }

/* --- テーブル --- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { background: var(--c-primary); color: #fff; padding: 0.6rem; text-align: left; white-space: nowrap; }
td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--c-border); }
tbody tr:hover { background: rgba(46, 134, 193, 0.05); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.small { font-size: 0.8rem; }
.highlight { font-weight: 600; color: var(--c-primary); }

/* --- 健全性ランク --- */
.rating { font-size: 0.8rem; font-weight: 600; padding: 0.1rem 0.4rem; border-radius: 3px; }
.rating-aplus, .rating-a { background: #d5f5e3; color: #1e8449; }
.rating-bplus, .rating-b { background: #fef9e7; color: #b7950b; }
.rating-cplus, .rating-c { background: #fde8d0; color: #d35400; }
.rating-d { background: #fadbd8; color: #c0392b; }

/* --- テキスト装飾 --- */
.text-success { color: var(--c-success); }
.text-danger { color: var(--c-danger); }
.text-muted { color: var(--c-text-muted); }

/* --- チャート --- */
.chart-section { margin: 2rem 0; }
.chart-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.chart-tabs .tab {
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    background: var(--c-bg-card);
    cursor: pointer;
    font-size: 0.85rem;
}
.chart-tabs .tab.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* --- コンテンツ注釈 --- */
.content-note {
    background: #eaf2f8;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}
.content-note h2 { font-size: 1rem; color: var(--c-primary); margin-top: 0; }
.content-note p { font-size: 0.9rem; line-height: 1.7; }

/* --- 企業詳細ヘッダー --- */
.company-header { margin-bottom: 1.5rem; }
.company-tags { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.data-updated { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--c-text-muted); }
.tag {
    background: #eaf2f8;
    color: var(--c-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* --- フッター --- */
footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--c-border);
    font-size: 0.8rem;
    color: var(--c-text-muted);
    text-align: center;
}

/* --- フッターナビ --- */
.footer-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.footer-nav a { color: var(--c-text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--c-accent); text-decoration: underline; }

/* --- Aboutページ --- */
.about-page { max-width: 800px; margin: 0 auto; }
.about-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.about-content th, .about-content td { padding: 0.5rem 0.75rem; border: 1px solid var(--c-border); text-align: left; }
.about-content th { background: #eaf2f8; color: var(--c-primary); }
.about-content hr { border: none; border-top: 1px solid var(--c-border); margin: 2rem 0; }

/* --- レスポンシブ --- */
@media (max-width: 600px) {
    nav { flex-direction: column; gap: 0.5rem; }
    .nav-links { gap: 1rem; }
    .earnings-grid { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr !important; }
}

/* --- スクリーナー フォーム --- */
.screener-form {
    margin: 1rem 0 1.5rem;
    padding: 1.5rem;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-bottom: 0.3rem;
}
.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    font-size: 0.9rem;
    box-sizing: border-box;
}
.form-group input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 2px rgba(46, 134, 193, 0.2);
}
.screener-form button {
    padding: 0.6rem 2rem;
    background: var(--c-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}
.screener-form button:hover { background: var(--c-accent); }

.result-count {
    font-size: 0.95rem;
    color: var(--c-text-muted);
    margin: 1rem 0 0.5rem;
}

/* --- ヒーロー（トップページ） --- */
.hero {
    text-align: center;
    padding: 2rem 0 1rem;
}
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; color: var(--c-primary); }
.hero p { color: var(--c-text-muted); font-size: 1.1rem; }

/* --- details/summary --- */
details {
    margin: 1rem 0;
}
details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--c-accent);
    font-size: 0.95rem;
}
details[open] summary { margin-bottom: 0.5rem; }

/* --- コンテンツガイド --- */
.content-guide .metric-card {
    transition: border-color 0.2s;
}
.content-guide .metric-card:hover {
    border-color: var(--c-accent);
}

/* --- 検索フォーム --- */
.search-form input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 2px rgba(46, 134, 193, 0.2);
}
.search-form button {
    background: var(--c-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.search-form button:hover { background: var(--c-accent); }
