/* ======== 1. 基本設定 (フォント, カラー) ======== */

/* Google Fonts を読み込む */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&family=Noto+Serif+JP:wght@700&display=swap');

/* サイトのメインカラーを定義 */
:root {
    /* 指定された深緑色 */
    --kusano-theme: #064410; 
    /* ホバー用: 元が暗い色なので、少し明るくして反応をわかりやすくする */
    --kusano-theme-hover: #0b5e1a; 
    /* アクセント用の明るい緑（チケットのラベルなど既存の緑） */
    --kusano-accent-green: #28a745;
}

/* ======== 2. サイト全体・共通レイアウト ======== */

body {
    font-family: 'Noto Sans JP', sans-serif; /* 本文はゴシック体 */
    font-size: 17px;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: #333; /* 文字色を明示 */
}

main {
    flex-grow: 1; /* フッターを一番下に固定するため */
}

footer {
    background-color: #222; /* フッターは少し濃いグレーで引き締め */
    color: white;
    text-align: center;
    padding: 20px;
}

footer p {
    margin: 5px 0;
}

/* 見出しは明朝体に統一 */
h1, h2, h3 {
    font-family: 'Noto Serif JP', serif;
    text-align: center; /* 基本は中央揃え */
    color: #222;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

/* ======== 3. 共通コンポーネント (ボタン, フォーム等) ======== */

/* 基本ボタン */
button {
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    color: white;
    background-color: var(--kusano-theme);
    transition: all 0.2s ease-in-out;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

button:not(:disabled):hover {
    background-color: var(--kusano-theme-hover);
    transform: scale(1.03);
}

.hidden {
    display: none;
}

/* --- フォーム共通 --- */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    text-align: left; /* ラベルは左揃え */
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px; /* 少し広めに */
    box-sizing: border-box; 
    border: 1px solid #ccc;
    border-radius: 4px;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--kusano-theme);
    outline: none;
}

.radio-group label {
    display: inline-block;
    margin-right: 15px;
    font-weight: normal;
}

.isbn-group {
    display: flex;
    gap: 10px;
}

.isbn-group input {
    flex-grow: 1;
}

/* --- ボタン配置 --- */
.btn-container {
    text-align: right;
    margin-top: 20px;
    overflow: hidden; 
}

.back-btn {
    background-color: #6c757d; 
    float: left; 
}
.back-btn:hover {
    background-color: #5a6268;
    transform: scale(1.03);
}

.add-btn {
    background-color: var(--kusano-accent-green);
}
.add-btn:hover {
    background-color: #218838; 
    transform: scale(1.03);
}

/* --- フェードイン --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.fade-in {
    opacity: 0; 
    animation: fadeIn 0.5s ease-in forwards;
}

/* ======== 4. 共通ヘッダー / フッター (PC/スマホ両対応) ======== */

header {
    /* テーマカラーを適用 */
    background-color: var(--kusano-theme);
    /* 境界線は少し明るい緑にして立体感を出す */
    border-bottom: 1px solid #0f631d;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 10px 20px;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    margin: 0;
    font-size: 38px; /* 少しサイズ調整 */
    flex-shrink: 0; 
    font-family: 'Noto Serif JP', serif;
}

.header-logo a {
    text-decoration: none;
    color: white; /* ロゴは白文字 */
}
.header-logo a:hover {
    color: #e0e0e0;
}

/* --- PC用ナビゲーション --- */
.global-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; 
    align-items: center;
    gap: 20px;
}

.global-nav a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9); /* 白文字(少し透過) */
    font-weight: bold;
    font-size: 16px;
    transition: color 0.2s;
}

.global-nav a:hover {
    color: #fff;
    text-decoration: underline;
}

/* --- ハンバーガーボタン (スマホ用) --- */
.hamburger-btn {
    display: none; /* PCでは非表示 */
    width: 30px;
    height: 30px;
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001; 
}
.hamburger-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: white; /* 背景が濃い緑なので白にする */
    position: absolute;
    left: 0;
    transition: all 0.3s;
}
.hamburger-btn span:nth-child(1) { top: 6px; }
.hamburger-btn span:nth-child(2) { top: 14px; }
.hamburger-btn span:nth-child(3) { top: 22px; }

/* ハンバーガーボタン (active時 = バツ印) */
.hamburger-btn.active span:nth-child(1) {
    top: 14px;
    transform: rotate(45deg);
    background: #333; /* メニューが開いたときは背景が白になるので黒に戻す */
}
.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.active span:nth-child(3) {
    top: 14px;
    transform: rotate(-45deg);
    background: #333;
}

/* ======== 5. ページ別スタイル ======== */

/* --- index.html --- */
.home-main {
    padding: 0;
    text-align: center;
}

.store-image {
    display: block;
    margin: 20px auto;
    max-width: 600px;  
    width: 100%;       
    height: auto;      
    border-radius: 4px;
}

.section {
    padding: 40px 20px;
    border-bottom: 1px solid #eee;
}
.section:last-child {
    border-bottom: none;
}
.section h2 {
    margin-top: 0;
    border-bottom: 2px solid var(--kusano-theme); /* 見出しの下線もテーマカラーに */
    display: inline-block;
    padding-bottom: 5px;
    margin-bottom: 20px;
}

.action-button {
    display: inline-block;
    padding: 15px 30px;
    font-size: 19px;
    background-color: var(--kusano-theme);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    margin-top: 15px;
    transition: all 0.2s ease-in-out;
}
.action-button:hover {
    background-color: var(--kusano-theme-hover);
    transform: scale(1.03);
}

/* --- login.html --- */
.login-container {
    max-width: 400px;
    margin: 40px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- order.html --- */
.form-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.order-form, .selection, .common-info {
    margin-bottom: 20px;
}

.selection button {
    display: block;
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 17px;
    background-color: white;
    color: var(--kusano-theme);
    border: 2px solid var(--kusano-theme);
}
.selection button:hover {
    background-color: var(--kusano-theme);
    color: white;
}

#finalOrderBtn {
    background-color: #dc3545; /* 確定ボタンは赤のまま(危険色)でOK、またはテーマカラーにするなら変更可 */
    font-size: 19px;
    width: 100%;
    padding: 15px;
}
#finalOrderBtn:hover {
    background-color: #c82333; 
    transform: scale(1.03);
}

.order-list {
    list-style-type: none;
    padding: 0;
}

.order-list li {
    background: #f4f4f4;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    border-left: 5px solid var(--kusano-theme); /* リストの左線もテーマカラー */
    display: flex;
    flex-wrap: wrap; 
    align-items: center;
    justify-content: space-between;
    line-height: 1.8;
}
.order-list .item-text {
    flex-basis: 100%; 
    margin-bottom: 5px;
}
.order-list .item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.order-list .item-controls label {
    font-size: 14px;
    margin: 0;
}
.order-list .item-controls input[type="number"] {
    width: 60px; 
    padding: 4px;
}
.order-list .item-controls button {
    padding: 4px 8px;
    font-size: 12px;
}
.list-update-btn {
    background-color: var(--kusano-accent-green); 
}
.list-delete-btn {
    background-color: #dc3545;
}

/* --- news.html --- */
.news-container {
    max-width: 800px; 
    margin: 20px auto;
    padding: 0 20px;
}
.news-item {
    border-bottom: 1px solid #eee;
    padding: 20px 0;
}
.news-item:first-of-type {
     border-top: 1px solid #eee; 
}
.news-item:last-of-type {
    border-bottom: none; 
}
.news-item time {
    font-weight: bold;
    color: #666;
    display: block; 
    margin-bottom: 5px;
}
.news-item h2 {
    text-align: left;
    font-family: 'Noto Serif JP', serif;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
    color: #333;
}
.news-item p {
    line-height: 1.7;
}

/* --- stores.html --- */
.store-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 20px;
}
.store-item {
    margin-bottom: 40px;
    border-bottom: 1px solid #eee;
    padding-bottom: 40px;
}
.store-item:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}
.store-item h2 {
    text-align: left;
    font-size: 24px;
    border-bottom: 2px solid var(--kusano-theme); /* 下線をテーマカラーに */
    padding-bottom: 5px;
    margin-bottom: 15px;
}
.store-info {
    line-height: 1.8;
    font-size: 16px;
    margin-bottom: 20px;
}
.store-item .map-container { 
    max-width: 100%;
    margin: 0 auto;
}

/* ======== history.html ======== */

/* 年号の見出し */
.history-content h2 {
    text-align: left;
    border-bottom: 2px solid var(--kusano-theme); /* 下線をテーマカラーに */
    padding-bottom: 5px;
    padding-left: 15px;
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
}

.history-list dt {
    width: 100%;
    padding: 15px 10px 5px 10px;
    font-weight: bold;
    color: var(--kusano-theme); /* 年号をテーマカラーに */
    box-sizing: border-box;
    border-bottom: none;
}

.history-list dd {
    width: 100%;
    margin: 0;
    padding: 5px 10px 15px 10px;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;
    line-height: 1.8;
}

@media (min-width: 769px) {
    .history-list dt {
        width: 30%;
        padding: 20px;
        border-bottom: 1px solid #eee;
    }
    .history-list dd {
        width: 70%;
        padding: 20px;
        border-bottom: 1px solid #eee;
    }
}

/* --- school_menu.html --- */
.menu-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
}
.menu-btn {
    display: block;
    width: 100%;
    padding: 20px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: var(--kusano-theme);
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.menu-btn:hover {
    transform: translateY(-3px);
    background-color: var(--kusano-theme-hover);
}
.menu-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
    text-align: left;
}

/* ======== 学校メニューボタンの色分け ======== */

/* 1. 補助教材（デフォルトの深緑）は既存の .menu-btn で設定済み */
/* background-color: var(--kusano-theme); (#064410) */


/* 2. 学校図書（えんじ色） */
.menu-btn.btn-enji {
    background-color: #800000; /* 深い赤（えんじ色） */
}
.menu-btn.btn-enji:hover {
    background-color: #a31818; /* ホバー時：少し明るい赤 */
    transform: translateY(-3px);
}


/* 3. 郵送依頼（紺色） */
.menu-btn.btn-navy {
    background-color: #142d4c; /* 深い紺色 */
}
.menu-btn.btn-navy:hover {
    background-color: #274970; /* ホバー時：少し明るい紺色 */
    transform: translateY(-3px);
}

/* --- マップ共通スタイル --- */
.map-container {
    max-width: 800px;
    margin: 20px auto; 
}
.map-container iframe {
    width: 100%; 
    height: 350px;
    border: 0;
}

#whats-new-list {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.new-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.new-item {
    border-bottom: 1px solid #eee;
    padding: 15px 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap; 
}

.new-item-date {
    font-weight: bold;
    color: #333;
    margin-right: 15px;
}

.new-item-label {
    font-size: 14px;
    font-weight: bold;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: 15px;
}
/* お知らせはテーマカラー、または少し明るい緑 */
.new-item-label.news {
    background-color: var(--kusano-theme); 
}

.new-item-title {
    color: #333;
    text-decoration: none;
    font-weight: bold;
    flex: 1; 
}
.new-item-title:hover {
    color: var(--kusano-theme);
    text-decoration: underline;
}

/* ======== 6. メディアクエリ (スマホの分岐点) ======== */
@media (max-width: 768px) {

    .hamburger-btn {
        display: block;
    }

    .global-nav {
        position: fixed;
        top: 0;
        right: -100%; 
        width: 250px; 
        height: 100vh; 
        background: rgba(255, 255, 255, 0.98);
        box-shadow: -5px 0 10px rgba(0,0,0,0.1);
        padding-top: 80px;
        transition: right 0.4s ease;
        z-index: 1000;
    }

    .global-nav.active {
        right: 0;
    }

    .global-nav ul {
        flex-direction: column; 
        align-items: flex-start; 
        gap: 0; 
    }

    .global-nav li {
        width: 100%; 
    }

    .global-nav a {
        display: block;
        padding: 15px 20px; 
        font-size: 17px;
        width: 100%;
        box-sizing: border-box; 
        color: #333; /* スマホメニュー内は黒文字 */
    }
}

/* ======== 検索結果リストのスタイル ======== */
.search-results-container {
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    gap: 10px;
}
.result-item:last-child {
    border-bottom: none;
}
.result-item:hover {
    background-color: #f9f9f9;
}

.result-thumb {
    width: 60px;
    height: auto;
    flex-shrink: 0;
    border: 1px solid #ccc;
}

.result-info {
    flex-grow: 1;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
}

.result-title {
    font-weight: bold;
    color: #333;
    display: block;
    margin-bottom: 2px;
}
.result-meta {
    font-size: 12px;
    color: #666;
}

.select-book-btn {
    padding: 6px 12px;
    font-size: 12px;
    background-color: var(--kusano-theme); /* 選択ボタンもテーマカラーに */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap; 
}
.select-book-btn:hover {
    background-color: var(--kusano-theme-hover);
}