﻿/* =========================================================
   連動プルダウン用CSS 
   ========================================================= */
.select-form-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    margin: 0 auto;
    width: fit-content;
}
.select-box-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}
.select-box-wrap label {
    font-weight: bold;
    color: #333;
    font-size: 0.95rem;
    width: 5.5em; /* 漢字の始まり位置を綺麗に揃える */
    text-align: left;
    flex-shrink: 0;
}
.custom-select {
    padding: 10px 12px;
    font-size: 1rem;
    border: 2px solid #333;
    border-radius: 4px;
    background-color: #fff;
    min-width: 220px;
    outline: none;
    cursor: pointer;
}
.custom-select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    border-color: #ccc;
}
#selected-result {
    padding: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    background-color: #f8f9fa;
    border-top: 1px solid #ddd;
    margin-top: 20px;
}

/* =========================================================
   Base Styles
   ========================================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}
a {
    color: #0066cc;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    min-height: 100vh;
}

/* =========================================================
   1. Header (ロゴ・メッセージ)
   ========================================================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
    flex-wrap: wrap;
    gap: 10px;
}
.logo-box {
    border: 2px solid #333;
    padding: 8px 15px;
    font-weight: bold;
    font-size: 1.4rem;
    letter-spacing: 1px;
    background: #fff;
}
.header-sub-msg {
    color: #666;
    font-size: 0.9rem;
    background: #f0f4f8;
    padding: 6px 12px;
    border-radius: 20px;
}

/* =========================================================
   2. Search Section
   ========================================================= */
.search-container {
    margin: 20px 0;
}
.search-form {
    display: flex;
    border: 2px solid #333;
    border-radius: 4px;
    overflow: hidden;
}
.search-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    font-size: 1rem;
    outline: none;
}
.search-select {
    border: none;
    border-left: 1px solid #ccc;
    padding: 0 10px;
    background: #f8f9fa;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
}
.search-btn {
    background: #333;
    color: #fff;
    border: none;
    padding: 0 20px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s;
}
.search-btn:hover {
    background: #555;
}

/* =========================================================
   3. Concept Section
   ========================================================= */
.concept-box {
    background: #fdfdfd;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #0066cc;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #444;
    border-radius: 0 4px 4px 0;
}

/* =========================================================
   4. Dynamic/Ad Space
   ========================================================= */
.ad-space {
    background: #f1f3f5;
    border: 1px dashed #adb5bd;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #6c757d;
    margin-bottom: 25px;
    font-size: 0.9rem;
    border-radius: 4px;
}

/* =========================================================
   5. Main Categories Grid
   ========================================================= */
.category-section {
    margin-bottom: 30px;
}
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 10px;
}
.category-card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 6px;
    background: #fff;
    text-align: center;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}
.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    border-color: #0066cc;
}

/* =========================================================
   6. Multi-language Section
   ========================================================= */
.multilingual-section {
    border-top: 2px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}
.multilingual-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.multilingual-desc {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.lang-item {
    display: block;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
    color: #495057;
}
.lang-item:hover {
    background: #e9ecef;
    color: #000;
}

/* =========================================================
   7. 年代別・元号選択エリア & テーブル基本スタイル
   ========================================================= */
.era-button-section {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.era-button-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}
.era-btn {
    display: block;
    text-align: center;
    padding: 10px 5px;
    background-color: #007bff;
    color: #ffffff;
    font-weight: bold;
    font-size: 1rem;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.era-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    text-decoration: none;
}

.era-table-container {
    margin-top: 30px;
}
.era-block {
    margin-bottom: 40px;
    scroll-margin-top: 20px;
}
.era-title {
    font-size: 1.3rem;
    font-weight: bold;
    padding: 8px 15px;
    background-color: #343a40;
    color: #ffffff;
    border-radius: 4px 4px 0 0;
    margin-bottom: 0;
}
.year-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
}
.year-table td {
    width: 20%;
    border: 1px solid #dee2e6;
    text-align: center;
    vertical-align: middle;
    padding: 0;
    height: 52px;
}
.year-table td a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #333333;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 0;
    transition: background-color 0.15s ease;
}
.year-table td a span.gengou {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: normal;
}
.year-table td a:hover {
    background-color: #e2e6ea;
    color: #007bff;
    font-weight: bold;
    text-decoration: none;
}
.year-table td a:hover span.gengou {
    color: #0056b3;
}

/* =========================================================
   Responsive Design & Mobile Settings
   ========================================================= */
@media (max-width: 768px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .era-button-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* スマホ表示（画面幅600px以下）：テーブルをフレックスボックス構造化して横4列にする */
@media (max-width: 600px) {
    .year-table tbody,
    .year-table tr {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }
    .year-table td {
        width: 25% !important;
        height: 48px;
        box-sizing: border-box;
    }
    .year-table td a {
        font-size: 0.85rem;
    }
    .year-table td a span.gengou {
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
    .era-button-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .search-form {
        flex-direction: column;
    }
    .search-select {
        border-left: none;
        border-top: 1px solid #ccc;
        padding: 10px;
    }
    .search-btn {
        padding: 12px;
    }
}