﻿body {
    margin: 3rem;
    max-width: 1200px;
    margin: 0 auto;

    background-image: var(--main-background-image);
    background-size: var(--main-background-size);
    background-repeat: repeat;
}

#banner-container {
    display: flex;
    align-items: center; /* 縦中央揃え */
    gap: 1rem;
}

/* #banner-containerの親要素のaタグにスタイル */
a:has(#banner-container) {
    text-decoration: none;
}

#banner-container img {
    height: 3rem;
    object-fit: contain;
    display: block;
}

#banner-text {
    margin: 0; /* デフォルトの上下marginを除去 */
    font-size: 1.2rem;
    color: var(--text-color);
}

/* タブのスタイル */
.tab-container {
    width: 100%;
    opacity: 0.8;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #444;

    /* スクロールしないようにする */
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--background-color);
    background-image: var(--menu-background-image);
    background-size: var(--menu-background-size);
    background-repeat: repeat;
}

.tab-button {
    padding: 10px 20px;
    background-color: var(--secondary-color);
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    border-top: 1px solid #333;
    border-left: 1px solid #333;
    border-right: 1px solid #333;

    position: relative;
    color: transparent; /* 実際は:afterの内容が表示される */
    text-align: center;

    opacity: 0.9;
}
.tab-button::after {
    color: var(--text-color);
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    white-space: nowrap;
}
/* PCとスマホで文言を変える */
#ranking-tab-label:after {
    content: "ランキング";
}
#keyword-tab-label:after {
    content: "キーワード検索";
}
#history-tab-label:after {
    content: "視聴履歴";
}
#favorites-tab-label:after {
    content: "お気に入り";
}
#keyword-amateur-only-label:after, #ranking-amateur-only-label:after {
    content: "素人作品";
}

@media (max-width: 768px) {
    #ranking-tab-label:after {
        content: "ランキング";
    }
    #keyword-tab-label:after {
        content: "キーワード";
    }
    #history-tab-label:after {
        content: "履歴";
    }
    #favorites-tab-label:after {
        content: "お気に入り";
    }
    #keyword-amateur-only-label:after, #ranking-amateur-only-label:after {
        content: "素人";
    }
 }


.tab-button:hover {
    background-color: var(--accent-color-hover);
}

.tab-button.active {
    background-color: var(--accent-color);
}

.tab-content {
    width: 100%;
    background-color: var(--background-color);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}



/* 共通アイテムリスト表示スタイル（新着・履歴両対応） */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px;
}

.item {
    display: flex;
    align-items: flex-start;
    border-radius: 6px;
    padding: 10px;
    background-color: var(--secondary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    position: relative;
    cursor: pointer;
}

.item img {
    width: 120px;
    height: auto;
    margin-right: 12px;
    border-radius: 4px;
    object-fit: cover;
    opacity: 1.0;
}

.item-details {
    flex-grow: 1;
}

.item-details h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--text-color);
    opacity: 1.0;
}

.item-details .meta {
    font-size: 14px;
    color: #cccccc;
    margin-bottom: 2.5rem;
    opacity: 1.0;
}

.item-link-container {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.item-link {
    padding: 6px 12px;
    background-color: var(--accent-color);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
    width: 10rem;
    opacity: 1.0;
}
.item-link:hover {
    background-color: var(--accent-color-hover);
}

.sale {
    /* 配色はstyle.cssで定義 */
    font-size: 0.8rem;
    padding: 4px 8px;
}

.item.onSale .sale {
    display: inline-block;
}

#keyword-container {
    margin-top: 1rem;
}

#keyword-form {
    display: flex;
    justify-content: center;
    padding-bottom: 0.5rem;
    gap: 0.8rem;
}

#keyword-form input[type="search"] {
    width: 100%;
    height: 2rem;
    padding: 0 0.5em;
    vertical-align: middle;
    box-sizing: border-box;
}

#keyword-form input[type="search"]::-webkit-search-cancel-button {
    /* Remove default */
    -webkit-appearance: none;
  
    /* Now your own custom styles */
     height: 14px;
     width: 14px;
     display: block;
     background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAn0lEQVR42u3UMQrDMBBEUZ9WfQqDmm22EaTyjRMHAlM5K+Y7lb0wnUZPIKHlnutOa+25Z4D++MRBX98MD1V/trSppLKHqj9TTBWKcoUqffbUcbBBEhTjBOV4ja4l4OIAZThEOV6jHO8ARXD+gPPvKMABinGOrnu6gTNUawrcQKNCAQ7QeTxORzle3+sDfjJpPCqhJh7GixZq4rHcc9l5A9qZ+WeBhgEuAAAAAElFTkSuQmCC);
    /* setup all the background tweaks for our custom icon */
    background-repeat: no-repeat;
  
    /* icon size */
    background-size: 14px;
  
  }

#keyword-form select {
    height: 2rem;
    vertical-align: middle;
    cursor: pointer;
}
#keyword-form label {
    font-size: 1rem;
    color: var(--text-color);
    white-space: nowrap;
    line-height: 2rem;
    vertical-align: middle;
    cursor: pointer;
}
#keyword-amateur-only-container, #ranking-amateur-only-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 5rem;
}
#keyword-amateur-only-container input[type="checkbox"], #ranking-amateur-only-container input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.2rem;
    vertical-align: middle;
    cursor: pointer;
}
#keyword-amateur-only-container label, #ranking-amateur-only-container label {
    font-size: 1rem;
    color: var(--text-color);
    white-space: nowrap;
    line-height: 2rem;
    vertical-align: middle;
}
#keyword-container button {
    display: block;             /* ボタンをブロック要素にする */
    margin: 0 auto;             /* 左右の margin を自動で中央寄せ */
    padding: 0;
    height: 2rem;
    line-height: 2rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
    width: 98%;
}

#keyword-container button:hover {
    background-color: var(--accent-color-hover);
}

#keyword-tags {
    display: flex;
    flex-direction: row;
    gap: 0.8rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

#keyword-tags > * {
    flex: 1;
}

#keyword-tags span {
    font-size: 1rem;
    color: var(--text-color);
    text-align: right;
}

#keyword-tags select {
    width: 100%;
    height: 1.5rem;
    font-size: 1rem;
    border-radius: 4px;
}
#minus-word {
    width: 5rem;
}
#minus-word a {
    font-size: 0.8rem;
    color: var(--text-color);
    text-decoration: none;
}

#ranking-form, #history-form {
    display: flex;
    justify-content: center;
    padding-top: 1.0rem;
    padding-bottom: 0.5rem;
    gap: 0.8rem;
}

#ranking-form select, #history-form select {
    height: 2rem;
    vertical-align: middle;
    cursor: pointer;
}
#ranking-form span {
    align-self: center;
}
@media (hover: hover) and (pointer: fine) {
    #keyword-tags select:hover {
        background-color: #9ac5a6;
    }
}

#history-scrollpane,#favorite-scrollpane {
    overflow-y: auto;
}

#ranking-scrollpane,#keyword-scrollpane {
    overflow-y: auto;
    max-height: 100vh;
}

#search-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#search-error span {
    font-size: 1.2rem;
    color: var(--text-color);
    text-align: center;
}
#search-error a {
    display: block;
    font-size: 1rem;
    color: var(--text-color);
    text-decoration: none;
    background-color: var(--accent-color);
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
    text-align: center;
    cursor: pointer;
}

#search-error a:hover {
    background-color: var(--accent-color-hover);
}

footer {
    position: fixed;
    background-color: var(--background-color);
    bottom: 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    left: 0;
    right: 0;
    font-size: 0.8rem;

    display: flex;
    align-items: center;
    justify-content: center;
}
.footer-large {
    height: 4.5rem;
}
.footer-middle {
    height: 3rem;
}
.footer-small {
    height: 2rem;
}
footer p {
    color: var(--text-color);
    margin: 0;
}

#settings_link {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    z-index: 100;
    cursor: pointer;
}

#help-tab-label {
    position: absolute;
    bottom: 0.5rem;
    right: 1rem;
    z-index: 100;
    cursor: pointer;
}
#help-tab-label a {
    color: var(--text-color);
    text-decoration: none;
}

/* モバイル用 */
@media (max-width: 768px) {
    body {
        margin: 0;
    }
    #banner-container img {
        height: 3.7rem;
    }
    #banner-text {
        font-size: 1rem;
    }

    .tab-button {
        font-size: 1rem;
        height: 3.5rem;
    }
    .item h3 {
        font-size: 14px;
    }
    .sale {
        font-size: 0.6rem;
        padding: 0.2rem;
        position: absolute;
        bottom: 0.5rem;
        left: 0.5rem;
    }
    .item-link {
        width: 8rem;
    }
    .tab-buttons {
        height: 5.5rem;
    }
    #keyword-form {
        gap: 0.3rem;
    }
    #keyword-tags {
        flex-direction: row;
        /* 画面幅に応じて改行 */
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    #keyword-tags span {
        flex: none;
        text-align: left;
        width: 100%;
        font-size: 0.8rem;
    }
    #keyword-tags select {
        flex: none;
        width: 32%;
        font-size: 0.8rem;
    }
    #minus-word {
        width: 10rem;
    }
    #keyword-amateur-only-container {
        min-width: 3rem;
    }

    #keyword-amateur-only-container input[type="checkbox"], #ranking-amateur-only-container input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
        margin-right: 0.1rem;
    }
    #keyword-amateur-only-container label {
        font-size: 0.8rem;
    }

    .footer-large {
        height: 6rem;
    }
    .footer-middle {
        height: 4.5rem;
    }
    .footer-small {
        height: 2rem;
    }
    .disclaimer {
        font-size: 0.8rem;
        max-width: 80%
    }

    #help-tab-label {
        top: 3.7rem;
        right: 1.0rem;
    }
}

/* モバイル ランドスケープ時のカルーセル表示（新着・履歴両対応） */
@media screen and (orientation: landscape) and (max-height: 600px) and (max-width: 950px) and (hover: none) and (pointer: coarse) {
    html,body {
        height: 100%;
    }
    body {
        margin: 0rem;
    }
    #banner-container {
        display: none;
    }
    h1 {
        font-size: 1.2rem;
         margin-top: 1rem;
         margin-left: 1rem;
         position: fixed;
         top: 0;
         left: 0;
    }
    .tab-buttons {
        height: 3.5rem;
    }
    #help-tab-label {
        top: 1rem;
    }
    .item-list {
        margin-top: 0;
        flex-direction: row;
        gap: 5px;
        text-align: center;
        vertical-align: middle;
    }
    .item {
        padding: 0px;
        width: fit-content;
        height: fit-content;
    }
    .item img {
        margin-right: 0px;
        height: 70vh;
        width: auto;
    }
    .sale {
        font-size: 0.8rem;
        padding: 0.2rem;
        position: absolute;
        bottom: 0;
        left: 0;
    }
    .item-details h3 {
        display: none;
    }
    .item-details .meta {
        display: none;
    }
    .item-link {
        display: none;
    }

    #keyword-container {
        margin-top: 0.3rem;
    }
    #keyword-tags {
        padding: 0;
    }
    #keyword-tags span {
        display: none;
    }
    #keyword-tags select {
        width: 16%;
    }
    #minus-word {
        width: 6rem;
    }
    footer {
        display: none;
    }
}
