/* --- 基本設定 (Base Styles) --- */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
    margin: 0;
}

/* --- 共通レイアウト (Common Layouts) --- */
.container {
    background-color: #ffffff;
    width: 100%;
    max-width: 960px;
    margin: 20px auto;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* --- ログイン・登録ページ専用レイアウト --- */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-wrapper .container {
    max-width: 420px;
    text-align: center;
    margin: 0;
}
.auth-wrapper .header-image {
    max-width: 150px; /* ログインページのロゴサイズ */
    margin-bottom: 20px;
}

/* --- タイポグラフィ (Typography) --- */
h1, h2, h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #111;
}
h1 { font-size: 2em; }
h2 { font-size: 1.5em; border-bottom: 2px solid #eee; padding-bottom: 10px; }
h3 { font-size: 1.2em; border-left: 4px solid #ccc; padding-left: 10px; }
p { margin-top: 0; margin-bottom: 1em; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- フォーム要素 (Form Elements) --- */
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}
.form-group-short {
    max-width: 450px;
}
.form-label-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}
.form-label-note {
    font-size: 0.9em;
    color: #6c757d;
}
.password-container {
    position: relative;
}
.toggle-password {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
}
.toggle-password label {
    cursor: pointer;
}

/* --- ボタン (Buttons) --- */
.btn {
    display: inline-block;
    color: white !important;
    padding: 14px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    transition: all 0.4s ease;
}
.btn-primary {
    width: 100%; /* フォーム内のボタンは基本的に全幅 */
    background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%);
    background-size: 200% auto;
}
.btn-primary:hover {
    background-position: right center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

/* --- メッセージ (Messages) --- */
.error-message, .success-message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: left;
}
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* --- データ表示 (Tables) --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* --- ダッシュボード専用スタイル --- */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 240px;
    background-color: #fff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    position: fixed;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #eee;
}
.sidebar-header img {
    max-width: 100px; /* サイドバー内のロゴサイズ */
}
.sidebar-nav {
    overflow-y: auto;
}
.sidebar-nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
.sidebar-nav a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    border-left: 4px solid transparent;
    transition: background-color 0.3s;
}
.sidebar-nav a:hover {
    background-color: #f8f9fa;
}
.sidebar-nav a.active {
    background-color: #e9ecef;
    border-left-color: #007bff;
    color: #007bff;
}
.sidebar-nav hr {
    margin: 10px 20px;
    border: none;
    border-top: 1px solid #eee;
}
.main-content {
    flex-grow: 1;
    padding: 30px;
    margin-left: 240px;
}
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.action-buttons {
    display: flex;
    gap: 8px;
}
.action-buttons a {
    display: inline-block; /* ボタンとしての挙動を明確化 */
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 14px;
    color: white !important; /* 文字色を白に固定 */
    text-decoration: none;   /* 下線を消す */
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease; /* ホバー時のアニメーション */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* わずかに影を付ける */
}
.action-buttons a:hover {
    transform: translateY(-2px); /* 少し上に動かす */
    box-shadow: 0 4px 8px rgba(0,0,0,0.15); /* 影を濃くする */
    text-decoration: none;
}
.btn-edit { background-color: #17a2b8; }
.btn-delete { background-color: #6c757d; } /* 通常時は落ち着いたグレー */
.btn-delete:hover { background-color: #dc3545; } /* マウスを乗せると赤に */
.pagination {
    margin-top: 20px;
    display: flex; /* Flexboxを有効化 */
    flex-wrap: wrap; /* リンクが画面幅を超えたら折り返す */
    gap: 8px; /* リンク間の隙間 */
}
.pagination a {
    color: #007bff;
    padding: 8px 16px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: background-color 0.3s;
}
.pagination a.active {
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
}
.pagination a:hover:not(.active) {
    background-color: #f2f2f2;
}
.search-form {
    display: flex;
    gap: 10px;
    align-items: baseline;
}
.search-form input[type="text"] {
    font-size: 16px;
    padding-top: 10px;
    padding-bottom: 10px;
    max-width: 300px;
}
.search-form button {
    font-size: 16px;
    width: auto;
    white-space: nowrap;
    padding: 10px 20px;
}
.profile-form-container {
    max-width: 500px;
    margin: 0 auto;
}

/* --- ログイン・登録フォームのデザイン調整（完成版） --- */

/* フォーム内の各入力欄グループ */
.auth-wrapper form div {
    margin-bottom: 20px;
    text-align: left; /* ラベルや入力欄を左揃えにする */
}

/* ユーザー名、メールアドレス、パスワード入力欄のスタイル */
.auth-wrapper input[type="text"],
.auth-wrapper input[type="email"],
.auth-wrapper input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    /* 既存の .form-control とスタイルが重複するため、基本的なものに絞る */
}

/* パスワード表示チェックボックスの位置調整 */
.auth-wrapper .password-container {
    position: relative;
}

.auth-wrapper .toggle-password {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 5px; /* チェックボックスと「表示」の文字の隙間 */
}

/* ログイン・登録・購読ページのロゴサイズ */
.auth-wrapper .header-image {
    max-width: 150px;
}

/* --- その他 (Misc) --- */
.links {
    margin-top: 25px;
    font-size: 14px;
}



/* --- レスポンシブ対応 (スマートフォン表示用) --- */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    /* ログイン・登録ページ */
    .auth-wrapper {
        min-height: 100vh;
        padding: 0;
    }
    .auth-wrapper .container {
        box-shadow: none;
        border-radius: 0;
        padding: 20px;
    }
    
    /* ダッシュボード */
    .dashboard-wrapper {
        flex-direction: column; /* サイドバーとメインコンテンツを縦並びにする */
    }
    .sidebar {
        position: static; /* 固定を解除 */
        width: 100%;
        height: auto;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    .main-content {
        margin-left: 0; /* サイドバーの幅をリセット */
        padding: 20px;
    }

    /* フォームの横幅を調整 */
    .form-group-short {
        max-width: 100%;
    }
}