/* ================================================
   アニマネ管理画面カスタムCSS
   UIKit のモバイル用メディアクエリを上書き
   ================================================ */

/* スマホでも Column Width 設定を維持 */
@media screen and (max-width: 767px) {
    /* ProcessWire 本体の AdminThemeUikitNoGrid ルールを上書き */
    body .InputfieldColumnWidth[data-colwidth="50%"] {
        width: 50% !important;
    }

    body .InputfieldColumnWidth[data-colwidth="33%"] {
        width: 33% !important;
    }
    body .InputfieldColumnWidth[data-colwidth="34%"] {
        width: 34% !important;
    }
    
    body .InputfieldColumnWidth[data-colwidth="35%"] {
        width: 35% !important;
    }
    body .InputfieldColumnWidth[data-colwidth="30%"] {
        width: 30% !important;
    }

    body .InputfieldColumnWidth[data-colwidth="25%"] {
        width: 25% !important;
    }

    body .InputfieldColumnWidth[data-colwidth="66%"] {
        width: 66% !important;
    }

    body .InputfieldColumnWidth[data-colwidth="75%"] {
        width: 75% !important;
    }
}

/* 入力欄にでてるトグル、邪魔 */
body .InputfieldHeader.InputfieldStateToggle i.toggle-icon{
    display: none;
}

/* species_ 関連はもっとスリムに 特定動物チェック項目のみnotで例外処理 */
body [id*=wrap_Inputfield_species_]:not(#wrap_Inputfield_species_specified_animal):not(#wrap_Inputfield_species_reference) > *{
    font-size: 13px !important;
}
body [id*=wrap_Inputfield_species_]:not(#wrap_Inputfield_species_specified_animal):not(#wrap_Inputfield_species_reference) .InputfieldHeader{
    padding: .75em 1em .5em;
}
body [id*=wrap_Inputfield_species_]:not(#wrap_Inputfield_species_specified_animal):not(#wrap_Inputfield_species_reference) .InputfieldContent{
    padding: 0 1em .75em;
}

/* ラジオボタン集の間隔追加 */
body .InputfieldRadiosStacked li:not(:last-of-type){
    margin-bottom: .5em !important;
}

/* ダークテーマ・ライトテーマ対応 */
body.light-theme [id*=wrap_Inputfield_species_][data-colwidth]{
    background: #eee !important;
}
body.dark-theme [id*=wrap_Inputfield_species_][data-colwidth]{
    background: #333 !important;
}

/* 生体ライブラリ登録リンク：独立した行として表示 */
.library-register-container {
    width: 100% !important;
    clear: both;
    margin: 0;
    padding: 0.5em 0 1em;
    text-align: right;
}
.library-register-container a{
    font-size: 12px;
    color: #333;
}

[class*=filter-header]{
    margin: 1.5em 0;
}

/* ================================================
   取扱生体一覧（stocks-list-compact）スタイル
   ================================================ */

/* エラーメッセージ */
.stocks-error {
    color: #c00;
}

/* カテゴリフィルタヘッダー */
/* .stocks-filter-header {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
} */

/* カテゴリフィルタは components.css で定義 */

/* 各商品アイテム */
@media screen and (min-width: 768px) {
    .stocks-list-item {
        /* display: flex; */
        /* justify-content: space-between; */
        /* gap: 12px;
        margin-bottom: 15px;
        padding: 12px;
        border: 1px solid; */
        /* border-radius: 4px; */
    }
    .stocks-list-species{
        /* width: 42%; */
    }
    .stocks-list-info{
        /* width: 64%;
        display: flex; */
    }
    /* .stocks-list-compact{
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .stocks-list-compact > .stocks-list-item{
        width: 48.5%;
    } */
}

.stocks-list-mini-form{
    display: flex;
    flex-wrap: wrap;
}

.stocks-list-item{
    padding-bottom: 1em;
    margin-bottom: 1em;
    border-bottom: 1px solid #aaa;
}
.stocks-list-species{
    display: flex;
    flex-wrap: wrap;
}
.stocks-list-species-photo{
    width: 92px;
    padding-right: 1em;
}
.stocks-list-species-photo img{
}
.stocks-list-species-datas{
    width: calc(100% - 92px);
}
@media screen and (max-width: 480px) {
    .stocks-list-species-photo{
        width: 20%;
    }
    .stocks-list-species-datas{
        width: 80%;
    }
}
/* .stocks-list-title{
    font-size: 1.1em;
    margin-bottom: 0;
    font-weight: bold;
} */
.stocks-list-name{
    font-size: 0.9em;
    margin-bottom: 0.25em;
}
.stocks-list-modified {
    opacity: 0.7;
    margin-right: 1em;
}

/* 価格表示 */
.stocks-list-price {
    font-size: 1.2em;
    /* color: #090; */
}
.stocks-list-unset{
    opacity: .8;
    font-size: .9em;
}

/* 販売状況ボックス */
.stock-status-radios {
    display: flex;
    flex-wrap: wrap;
    font-size: 0.9em;
    letter-spacing: -0.5px;
    margin-right: 1em;
}
.stocks-list-status-radio {
    cursor: pointer;
}
.stocks-list-status-radio + .stocks-list-status-radio{
    margin-left: 0.25em;
}
.stocks-list-status-radio input {
    margin-right: 0;
}


.stocks-list-memo-textarea {
    width: 100%;
    min-width: 16em;
    padding: 4px;
    font-size: 14px;
}
.stocks-list-footer{
    display: flex;
    align-items: center;
    /* justify-content: space-between; */
    font-size: 0.75em;
}

@media screen and (max-width: 767px) {
    .stocks-list-memo-textarea {
        margin-top: 0.25em;
        font-size: 16px;
    }
    .stocks-list-footer{
        display: block;
    }
}

/* 新規追加ボタン */
.stocks-list-add-button {
    margin-top: 15px;
}

.stocks-list-add-link {
    display: inline-block;
    padding: 8px 15px;
    background-color: #0066cc;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 13px;
}

/* 空状態表示 */
.stocks-list-empty {
    padding: 30px;
    text-align: center;
    border: 1px dashed;
    font-size: 13px;
}

.stocks-list-empty p {
    margin-bottom: 15px;
    opacity: 0.6;
}

/* ================================================
   アニマネカスタムヘッダー（shop-user専用）
   ================================================ */

/* shop-user の場合のみ適用（html に .animanage-shop-user クラスが付与される） */
html.animanage-shop-user #pw-masthead,
html.animanage-shop-user #pw-mastheads,
html.animanage-shop-user .pw-masthead,
html.animanage-shop-user #pw-content-head,
html.animanage-shop-user #offcanvas-toggle,
html.animanage-shop-user .uk-offcanvas-bar {
    display: none !important;
}

/* カスタムヘッダー */
#animanage-custom-header {
    background: linear-gradient(180deg, #3a4557 0%, #2d3542 100%);
    color: white;
    /* position: fixed; */
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    opacity: 0; /* 初期状態は非表示（JS移動後に表示） */
    transition: opacity 0.2s ease;
}

#animanage-custom-header.is-ready {
    opacity: 1;
}

.animanage-header-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 5%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.animanage-logo {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    filter: brightness(0) invert(1); /* SVGを白色に変換 */
}

.animanage-header-text {
    flex: 1;
}

#animanage-custom-header h1 {
    margin: 0;
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    font-weight: 600;
}

#animanage-custom-header p {
    margin: 0.25rem 0 0 0;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    opacity: 0.8;
}

.animanage-user-link {
    color: white;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.animanage-user-link:hover {
    text-decoration-style: solid;
    opacity: 1;
}

/* タブナビゲーション */
.animanage-tabs {
    display: flex;
    gap: 0;
    padding: 0 5%;
    background: rgba(0, 0, 0, 0.2);
    overflow-x: auto;
}

/* main要素にヘッダー分のpadding追加 */
/* html.animanage-shop-user #main {
    padding-top: 130px;
}

@media screen and (max-width: 767px) {
    html.animanage-shop-user #main {
        padding-top: 120px;
    }
} */

.animanage-tab {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.animanage-tab-icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1); /* SVGを白色に変換 */
    opacity: 0.8;
}

.animanage-tab:hover .animanage-tab-icon,
.animanage-tab.active .animanage-tab-icon {
    opacity: 1;
}

.animanage-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.animanage-tab.active {
    color: white;
    border-bottom-color: #fff;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

/* リンク型タブのスタイル統一 */
a.animanage-tab {
    text-decoration: none;
}

a.animanage-tab:visited {
    color: rgba(255, 255, 255, 0.8);
}

/* スマホ対応 */
@media (max-width: 767px) {
    .animanage-header-top {
        padding: 0.75rem 3%;
    }

    .animanage-tabs {
        padding: 0 3%;
    }

    .animanage-tab {
        padding: 0.6rem 1rem;
    }
}

/* ================================================
   生体ライブラリ テーブル型レイアウト
   ================================================ */

.species-library-table-wrapper {
    margin-bottom: 2em;
    overflow-x: auto;
}

.species-library-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 0.85em;
    background: #fff;
    border: 1px solid #ccc;
}

.species-library-table th,
.species-library-table td {
    padding: 0.35em 0.6em;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.species-library-table thead th {
    font-weight: 600;
    white-space: nowrap;
    background: #f5f5f5;
    border-bottom: 2px solid #bbb;
}

.species-library-table tbody tr:hover {
    background: #f9f9f9;
}

/* 特定動物該当時のハイライト */
.species-library-table .is-specified {
    color: #c00;
    font-weight: 600;
}

/* ================================================
   WordPress風 商品一覧（stock-row）スタイル
   ================================================ */

.stocks-list-table {
    margin-top: 1.5em;
}

.stock-row {
    border: 1px solid #ddd;
    background: white;
    margin-bottom: 1em;
    border-radius: 4px;
    overflow: hidden;
}

/* 通常表示行 */
.stock-row-normal {
    display: flex;
    gap: 1em;
    padding: 1em;
}

/* サムネイル */
.stock-thumbnail {
    flex-shrink: 0;
}

.stock-thumbnail img {
    display: block;
    border-radius: 3px;
    border: 1px solid #ddd;
}

/* メイン情報エリア */
.stock-main-info {
    flex: 1;
    min-width: 0;
}

.stock-title-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.5em;
}

.stock-title {
    font-size: 1.1em;
    color: #333;
}

.stock-category-badge {
    display: inline-block;
    line-height: 1;
    font-size: 0.9em;
    padding: 0.5em 0.6em .25em;
    background: linear-gradient(180deg, #3a4557 0%, #2d3542 100%);
    color: white;
    border-radius: 3px;
    white-space: nowrap;
}

/* 詳細情報グリッド */
.stock-details-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75em 1.5em;
    margin-bottom: 0.75em;
    font-size: 0.9em;
}

.stock-detail-item {
    display: flex;
    gap: 0.4em;
}

.stock-label {
    color: #666;
    font-weight: 500;
}

.stock-value {
    color: #333;
}

.stock-price {
    font-weight: bold;
    font-size: 1.1em;
    /* color: #090; */
}

/* 販売状況別の色分け */
[class*=stock-status-]::before{
    content: "【";
}
[class*=stock-status-]::after{
    content: "】";
}
.stock-status-1 { color: #090; font-weight: 600; } /* 販売中 */
.stock-status-2 { color: #c00; font-weight: 600; } /* 売約済み */
.stock-status-3 { color: #f80; font-weight: 600; } /* 交渉中 */
.stock-status-4 { color: #999; font-weight: 600; } /* 販売停止 */

/* 商品説明・メモ */
.stock-notes,
.stock-memo {
    font-size: 0.85em;
    color: #555;
    line-height: 1.5;
    margin-top: 0.5em;
    padding-top: 0.5em;
    border-top: 1px solid #f0f0f0;
}

/* 非公開メモのラベル（インライン表示） */
.stock-memo-label {
    color: #666;
    font-weight: 600;
}

/* アクションエリア */
.stock-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    align-items: flex-end;
    flex-shrink: 0;
}

.stock-action-link {
    display: inline-block;
    padding: 0.5em 1em;
    font-size: 0.85em;
    text-decoration: none;
    border-radius: 3px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.stock-action-link:hover {
    background: #f5f5f5;
    border-color: #999;
}

.stock-action-edit {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

.stock-action-edit:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.stock-action-quick-edit {
    background: #f0f0f0;
    color: #333;
}

.stock-modified {
    font-size: 0.75em;
    color: #999;
    margin-top: 0.5em;
}

/* クイック編集エリア（アコーディオン） */
.stock-row-quick-edit {
    background: #f9f9f9;
    border-top: 1px solid #ddd;
}

.quick-edit-inner {
    padding: 1.5em;
}

.quick-edit-inner h3 {
    margin: 0 0 1em 0;
    font-size: 1.1em;
    color: #333;
}

.quick-edit-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1em;
}

.quick-edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}

.quick-edit-field label {
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
}

.quick-edit-input,
.quick-edit-textarea {
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.9em;
}

.quick-edit-input:focus,
.quick-edit-textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.quick-edit-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75em;
}

.quick-edit-radio-label {
    display: flex;
    align-items: center;
    gap: 0.3em;
    cursor: pointer;
    font-weight: 400;
}

.quick-edit-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.75em;
    align-items: center;
    padding-top: 1em;
    border-top: 1px solid #ddd;
}

.quick-edit-save,
.quick-edit-cancel {
    padding: 0.6em 1.5em;
    border-radius: 3px;
    border: none;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-edit-save {
    background: #090;
    color: white;
}

.quick-edit-save:hover {
    background: #070;
}

.quick-edit-cancel {
    background: #999;
    color: white;
}

.quick-edit-cancel:hover {
    background: #777;
}

.quick-edit-message {
    font-size: 0.9em;
    padding: 0.4em 0.8em;
    border-radius: 3px;
}

.quick-edit-message.success {
    background: #d4edda;
    color: #155724;
}

.quick-edit-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* スマホ対応 */
@media (max-width: 767px) {
    .stock-row-normal {
        flex-direction: column;
    }

    .stock-actions {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .stock-details-grid {
        gap: 0.5em;
    }

    .quick-edit-form {
        grid-template-columns: 1fr;
    }
}