/* ==========================================================================
    共通デザイン
   ========================================================================== */
body { 
    background-color: #f8f5ee; 
    color: #332820; 
    font-family: sans-serif; 
    line-height: 1.6; 
    margin: 0; 
    padding: 40px 20px; 
}

.admin-container { 
    max-width: 900px;
    margin: 0 auto; 
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e5ddd2; 
    box-shadow: 0 4px 12px rgba(60, 40, 20, 0.03); 
}
h1 { 
    font-size: 24px; 
    color: #3b2a20; 
    border-bottom: 2px solid #70421f; 
    padding-bottom: 10px; 
    margin-top: 0; 
}

img, 
iframe, 
ins {
    max-width: 100% !important;
    height: auto !important;
}



/* ==========================================================================
   管理者ログイン画面（admin/login.php）専用のデザイン
   ========================================================================== */
body.admin-login-body {
    background-color: #f8f5ee;
    color: #332820;
    font-family: sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #ffffff;
    padding: 40px 30px;
    border-radius: 14px;
    border: 1px solid #e5ddd2;
    box-shadow: 0 4px 12px rgba(60, 40, 20, 0.03);
}

.login-box h1 {
    font-size: 20px;
    color: #3b2a20;
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
    letter-spacing: 0.05em;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 6px;
    color: #75685d;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5ddd2;
    border-radius: 8px;
    background-color: #fcfaf6;
    box-sizing: border-box;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.login-box input:focus {
    border-color: #70421f;
    background-color: #ffffff;
}

.login-btn {
    background-color: #70421f;
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background-color: #3b2a20;
}

.login-box .message-error {
    background-color: #fce8e6;
    color: #c5221f;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
    text-align: center;
}

.back-site {
    display: block;
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #75685d;
    text-decoration: none;
}

.back-site:hover {
    text-decoration: underline;
}







/* ==========================================================================
   管理者画面（admin 共通・dashboard）のベースデザイン
   ========================================================================== */
.admin-container {
    max-width: 700px;
    margin: 0 auto;
}

/* 総合管理パネルのときは横幅をゆったり広げる */
.admin-container.dashboard-layout {
    max-width: 1000px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #70421f;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

/* ヘッダー周りのナビゲーション */
.admin-header-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.link-to-public {
    color: #70421f;
    text-decoration: none;
    font-size: 14px;
    margin-right: 15px;
}

.link-to-public:hover {
    text-decoration: underline;
}

/* 各管理セクション（レシピ・コラム共通）のカード */
.management-section {
    margin-bottom: 40px;
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e5ddd2;
}

.section-title-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #70421f;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.section-title-flex h2 {
    font-size: 18px;
    margin: 0;
    color: #3b2a20;
}

/* ==========================================================================
   テーブル・一覧エリアのデザイン
   ========================================================================== */
.recipe-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.recipe-table th, 
.recipe-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5ddd2;
}

.recipe-table th {
    background-color: #fcfaf6;
    color: #75685d;
    font-weight: bold;
}

.recipe-title-bold {
    font-weight: bold; 
    color: #3b2a20;
}

.article-date {
    font-size: 13px;
    color: #75685d;
}

/* サムネイル画像 */
.recipe-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5ddd2;
}

/* 画像がない場合のダミー枠 */
.recipe-thumb-empty {
    width: 60px; 
    height: 45px; 
    background: #eee; 
    border-radius: 4px; 
    display: inline-block;
}

.action-flex {
    display: flex;
    align-items: center;
}

/* ==========================================================================
   共通のボタン（.btn / .submit-btn）
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: background-color 0.2s ease;
}

/* 新規追加ボタン */
.btn-create {
    background-color: #70421f;
    color: #ffffff;
}
.btn-create:hover,
.btn-create.btn-article-color:hover {
    background-color: #3b2a20;
}

/* 読みもの用の追加ボタンの個別カラー */
.btn-create.btn-article-color {
    background-color: #8c6447;
}

/* 編集ボタン */
.btn-edit {
    background-color: #e5ddd2;
    color: #332820;
    margin-right: 5px;
}
.btn-edit:hover {
    background-color: #d8cebf;
}

.btn-delete {
    background-color: #fce8e6;
    color: #c5221f;
}
.btn-delete:hover {
    background-color: #f9d4d0;
}

/* ログアウト用のグレーボタン */
.btn-logout-custom {
    background-color: #9a8e82;
    color: #fff;
}
.btn-logout-custom:hover {
    background-color: #75685d;
}

/* ==========================================================================
   通知メッセージ・フッターリンク
   ========================================================================== */
.message-success,
.message-error {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.message-success {
    background-color: #e6f4ea;
    color: #137333;
}

.message-error {
    background-color: #fce8e6;
    color: #c5221f;
}

.nav-links,
.back-link-container {
    margin-top: 20px;
    display: flex;
    gap: 20px;
}

.nav-links a,
.back-link-container a {
    color: #70421f;
    text-decoration: none;
    font-size: 14px;
}

.nav-links a:hover,
.back-link-container a:hover {
    text-decoration: underline;
}












/* ==========================================================================
   管理者画面 削除と編集(admin/edit.phpとadmin/create.php）専用のデザイン
   ========================================================================== */

.form-group { margin-bottom: 20px; }
label {
    display: block
    ; font-weight: bold;
     margin-bottom: 6px;
      color: #3b2a20; 
    }

input[type="text"],
select,
textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #e5ddd2; 
    border-radius: 6px; 
    box-sizing: border-box; 
    font-size: 14px; 
}

textarea {
    height: 120px;
    resize: vertical; 
}

.submit-btn {
     background-color: #70421f; 
     color: #ffffff; 
     border: none; 
     padding: 12px 24px; 
     border-radius: 6px; 
     font-size: 15px; 
     cursor: pointer; 
     width: 100%; 
     transition: background-color 0.3s; 
    }

.submit-btn:hover { 
    background-color: #3b2a20; 
}

.message-success {
    background-color: #e6f4ea; 
    color: #137333; 
    padding: 12px; 
    border-radius: 6px; 
    margin-bottom: 20px; 
}

.message-error { 
    background-color: #fce8e6; 
    color: #c5221f; 
    padding: 12px; 
    border-radius: 6px; 
    margin-bottom: 20px; 
    list-style: none; 
    padding-left: 20px; 
}

.back-link { 
    display: inline-block; 
    margin-top: 20px; 
    color: #70421f; 
    text-decoration: none; 
    font-size: 14px; 
}

.back-link:hover {
    text-decoration: underline; 
}






/* ==========================================================================
   コラム追加画面（admin/article_create.php）専用のデザイン
   ========================================================================== */
.admin-container form .form-group textarea[name="content"] {
    height: 300px !important;
    font-family: monospace; /* 💡 HTMLタグが打ちやすいように等幅フォントにします */
    line-height: 1.6;
    background-color: #fcfaf6;
    border: 1px solid #e5ddd2;
    border-radius: 6px;
    padding: 12px;
    box-sizing: border-box;
    font-size: 14px;
    color: #332820;
    resize: vertical; /* 縦方向だけ自由に伸ばせるようにします */
}

/* プレースホルダー（薄いグレーの入力例）の改行を綺麗に見せるお守り */
.admin-container form textarea::placeholder {
    color: #bfae9e;
    opacity: 0.8;
}

/* ==========================================================================
   コラム追加画面（admin/article_create.php）専用の個別調整
   ========================================================================== */
.admin-container .form-group .column-content-editor {
    height: 350px !important; /* 💡 本文入力欄を350pxに大きく広げてタグを打ちやすくします */
    font-family: monospace !important; /* HTMLタグが判別しやすい等幅フォントに変更 */
    line-height: 1.7 !important;
}









/* ==========================================================================
   📱 管理画面トップ（admin/index.php）スマホ用のレスポンシブ調整（600px以下）
   ========================================================================== */
@media screen and (max-width: 600px) {
    /* 全体の白枠の余白をスマホ用にスリムにする */
    .admin-container.dashboard-layout {
        padding: 15px 10px !important;
    }

    /* 管理パネルのヘッダー（タイトルとボタン）を縦並びにして中央寄せ */
    .admin-header {
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
        text-align: center;
        padding-bottom: 20px !important;
    }

    .admin-header-nav {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100%;
    }

    .link-to-public {
        margin-right: 0 !important;
    }

    /* 各セクション（レシピ・コラム）のカードの余白を調整 */
    .management-section {
        padding: 15px !important;
        margin-bottom: 25px !important;
        border-radius: 8px !important;
    }

    /* セクションの見出しと「新規追加ボタン」を上下2段にする */
    .section-title-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        text-align: center;
    }

    .section-title-flex h2 {
        font-size: 16px !important;
    }

    .section-title-flex .btn-create {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* =========================================================================
       💡 ここが最大のポイント：テーブル（表）をスマホ用のカード型に解体します
       ========================================================================= */
    .recipe-table, 
    .recipe-table thead, 
    .recipe-table tbody, 
    .recipe-table th, 
    .recipe-table td, 
    .recipe-table tr {
        display: block !important; /* すべての表要素を強制的にブロック（縦並び）にします */
        width: 100% !important;
        box-sizing: border-box;
    }

    /* テーブルの見出し（項目名）はスマホでは邪魔なので非表示にします */
    .recipe-table thead {
        display: none !important;
    }

    /* データ1件ごとのまとまり（行）を、独立したカードに見えるように枠線で囲みます */
    .recipe-table tr {
        border: 1px solid #e5ddd2 !important;
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 15px;
        background-color: #fcfaf6;
    }
    .recipe-table tr:last-child {
        margin-bottom: 0;
    }

    /* 各セル（マス目）の余白や位置をリセット */
    .recipe-table td {
        padding: 6px 0 !important;
        border: none !important;
        text-align: center !important; /* 文字や画像を中央寄せにします */
    }

    /* サムネイル画像を一回り大きくして見やすく */
    .recipe-thumb,
    .recipe-thumb-empty {
        width: 80px !important;
        height: 60px !important;
        margin: 0 auto 5px !important;
    }

    /* タイトルの文字を少し強調 */
    .recipe-title-bold {
        font-size: 15px !important;
        display: block;
        margin-bottom: 4px;
    }

    /* 操作ボタン（編集・削除）をスマホの画面幅いっぱいに横並び（または縦）にする調整 */
    .action-flex {
        justify-content: center !important;
        gap: 10px !important;
        margin-top: 10px !important;
        border-top: 1px dashed #e5ddd2;
        padding-top: 12px !important;
    }

    /* 編集ボタンと削除ボタンのサイズを揃えて押しやすくする */
    .action-flex .btn-edit,
    .action-flex form {
        flex: 1 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .action-flex .btn {
        width: 100% !important;
        padding: 10px 0 !important; /* スマホで指でタップしやすいように高さを広げます */
        font-size: 13px !important;
    }
}