/* public/css/style.css */

/* --- 1. 元からある基本スタイル --- */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: #000; /* 背景を黒に */
    color: #fff;            /* 文字色を白に */
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 2000 !important;
    box-sizing: border-box;
    height: 60px;
    border-bottom: 1px solid #333; /* 下部の境界線を暗い色に */
}

header h1 {
    margin: 0;
    font-size: 1.4rem;
}

header h1 a {
    color: #fff; /* ロゴの文字色を白に */
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

header a,
header a:link,
header a:visited {
    color: #fff !important; /* リンクの文字色を白に強制 */
    text-decoration: none !important;
    font-size: 0.95rem;
}

main {
    flex-grow: 1;
    padding: 20px;
    padding-top: 75px !important;
    padding-bottom: 30px !important;
    box-sizing: border-box;
}

footer {
    background-color: #333;
    color: white;
    padding: 1rem;
    text-align: center;
    bottom: 0;
    width: 100%;
}

footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-around;
}

footer li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem;
    display: block;
}

/* --- 2. 共通ページコンテナ --- */
.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.container h2 {
    margin-top: 0;
    flex-shrink: 0;
}

/* --- 3. 共通デッキリストグリッド --- */
.deck-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    align-content: start;
}

@media (min-width: 768px) {
    .deck-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- 4. デッキカード項目 --- */
.deck-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
.deck-item h3 { 
    margin: 0; 
    font-size: 1.1rem; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deck-thumbnail-wrapper {
    width: 100%;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #eee;
    background-color: #f9f9f9;
}
.deck-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 25%;
    cursor: pointer !important;
}
.deck-creator {
    font-size: 0.85rem;
    color: #555;
    font-weight: bold;
    margin-top: -4px;
}
.deck-meta-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #666;
}
.format-badge {
    font-size: 0.8rem;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
}
.deck-civ-badges {
    display: flex;
    gap: 4px;
    margin-top: -4px;
}
.civ-badge {
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff !important;
    padding: 2px 8px;
    border-radius: 4px;
    text-align: center;
    line-height: 1.2;
}
.civ-bg-light   { background-color: #e6b800; }
.civ-bg-water   { background-color: #1972e6; }
.civ-bg-dark    { background-color: #444444; }
.civ-bg-fire    { background-color: #e6193c; }
.civ-bg-nature  { background-color: #2ca043; }

/* --- 5. 共通ボタン & UI --- */
.create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 20px;
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    box-sizing: border-box;
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1;
    flex-shrink: 0;
    cursor: pointer;
    vertical-align: middle;
}
.btn-group { 
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr 42px; 
    gap: 6px; 
    margin-top: 10px; 
    align-items: stretch;
}
.btn-group-search {
    grid-template-columns: repeat(3, 1fr) !important;
}
.btn-view,
.btn-image,
.btn-edit,
.btn-report {
    width: 100% !important;
    min-width: 0 !important;
    height: 46px !important;
    padding: 4px 6px !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-view {
    background: #28a745;
    color: white;
}
.btn-image {
    background: #17a2b8;
    color: white;
}
.btn-image:hover {
    background: #138496;
}
.btn-edit {
    background: #ffc107;
    color: #212529;
}
/* 検索画面用通報ボタン */
.btn-report {
    background: #6c757d;
    color: white;
}
.btn-report:hover {
    background: #5a6268;
}

/* マイデッキ用 ✕ ボタン */
.btn-delete { 
    width: 42px !important;
    height: 46px !important;
    padding: 0 !important;
    background: #dc3545; 
    color: white; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: bold;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* トグルスイッチ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #d1d1d6;
    transition: .3s;
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background-color: #28a745;
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* 選択バッジ */
.selected-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
    margin-bottom: 10px;
    max-height: 85px;
    overflow-y: auto;
    padding: 5px;
    background: #fdfdfd;
    border: 1px dashed #ccc;
    border-radius: 4px;
}
.selected-badge {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 16px;
    padding: 2px 10px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
}
.selected-badge-remove {
    cursor: pointer;
    color: #ef4444;
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1;
    display: inline-block;
    margin-left: 2px;
}
.selected-badge-remove:hover {
    color: #b91c1c;
}

/* --- 6. 共通サブモーダル --- */
.sub-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
}
.sub-modal[style*="display: block"] {
    display: flex !important;
}
.sub-modal-content {
    background: white;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0;
}
.sub-modal-header {
    padding: 16px 20px;
    background: #333;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sub-modal-header span {
    font-weight: bold;
    font-size: 0.95rem;
}
.sub-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
}
