@import url('../tokens.css');

body {
    font-family: 'M PLUS 1p', 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
    color: #333;
}

h2, h3 { color: #3200FF; }
h2 {
    position: relative;
    padding-left: 15px;
    font-size: 20px;
    margin-top: 10px;
    margin-bottom: 7px;
}
h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 100%;
    background-color: #3200FF;
}
h3 { margin: 10px 0 6px; font-size: 15px; }

.filter-section { margin-bottom: 6px; }

.t_vocal  { color: #FF469D; font-weight: bold; }
.t_dance  { color: #3ABAFF; font-weight: bold; }
.t_visual { color: #FFA900; font-weight: bold; }

.banner {
    background-color: #3200FF;
    color: white;
    text-align: left;
    padding: 0 var(--space-page-x);
    height: 56px;
    display: flex;
    align-items: center;
    font-size: 18px;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}
.banner_title_phone { display: none; }

.back-button {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    color: #3200FF;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    border: 1px solid #3200FF;
    font-size: 14px;
    transition: background-color 0.3s, color 0.3s;
}
.back-button:hover { background-color: #3200FF; color: white; }

.search-bar-container {
    padding: 20px var(--space-page-x) 10px;
}
.mode-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.mode-label {
    font-size: 14px;
    white-space: nowrap;
    color: #555;
}
#mode-select {
    font-size: 14px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    min-width: 220px;
}
.search-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-bar {
    flex: 1;
    padding: 10px;
    font-size: 15px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
}
.search-mode {
    display: flex;
    gap: 10px;
    white-space: nowrap;
    font-size: 14px;
}
.search-mode input[type="radio"] { accent-color: #3200FF; }

.result-count {
    margin-top: 6px;
    font-size: 13px;
    color: #666;
}

.container {
    display: flex;
    align-items: flex-start;
    padding: 0 var(--space-page-x) 30px;
    gap: var(--gap-md);
}

.filters {
    width: 200px;
    flex-shrink: 0;
    padding: 10px 15px 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    font-size: 14px;
}
.filters select {
    width: 100%;
    font-size: 14px;
    padding: 4px;
}
.filters label { display: block; margin: 4px 0; }
.filters input[type="checkbox"] { accent-color: #3200FF; margin-right: 4px; }

.filters button.reset {
    background-color: gray;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    margin-top: 12px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    width: 100%;
}
.filters button.reset:hover { background-color: darkgray; }

.table-container {
    flex: 1;
    background-color: #fff;
    box-shadow: 0 4px 14px rgba(50, 0, 255, 0.08);
    padding: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    border-bottom: 1px solid #eee;
    padding: 8px 10px;
    font-size: 14px;
    vertical-align: top;
}
th {
    background: linear-gradient(180deg, #4a1fff, #3200FF);
    color: white;
    font-weight: bold;
    text-align: left;
    white-space: nowrap;
    border-bottom: none;
}
tr:nth-child(even) td { background-color: #f7f8fc; }
tr:hover td { background-color: #f0edff; }

.idol-cell {
    white-space: normal;
    width: 110px;
    text-align: center;
}
.idol_icon {
    display: block;
    width: 76px;
    aspect-ratio: 500 / 281;
    margin: 0 auto 4px;
}
a.idol_link {
    display: block;
    text-decoration: none;
    color: #3200FF;
    font-size: 12px;
    line-height: 1.3;
    word-break: keep-all;
    overflow-wrap: normal;
}
a.idol_link:hover { color: #0000FF; text-decoration: underline; }

tr.data-incomplete a.idol_link::after {
    content: ' ⚠';
    color: #cc7700;
    font-size: 11px;
    font-weight: bold;
}

.type-cell {
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}
.badge-sp { background-color: #ff6b9d; color: #fff; }
.badge-a  { background-color: #3ABAFF; color: #fff; }
.badge-p  { background-color: #7ac96a; color: #fff; }

.ct-range {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.ct-input {
    width: 56px;
    padding: 4px 6px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    text-align: center;
}

.card-group-first td {
    border-top: 2px solid #bbb;
}

.skill-name-cell {
    white-space: nowrap;
    font-weight: bold;
    font-size: 13px;
}
.skill-effect-cell {
    font-size: 13px;
    line-height: 1.5;
}

#scrollToTopBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #3200FF;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    display: none;
    border-radius: var(--radius-sm);
}
#scrollToTopBtn:hover { background-color: var(--color-primary-dark); }

@media screen and (max-width: 768px) {
    body { font-size: 13px; }
    .banner { padding: 0 15px; height: 44px; }
    .banner_title { display: none; }
    .banner_title_phone { display: block; }
    .back-button { display: none; }
    .search-bar-container { padding: 16px var(--space-page-x-mobile) 8px; }
    .mode-row { flex-wrap: wrap; }
    #mode-select { min-width: 0; width: 100%; }
    .search-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .search-mode { justify-content: flex-start; }
    .container { flex-direction: column; padding: 0 var(--space-page-x-mobile) 20px; gap: 10px; }
    .filters { width: 100%; box-sizing: border-box; }
    .table-container { width: 100%; box-sizing: border-box; padding: 10px; overflow-x: visible; }

    /* テーブルをカード形式に変更：1段目=アイドル、2段目=種別・スキル名、3段目=効果 */
    #skill-table thead { display: none; }
    #skill-table, #skill-table tbody { display: block; width: 100%; }
    #skill-table tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 10px;
        row-gap: 6px;
        padding: 12px 8px;
        border-bottom: 1px solid #eee;
    }
    #skill-table td {
        border-bottom: none;
        padding: 0;
        background-color: transparent !important;
    }
    #skill-table tr:nth-child(even) { background-color: #f7f8fc; }
    #skill-table tr:hover { background-color: #f0edff; }

    /* カード単位表示(グループ化)ではJSが同じカードの2件目以降の行の
       .idol-cellにdisplay:noneを付与する。1件目だけアイドル名を表示し、
       2件目以降は種別・スキル名から始まるようにする。 */
    .idol-cell {
        display: flex;
        flex: 1 1 100%;
        width: 100%;
        align-items: center;
        gap: 6px;
        text-align: left;
    }
    .idol_icon { width: 32px; margin: 0; }
    a.idol_link {
        display: block;
        flex: 1;
        min-width: 0;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    a.idol_link br { display: none; }

    .type-cell { white-space: nowrap; }

    .skill-name-cell {
        white-space: normal;
        font-size: 13px;
    }

    .skill-effect-cell {
        flex: 1 1 100%;
        width: 100%;
        padding-top: 6px;
        border-top: 1px dashed #eee;
    }

    #skill-table tr.card-group-first {
        border-top: 2px solid #bbb;
    }
    .card-group-first td {
        border-top: none;
    }
}
