/*--------------------------------------------------
汎用モーダル基盤スタイル
--------------------------------------------------*/

/* スクリーンリーダー用スタイル */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 基本モーダルスタイル */
.wp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wp-modal.is-active {
    opacity: 1;
    visibility: visible;
}

.wp-modal.is-closing {
    opacity: 0;
}

/* オーバーレイ */
.wp-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* コンテンツエリア */
.wp-modal__content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    outline: none;
}

/* 閉じるボタン基本スタイル */
.wp-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #666;
    transition: color 0.3s ease;
    z-index: 10;
}

.wp-modal__close:hover {
    color: #333;
}

/* フォーカストラップ要素 */
#modal-trap-start,
#modal-trap-end {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 確認ダイアログ用スタイル */
.wp-modal--confirm .wp-modal__content {
    max-width: 400px;
    padding: 30px;
    text-align: center;
}

.wp-modal__confirm p {
    margin: 0 0 20px;
    font-size: 16px;
    color: #333;
}

.wp-modal__confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.wp-modal__button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.wp-modal__button--cancel {
    background-color: #6c757d;
    color: white;
}

.wp-modal__button--cancel:hover {
    background-color: #5a6268;
}

.wp-modal__button--ok {
    background-color: #0073aa;
    color: white;
}

.wp-modal__button--ok:hover {
    background-color: #005a87;
}

/*--------------------------------------------------
印刷モーダル固有スタイル
--------------------------------------------------*/

.wp-modal--print .wp-modal__content {
    max-width: 400px;
}

.print-modal-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.print-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.print-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
    padding: 0;
}

.print-modal-close:hover {
    color: #333;
}

.print-modal-body {
    padding: 20px;
}

.print-modal-body p {
    margin: 0 0 15px 0;
    color: #555;
}

.print-options {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.print-option-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    min-width: 80px;
}

.print-option-btn:hover {
    background-color: #5a6268;
}

.print-option-btn[data-type="horizontal"] {
    background-color: #28a745;
}

.print-option-btn[data-type="horizontal"]:hover {
    background-color: #218838;
}

.print-option-btn[data-type="vertical"] {
    background-color: #007bff;
}

.print-option-btn[data-type="vertical"]:hover {
    background-color: #0056b3;
}

/*--------------------------------------------------
初回訪問モーダル固有スタイル
--------------------------------------------------*/

.wp-modal--welcome .wp-modal__overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

.wp-modal--welcome .wp-modal__content {
    max-width: 1600px;
    width: 90%;
    padding: 30px;
    border-radius: 20px;
    animation: welcomeContentFadeIn 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes welcomeContentFadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* 初回訪問モーダル閉じるボタン */
.welcome-modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transition: all 0.2s ease;
}

.welcome-modal__close:hover,
.welcome-modal__close:focus {
    background: #f5f5f5;
    transform: rotate(90deg);
    outline: none;
}

.welcome-modal__body {
    position: relative;
    margin-top: 1em;
}

.welcome-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.welcome-modal-icon {
    margin-right: 10px;
}

.welcome-modal-heading {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: #333;
    margin: 0;
}

.welcome-modal-description {
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 25px;
    color: #555;
}

.welcome-modal-divider {
    position: relative;
    text-align: center;
    margin: 30px 0 25px;
}

.welcome-modal-divider:before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
}

.welcome-modal-divider span {
    position: relative;
    background: white;
    padding: 0 15px;
    color: #888;
    font-size: 0.9rem;
    font-weight: 600;
}

.welcome-modal-options {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.welcome-modal-option {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
    border: 1px solid #e5e5e5;
    flex: 1;
    min-width: 40%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.welcome-modal-option--primary {
    border: 1px solid #c8d7e6;
}

.welcome-modal-option__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #e0e0e0;
    color: #555;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 1;
}

.welcome-modal-option__badge--active {
    background: #4caf50;
    color: white;
}

.welcome-modal-option__header {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: #f7f7f7;
}

.welcome-modal-option__icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #9b8a49;
    color: white;
    margin-right: 15px;
    flex-shrink: 0;
}

.welcome-modal-option__icon-wrapper--secondary {
    background: var(--color_main);
}

.welcome-modal-option__title-group {
    flex: 1;
}

.welcome-modal-option__title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
    margin: 0 0 5px 0;
}

.welcome-modal-option__subtitle {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.welcome-modal-option__content {
    padding: 20px;
    background-color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

.welcome-modal-option__current-badge {
    display: inline-flex;
    align-items: center;
    background: #f0f8ff;
    color: #4682b4;
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.welcome-modal-option__current-badge svg {
    margin-right: 5px;
}

.welcome-modal-option__features {
    margin: 0 0 20px 0;
    padding: 0;
    list-style-type: none;
}

.welcome-modal-option__features li {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #444;
    display: flex;
    align-items: center;
}

.feature-check {
    color: #4caf50;
    font-weight: bold;
    margin-right: 8px;
}

.welcome-modal-option__cta {
    margin-top: 15px;
}

.welcome-modal-option__button {
    display: block;
    padding: 12px 20px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
}

.welcome-modal-option__button--primary {
    background-color: #9b8a49;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-modal-option__button--primary svg {
    margin-left: 8px;
}

.welcome-modal-option__button--primary:hover {
    background-color: rgba(116, 104, 55, 1);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(70, 130, 180, 0.3);
    text-decoration: none;
}

.welcome-modal-option__button--secondary {
    background-color: var(--color_main);
    color: #fff !important;
    border: 1px solid #e0e0e0;
}

.welcome-modal-option__button--secondary:hover {
    background-color: var(--color_main_dark);
    color: #fff !important;
    text-decoration: none;
}

.welcome-modal-separator {
    text-align: center;
    position: relative;
    color: #888;
    font-size: 0.9rem;
    margin: 5px 0;
}

.welcome-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.welcome-modal-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    user-select: none;
}

.welcome-modal-checkbox input[type="checkbox"] {
    margin-right: 8px;
}

.checkbox-text {
    line-height: 18px;
}

.welcome-modal-close-button {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.welcome-modal-close-button:hover {
    background-color: #e5e5e5;
}

/* スクロール案内 */
.wp-modal--welcome .wp-modal__content {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

.wp-modal--welcome .wp-modal__content::-webkit-scrollbar {
    width: 8px;
}

.wp-modal--welcome .wp-modal__content::-webkit-scrollbar-track {
    background: transparent;
}

.wp-modal--welcome .wp-modal__content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.welcome-modal__scroll-indicator {
    position: sticky;
    bottom: 10px;
    margin: 0 auto;
    width: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    animation: fadeInOut 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.welcome-modal__scroll-indicator svg {
    margin-right: 6px;
    animation: bounceDown 1.2s ease-in-out infinite;
}

@keyframes bounceDown {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(5px);
    }
    60% {
        transform: translateY(3px);
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.wp-modal--welcome .wp-modal__content.has-overflow .welcome-modal__scroll-indicator {
    display: flex;
}

/*--------------------------------------------------
共通レスポンシブ対応
--------------------------------------------------*/

@media screen and (max-width: 640px) {
    /* 印刷モーダル */
    .wp-modal--print .wp-modal__content {
        width: 95%;
    }
    
    .print-options {
        flex-direction: column;
    }
    
    .print-option-btn {
        width: 100%;
    }
    
    /* 初回訪問モーダル */
    .wp-modal--welcome .wp-modal__content {
        width: 95%;
        padding: 20px 15px;
    }
    
    .welcome-modal-heading {
        font-size: 1.3rem;
    }
    
    .welcome-modal-description {
        font-size: 0.9rem;
    }
    
    .welcome-modal-option {
        min-width: 80%;
    }
    
    .welcome-modal-option__header {
        padding: 15px;
    }
    
    .welcome-modal-option__icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .welcome-modal-option__title {
        font-size: 1rem;
    }
    
    .welcome-modal-option__subtitle {
        font-size: 0.8rem;
    }
    
    .welcome-modal-option__content {
        padding: 15px;
    }
    
    .welcome-modal-option__features li {
        font-size: 0.85rem;
    }
    
    .welcome-modal-option__button {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
    
    .welcome-modal-footer {
        flex-direction: column;
        gap: 15px;
    }
    
    .welcome-modal-close-button {
        width: 100%;
    }
}

/* ハイコントラストモード対応 */
@media (forced-colors: active) {
    .wp-modal__close,
    .welcome-modal__close,
    .welcome-modal-close-button,
    .wp-modal__content,
    .welcome-modal-option,
    .welcome-modal-option__button,
    .print-option-btn {
        border: 1px solid currentColor;
    }
}