/**
 * 検索モーダル専用CSS
 */

/* ==========================================================================
   Search Modal - Base
   ========================================================================== */
.p-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    display: none;
}

.p-search-modal[aria-hidden="false"] {
    display: block;
}

.p-search-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(43, 46, 56, 0.7);
}

.p-search-modal__content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 0 24px;
}

/* ==========================================================================
   Search Modal - Header
   ========================================================================== */
.p-search-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.p-search-modal__title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--color-text);
}

.p-search-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.p-search-modal__close:hover {
    opacity: 0.7;
}

.p-search-modal__close img {
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   Search Modal - Body
   ========================================================================== */
.p-search-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px;
    background: var(--color-white);
}

.p-search-modal__body::-webkit-scrollbar {
    width: 6px;
}

.p-search-modal__body::-webkit-scrollbar-track {
    background: var(--color-white);
}

.p-search-modal__body::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

/* ==========================================================================
   Search Modal - Form
   ========================================================================== */
.p-search-modal__form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   Search Modal - Keyword (SP only)
   ========================================================================== */
.p-search-modal__keyword-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-pill);
    font-size: 15px;
    background-image: url('../../images/icon/search.svg');
    background-repeat: no-repeat;
    background-position: 16px center;
    background-size: 20px 20px;
}

.p-search-modal__keyword-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(40, 115, 201, 0.15);
}

.p-search-modal__keyword-input::placeholder {
    color: var(--color-gray);
}

/* ==========================================================================
   Search Modal - Section
   ========================================================================== */
.p-search-modal__section {
    display: flex;
    flex-direction: column;
}

.p-search-modal__section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #A6BEE0;
}

/* ==========================================================================
   Search Modal - Content Types
   ========================================================================== */
.p-search-modal__content-types {
    padding-top: 12px;
    display: flex;
    gap: 12px;
}

.p-search-modal__type-item {
    flex: 1;
    display: flex;
    cursor: pointer;
}

.p-search-modal__type-item .p-search-modal__type-label {
    flex: 1;
}

.p-search-modal__type-radio,
.p-search-modal__type-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.p-search-modal__type-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 12px;
    background: #F6F6F6;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 15px;
    line-height: 18px;
    color: var(--color-text);
    text-align: center;
    transition: all 0.2s ease;
}

.p-search-modal__type-label img {
    display: none;
}

.p-search-modal__type-label:hover {
    opacity: 0.8;
}

.p-search-modal__type-label--active,
.p-search-modal__type-radio:checked + .p-search-modal__type-label,
.p-search-modal__type-checkbox:checked + .p-search-modal__type-label {
    background: var(--color-primary);
    color: var(--color-white);
}

.p-search-modal__type-radio:checked + .p-search-modal__type-label img,
.p-search-modal__type-checkbox:checked + .p-search-modal__type-label img {
    filter: brightness(0) invert(1);
}

/* ==========================================================================
   Search Modal - Categories
   ========================================================================== */
.p-search-modal__categories {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.p-search-modal__category-group {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 0;
    border-bottom: 1px solid #A6BEE0;
}

.p-search-modal__category-group:last-child {
    border-bottom: none;
}

.p-search-modal__category-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.p-search-modal__category-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.p-search-modal__select-all {
    font-size: 15px;
    color: var(--color-primary);
    background: #F6F6F6;
    border: none;
    padding: 4px 12px;
    border-radius: var(--border-radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
}

.p-search-modal__select-all:hover {
    background: rgba(40, 115, 201, 0.1);
}

.p-search-modal__select-all--filled {
    background: var(--color-primary);
    color: var(--color-white);
}

.p-search-modal__select-all--filled:hover {
    background: var(--color-primary-dark);
}

/* ==========================================================================
   Search Modal - Tags (Checkbox styled as tags)
   ========================================================================== */
.p-search-modal__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.p-search-modal__tag {
    display: inline-flex;
    cursor: pointer;
}

.p-search-modal__tag input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.p-search-modal__tag-label {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 15px;
    border: none;
    border-radius: var(--border-radius-pill);
    background-color: #F6F6F6;
    color: var(--color-text);
    transition: all 0.2s ease;
}

.p-search-modal__tag-label:hover {
    opacity: 0.8;
}

.p-search-modal__tag input[type="checkbox"]:checked + .p-search-modal__tag-label {
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* ==========================================================================
   Search Modal - Accordion (3-level categories)
   ========================================================================== */
.p-search-modal__category-group--accordion .p-search-modal__category-header {
    margin-bottom: 0;
}

.p-search-modal__subcategory-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.p-search-modal__category-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
}

.p-search-modal__category-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.p-search-modal__accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.p-search-modal__accordion-toggle img {
    width: 16px;
    height: 16px;
}

.p-search-modal__accordion-toggle[aria-expanded="true"] {
    transform: rotate(180deg);
}

.p-search-modal__accordion-content {
    display: flex;
    flex-direction: column;
    padding-top: 12px;
    gap: 16px;
}

.p-search-modal__accordion-content[hidden] {
    display: none;
}

.p-search-modal__subcategory-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-sub);
    margin: 0;
}

/* ==========================================================================
   Search Modal - Footer
   ========================================================================== */
.p-search-modal__footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 24px;
    flex-shrink: 0;
    background: var(--color-white);
}

.p-search-modal__save-option {
    display: flex;
    justify-content: center;
}

.p-search-modal__save-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-primary);
    cursor: pointer;
}

.p-search-modal__save-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.p-search-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-self: center;
    width: 100%;
    max-width: 320px;
}

.p-search-modal__footer .c-gi-btn {
    padding: var(--space-10) var(--space-24);
    font-weight: normal;
    flex: 1;
}

.p-search-modal__footer .c-gi-btn::after {
    display: none;
}

.p-search-modal__reset {
    background-color: #F6F6F6;
    border-color: #F6F6F6;
    color: var(--color-text);
    box-shadow: none;
}

/* ==========================================================================
   Responsive - SP (767px and below)
   ========================================================================== */
@media screen and (max-width: 767px) {
    .p-search-modal__content {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        width: 100%;
        max-width: none;
        max-height: none;
        height: 100%;
        border-radius: 0;
        gap: 20px;
        padding: 16px 0 0;
    }

    .p-search-modal__header {
        padding: 0 20px;
        justify-content: flex-end;
    }

    .p-search-modal__title {
        display: none;
    }

    .p-search-modal__body {
        padding: 0 20px 0;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .p-search-modal__keyword-input {
        box-sizing: border-box;
        padding: 12px 44px 12px 16px;
        background-position: calc(100% - 16px) center;
    }

    .p-search-modal__content-types {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 1fr;
        gap: 10px;
    }

    .p-search-modal__type-item {
        height: 100%;
    }

    .p-search-modal__type-label {
        padding: 4px 10px;
        font-size: 15px;
        line-height: 17px;
    }

    .p-search-modal__footer {
        position: sticky;
        bottom: 0;
        padding: 12px 20px 20px;
        background: rgba(218, 228, 242, 0.8);
    }

    .p-search-modal__actions {
        flex: 1;
    }

    .p-search-modal__select-all,
    .p-search-modal__category-checkbox {
        font-size: 13px;
    }

    .p-search-modal__reset,
    .p-search-modal__submit {
        flex: 1;
        min-width: auto;
        font-size: 14px;
        font-weight: normal;
    }
}
