/* (既存のスタイルは省略) */
/* General */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background-color: #f8f9fa; margin: 0; color: #333; }
.container { padding: 20px; max-width: 1200px; margin: 0 auto; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }


/* Footer */
footer { text-align: center; padding: 20px; color: #888; font-size: 14px; }

/* Forms */
form { margin-bottom: 20px; }
form input[type="text"], form input[type="password"], form textarea { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
form textarea { height: 120px; resize: vertical; }
form button { background-color: #007bff; color: #fff; border: none; padding: 12px 25px; cursor: pointer; border-radius: 4px; font-size: 16px; }
form button:hover { background-color: #0056b3; }
.auth-container { max-width: 400px; margin-top: 50px; background: #fff; padding: 30px; box-shadow: 0 0 15px rgba(0,0,0,0.1); border-radius: 8px; }
.error { color: red; margin-bottom: 15px; }

/* Post Grid (index.php) */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.post-card a { display: block; }
.post-card { background: #fff; border: 1px solid #ddd; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: all .3s ease; border-radius: 8px; overflow: hidden; }
.post-card:hover { transform: translateY(-5px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.post-card img { width: 100%; height: 250px; object-fit: cover; }
.post-card .post-info { padding: 15px; }
.post-card h3 { margin: 0 0 5px 0; }
.post-card p { margin: 0; color: #666; font-size: 14px; }

/* Post Detail (post_detail.php) */
.post-full { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 0 15px rgba(0,0,0,0.1); }
.post-full .post-main-image { max-width: 100%; border-radius: 8px; margin-bottom: 20px; }
.comments-section { margin-top: 30px; }
.comments-section ul { list-style: none; padding: 0; }
.comments-section li { background: #f9f9f9; border: 1px solid #eee; padding: 15px; margin-bottom: 10px; border-radius: 5px; }

/* Closet & AI Page */
.closet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
.closet-item img { width: 100%; height: auto; border-radius: 5px; }
.suggestion-box { margin-top: 20px; background: #eef7ff; padding: 20px; border-left: 5px solid #007bff; }

/* 【追加】Item Selection Grid (post.php) */
.item-selection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 20px; }
.selectable-item { position: relative; display: block; cursor: pointer; }
.selectable-item img { width: 100%; height: auto; border-radius: 5px; border: 3px solid transparent; transition: border-color .2s ease; }
/* ラジオボタンを非表示に */
.selectable-item input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
/* 選択されたアイテムのスタイル */
.selectable-item input[type="radio"]:checked + img { border-color: #007bff; box-shadow: 0 0 10px rgba(0, 123, 255, 0.5); }
/* --- MyPage --- */
.my-posts-list { display: flex; flex-direction: column; gap: 15px; }
.my-post-item { display: flex; gap: 15px; background: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.my-post-item img { width: 100px; height: 100px; object-fit: cover; border-radius: 5px; }
.my-post-info { flex: 1; }
.my-post-info h4 { margin: 0 0 5px 0; }
.my-post-info p { margin: 0 0 10px 0; font-size: 14px; color: #555; }

/* --- Post Detail --- */
.post-actions { display: flex; gap: 10px; margin-top: 20px; }
.post-actions button { background: #f0f0f0; border: 1px solid #ccc; padding: 8px 15px; border-radius: 20px; cursor: pointer; transition: all .2s ease; }
.post-actions button.active { background: #007bff; color: white; border-color: #007bff; }

/* --- Delete Buttons --- */
.delete-button { background: #dc3545; color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; }
.delete-button-small { background: none; border: none; color: #dc3545; cursor: pointer; font-size: 12px; padding: 5px; }

/* --- Post Page Tabs --- */
.tab-switcher { display: flex; border-bottom: 2px solid #ccc; margin-bottom: 20px; }
.tab-button { padding: 10px 20px; color: #555; text-decoration: none; border: none; background: none; }
.tab-button.active { color: #007bff; border-bottom: 2px solid #007bff; font-weight: bold; }
/* --- Post Detail Closet Info --- */
.divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 25px 0;
}
.item-detail-container-small {
    display: flex;
    gap: 20px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
}
.item-image-view-small { flex: 0 0 150px; }
.item-image-view-small img { width: 100%; border-radius: 5px; }
.item-info-view-small { flex: 1; }
.item-info-view-small .info-group h4 { margin: 0 0 5px 0; font-size: 1em; }
.item-info-view-small .info-group p { margin: 0; font-size: 0.9em; }

/* ======== style.css に追記 ======== */

/* --- Header User Info --- */
.nav-user-info {
    color: #555;
    font-weight: 500;
    margin-left: 20px;
    padding: 8px 12px;
    background-color: #f1f3f5;
    border-radius: 20px;
}

/* --- MyPage --- */
.profile-card {
    background-color: #fff;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #eef2f8;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: #4a6fa5;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-info {
    flex-grow: 1;
}

.profile-username {
    margin: 0;
    font-size: 1.5rem;
}

.profile-handle {
    margin: 0;
    color: #777;
}

.btn-primary, .btn-secondary {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: 1px solid;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background-color: #4a6fa5;
    color: white;
    border-color: #4a6fa5;
}

.btn-secondary {
    background-color: #fff;
    color: #333;
    border-color: #ccc;
}


/* --- MyPage Tabs --- */
.tabs-container {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-top: 2rem;
    margin-bottom: 2rem;
    background: #fff;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.tab-link {
    flex: 1;
    text-align: center;
    padding: 1rem;
    color: #6c757d;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.tab-link:hover {
    background-color: #f8f9fa;
}

.tab-link.active {
    color: var(--purple-color, #6c5ce7);
    background-color: var(--purple-light, #f1effe);
}

/* --- Tab Content --- */
.tab-content {
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.empty-state { text-align: center; padding: 2rem; color: #777; }

/* closet.phpから移植した要素のデザイン調整 */
.tab-content .form-container {
    box-shadow: none;
    padding: 0;
    margin: 0;
}

/* ======== style.css に追記 ======== */

/* --- クローゼットタブ内のデザイン --- */

/* フォーム全体 */
.tab-content .form-container { 
    background-color: white; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    padding: 2rem; 
    max-width: 800px; 
    margin: 2rem auto; 
}
.tab-content .form-header { 
    display: flex; 
    align-items: center; 
    margin-bottom: 1.5rem; 
    padding-bottom: 1rem; 
    border-bottom: 1px solid #eee; 
    color: var(--purple-color, #6c5ce7); 
    font-size: 1.5rem; 
    font-weight: 600; 
    gap: 0.5rem; 
}
.tab-content .form-row { 
    margin-bottom: 1.5rem; 
}
.tab-content .label { 
    display: block; 
    margin-bottom: 0.5rem; 
    font-weight: 600; 
}
.tab-content .select, .tab-content textarea { 
    width: 100%; 
    padding: 0.8rem 1rem; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    font-size: 1rem; 
    transition: border-color 0.3s, box-shadow 0.3s; 
}
.tab-content .select:focus, .tab-content textarea:focus { 
    outline: none; 
    border-color: var(--purple-color, #6c5ce7); 
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.1); 
}

/* 画像プレビュー */
.image-preview { 
    width: 100%; 
    height: 280px; 
    border: 2px dashed #ddd; 
    border-radius: 12px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    transition: border-color 0.3s; 
    cursor: pointer; 
}
.image-preview:hover { 
    border-color: var(--purple-color, #6c5ce7); 
}
.image-preview img { 
    max-width: 100%; 
    max-height: 100%; 
    display: none; 
}
.image-placeholder { 
    text-align: center; 
    color: #777; 
}
.image-placeholder i { 
    font-size: 3rem; 
    margin-bottom: 1rem; 
}

/* チェックボックス */
.checkbox-group { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 15px; 
    margin-bottom: 10px; 
}
.checkbox-group label { 
    display: inline-flex; 
    align-items: center; 
    gap: 5px; 
    padding: 5px 10px; 
    background: #f0f0f0; 
    border-radius: 5px; 
    cursor: pointer; 
}

/* ボタン */
.btn-purple { 
    background-color: var(--purple-color, #6c5ce7); 
    color: white; 
    border: none; 
    width: 100%; 
    padding: 0.8rem 1.5rem; 
    border-radius: 6px; 
    font-size: 1rem; 
    cursor: pointer; 
    font-weight: 500; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.5rem; 
}
.btn-purple:hover { 
    background-color: #5549c0; 
}

/* 登録済みアイテム */
.closet-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
    gap: 1.5rem;
    margin-top: 1rem;
}
.closet-item a { 
    display: block; 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    transition: transform 0.3s, box-shadow 0.3s; 
}
.closet-item a:hover { 
    transform: scale(1.05); 
}
.closet-item img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    aspect-ratio: 1 / 1.2; 
    display: block; 
}

.message-box { 
    padding: 15px; 
    background-color: var(--purple-light, #f1effe); 
    border-left: 5px solid var(--purple-color, #6c5ce7); 
    margin: 0 0 20px 0; 
    border-radius: 5px; 
    font-weight: 500; 
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 3rem 0;
}
/* ======== style.css のヘッダー部分をこれに置き換え ======== */

/* --- 新しい3分割ヘッダーのデザイン --- */
.site-header {
    background: linear-gradient(135deg, #4a6fa5 0%, #1e3c72 100%);
    color: white;
    padding: 1.2rem 0; /* 少し高さを出す */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px; /* ← ここの値をさらに小さくしました */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Part 1: 左側 */
.header-left .logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    /* margin-right: auto; を削除するか、コメントアウト */
}

/* ======== style.css のヘッダー中央部分をこれに置き換え ======== */

/* Part 2: 中央 */
.header-center {
    display: flex;
    gap: 2.5rem;
}
.header-center .nav-item {
    color: #f0f0f0;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.5rem 1rem; /* パディングを最初からつけておく */
    position: relative;
    transition: all 0.3s ease;
    border-radius: 8px; /* 角を丸くしておく */
}
.header-center .nav-item:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1); /* ホバー時にうっすら背景色 */
}

/* ★★★ここが修正の最重要ポイント★★★ */
/* アクティブなタブ専用の、背景色と文字色がセットになったスタイル */
.header-center .nav-item.nav-item--active {
    background-color: #fff; /* 背景を白に */
    color: #1e3c72;      /* 文字色を濃い青に */
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ホバー時の下線アニメーションは不要になるので削除 */


/* Part 3: 右側 */
.header-right .user-welcome {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
}

/* 左右の幅をある程度確保するための空の要素 */
.header-right .placeholder {
    width: 1px; /* 幅はほぼなくても良い */
}

/* メインコンテンツの開始位置を調整 */
main.container {
    padding-top: 2rem;
}