/**
 * VibeBlocks Classic Editor Styles
 * TinyMCEエディタ内でブロックHTMLを表示するためのスタイル
 */

/* ==========================================================================
   バルーン（吹き出し）
   ========================================================================== */
.vibe-balloon {
    align-items: flex-start;
    display: flex;
    gap: 15px;
    margin: 1.5em 0;
}

.vibe-balloon--right {
    flex-direction: row-reverse;
}

.vibe-balloon--right .vibe-balloon__content:before {
    border-color: transparent;
    border-left-color: inherit;
    border-width: 8px 0 8px 10px;
    left: auto;
    right: -10px;
}

.vibe-balloon--right .vibe-balloon__content:after {
    border-color: transparent;
    border-left-color: inherit;
    border-width: 7px 0 7px 9px;
    left: auto;
    right: -8px;
}

.vibe-balloon__icon {
    flex-shrink: 0;
    text-align: center;
    width: 80px;
}

.vibe-balloon__icon img {
    border-radius: 50%;
    height: 60px;
    object-fit: cover;
    width: 60px;
}

.vibe-balloon__name {
    color: #666;
    display: block;
    font-size: 12px;
    margin-top: 0;
}

.vibe-balloon__content {
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    flex: 1;
    max-width: calc(100% - 100px);
    padding: 15px 20px;
    position: relative;
}

.vibe-balloon__content:after,
.vibe-balloon__content:before {
    border-style: solid;
    content: "";
    position: absolute;
    top: 20px;
}

.vibe-balloon__content:before {
    border-color: transparent;
    border-right-color: inherit;
    border-width: 8px 10px 8px 0;
    left: -10px;
}

.vibe-balloon__content:after {
    border-color: transparent;
    border-right-color: inherit;
    border-width: 7px 9px 7px 0;
    left: -8px;
}

.vibe-balloon__content p:last-child {
    margin-bottom: 0;
}

/* 考え中タイプ */
.vibe-balloon--think .vibe-balloon__content {
    border-radius: 20px;
}

.vibe-balloon--think .vibe-balloon__content:after,
.vibe-balloon--think .vibe-balloon__content:before {
    background: #e0e0e0;
    border: none;
    border-radius: 50%;
}

.vibe-balloon--think .vibe-balloon__content:before {
    height: 12px;
    left: -15px;
    top: 25px;
    width: 12px;
}

.vibe-balloon--think .vibe-balloon__content:after {
    height: 8px;
    left: -25px;
    top: 35px;
    width: 8px;
}

.vibe-balloon--think.vibe-balloon--right .vibe-balloon__content:before {
    left: auto;
    right: -15px;
}

.vibe-balloon--think.vibe-balloon--right .vibe-balloon__content:after {
    left: auto;
    right: -25px;
}

/* ==========================================================================
   カラーボックス
   ========================================================================== */
.vibe-color-box {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 5px;
    color: #856404;
    margin: 1.5em 0;
    padding: 20px;
}

.vibe-color-box > :last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   アイコン付きボックス
   ========================================================================== */
.vibe-icon-box {
    align-items: flex-start;
    border-radius: 5px;
    border-top: 3px solid;
    display: flex;
    gap: 12px;
    margin: 1.5em 0;
    padding: 15px 20px;
}

.vibe-icon-box__icon {
    align-items: center;
    display: inline-flex;
    flex-shrink: 0;
    justify-content: center;
    margin-top: 2px;
    height: 24px;
    width: 24px;
}

.vibe-icon-box__icon svg {
    height: 24px;
    width: 24px;
}

.vibe-icon-box__content {
    flex: 1;
    min-width: 0;
}

.vibe-icon-box__content > :last-child {
    margin-bottom: 0;
}

/* プリセットカラー */
.vibe-icon-box--hint {
    background-color: #fffde7;
    border-top-color: #ffc107;
}
.vibe-icon-box--hint .vibe-icon-box__icon {
    color: #ffc107;
}

.vibe-icon-box--info {
    background-color: #e0f7fa;
    border-top-color: #00bcd4;
}
.vibe-icon-box--info .vibe-icon-box__icon {
    color: #00bcd4;
}

.vibe-icon-box--check {
    background-color: #e8f5e9;
    border-top-color: #4caf50;
}
.vibe-icon-box--check .vibe-icon-box__icon {
    color: #4caf50;
}

.vibe-icon-box--memo {
    background-color: #eceff1;
    border-top-color: #607d8b;
}
.vibe-icon-box--memo .vibe-icon-box__icon {
    color: #607d8b;
}

.vibe-icon-box--alert {
    background-color: #ffebee;
    border-top-color: #f44336;
}
.vibe-icon-box--alert .vibe-icon-box__icon {
    color: #f44336;
}

.vibe-icon-box--question {
    background-color: #fff3e0;
    border-top-color: #ff9800;
}
.vibe-icon-box--question .vibe-icon-box__icon {
    color: #ff9800;
}

.vibe-icon-box--bad,
.vibe-icon-box--ng {
    background-color: #ffebee;
    border-top-color: #f44336;
}
.vibe-icon-box--bad .vibe-icon-box__icon,
.vibe-icon-box--ng .vibe-icon-box__icon {
    color: #f44336;
}

.vibe-icon-box--good {
    background-color: #e3f2fd;
    border-top-color: #2196f3;
}
.vibe-icon-box--good .vibe-icon-box__icon {
    color: #2196f3;
}

/* ==========================================================================
   キャプション付きボックス
   ========================================================================== */
.vibe-caption-box {
    background-color: #fff;
    border: 2px solid #06c;
    border-radius: 5px;
    margin: 1.5em 0;
    margin-top: 2em; /* キャプション用のスペース確保 */
    padding: 25px 20px 15px;
    position: relative;
    overflow: visible; /* キャプションがはみ出ても表示 */
}

.vibe-caption-box__caption {
    background: #fff;
    color: #06c;
    font-size: 14px;
    font-weight: 700;
    left: 15px;
    line-height: 1.7;
    padding: 0 8px;
    position: absolute;
    top: -12px;
    z-index: 1; /* 確実に前面に表示 */
}

.vibe-caption-box__content > :last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   ボタン
   ========================================================================== */
.vibe-button-wrap {
    margin: 1em 0;
    text-align: center;
}

.vibe-button {
    align-items: center;
    border: 2px solid;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    padding: 12px 30px;
    text-decoration: none;
    transition: all .3s ease;
}

.vibe-button:hover {
    opacity: .85;
    text-decoration: none;
}

/* サイズ */
.vibe-button--small {
    font-size: 14px;
    padding: 8px 20px;
}

.vibe-button--medium {
    font-size: 16px;
    padding: 12px 30px;
}

.vibe-button--large {
    font-size: 18px;
    padding: 16px 40px;
}

.vibe-button--full {
    display: flex;
    width: 100%;
}

/* スタイル */
.vibe-button--solid {
    border-color: transparent;
}

.vibe-button--outline {
    background-color: transparent !important;
}

.vibe-button--gradient {
    background: linear-gradient(135deg, var(--button-color, #06c) 0, color-mix(in srgb, var(--button-color, #06c) 70%, #000) 100%);
    border-color: transparent;
}

.vibe-button--3d {
    border-bottom-width: 4px;
    border-color: color-mix(in srgb, currentColor 30%, #000);
}

.vibe-button--3d:hover {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.vibe-button--shiny {
    overflow: hidden;
    position: relative;
}

.vibe-button--shiny:after {
    animation: shiny 3s infinite;
    background: linear-gradient(90deg, transparent, hsla(0, 0%, 100%, .3), transparent);
    content: "";
    height: 100%;
    left: -100%;
    position: absolute;
    top: 0;
    width: 50%;
}

.vibe-button__text {
    position: relative;
    z-index: 1;
}

.vibe-button__subtext {
    color: #666;
    display: block;
    font-size: 12px;
    margin-top: 5px;
}

@keyframes shiny {
    0% { left: -100%; }
    20% { left: 100%; }
    to { left: 100%; }
}

/* ==========================================================================
   ボックス内リストスタイル
   ========================================================================== */
.vibe-color-box ul,
.vibe-color-box ol,
.vibe-icon-box__content ul,
.vibe-icon-box__content ol,
.vibe-caption-box__content ul,
.vibe-caption-box__content ol,
.vibe-balloon__content ul,
.vibe-balloon__content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.vibe-color-box ul,
.vibe-icon-box__content ul,
.vibe-caption-box__content ul,
.vibe-balloon__content ul {
    list-style-type: disc;
}

.vibe-color-box ol,
.vibe-icon-box__content ol,
.vibe-caption-box__content ol,
.vibe-balloon__content ol {
    list-style-type: decimal;
}

.vibe-color-box li,
.vibe-icon-box__content li,
.vibe-caption-box__content li,
.vibe-balloon__content li {
    margin: 0.3em 0;
    line-height: 1.6;
}

/* ==========================================================================
   TinyMCE エディタ固有の調整
   ========================================================================== */
/* TinyMCE body のoverflow対策 */
body.mce-content-body {
    overflow: visible !important;
    padding-top: 15px; /* キャプション用のスペース */
}

/* TinyMCE内でのボックス間の余白確保 */
.mce-content-body .vibe-balloon,
.mce-content-body .vibe-color-box,
.mce-content-body .vibe-icon-box,
.mce-content-body .vibe-caption-box,
.mce-content-body .vibe-button-wrap {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
}

/* キャプションボックスは上に余裕を持たせる */
.mce-content-body .vibe-caption-box {
    margin-top: 2em;
}

/* キャプションの表示を確実に */
.mce-content-body .vibe-caption-box {
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
}

.mce-content-body .vibe-caption-box__caption {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    clip: auto !important;
    clip-path: none !important;
}

/* wpviewラッパー対策 */
.wpview-wrap,
.mce-shim {
    overflow: visible !important;
}

/* ==========================================================================
   FAQ
   ========================================================================== */
.vibe-faq {
    margin: 1.5em 0;
}

.vibe-faq__item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.vibe-faq__item:last-child {
    margin-bottom: 0;
}

.vibe-faq__question,
.vibe-faq__answer {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
}

.vibe-faq__question {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.vibe-faq__icon {
    align-items: center;
    border-radius: 50%;
    display: flex;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 700;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.vibe-faq__icon--q {
    background: #06c;
    color: #fff;
}

.vibe-faq__icon--a {
    background: #e91e63;
    color: #fff;
}

.vibe-faq__question-text {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    line-height: 32px;
    margin: 0;
}

.vibe-faq__answer-text {
    flex: 1;
    line-height: 1.7;
    padding-top: 4px;
}

/* ==========================================================================
   ステップ
   ========================================================================== */
.vibe-step {
    --vibe-step-color: #06c;
    counter-reset: step-counter;
    margin: 1.5em 0;
}

.vibe-step-item {
    counter-increment: step-counter;
    padding-bottom: 30px;
    padding-left: 60px;
    position: relative;
}

.vibe-step-item:before {
    background: #e0e0e0;
    bottom: 0;
    content: "";
    left: 20px;
    position: absolute;
    top: 40px;
    width: 2px;
}

.vibe-step-item:last-child {
    padding-bottom: 0;
}

.vibe-step-item:last-child:before {
    display: none;
}

.vibe-step-item__header {
    align-items: center;
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.vibe-step-item__number {
    align-items: center;
    background: var(--vibe-step-color);
    border-radius: 50%;
    color: #fff;
    display: flex;
    font-size: 16px;
    font-weight: 700;
    height: 40px;
    justify-content: center;
    left: 0;
    position: absolute;
    top: 0;
    width: 40px;
}

.vibe-step-item__title {
    font-size: 18px;
    font-weight: 700;
    line-height: 40px;
}

.vibe-step-item__content {
    background: #f8f9fa;
    border-left: 3px solid var(--vibe-step-color);
    border-radius: 8px;
    padding: 20px;
}

/* ==========================================================================
   レビュー
   ========================================================================== */
.vibe-review {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    margin: 1.5em 0;
    padding: 25px;
}

.vibe-review__header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.vibe-review__info {
    flex: 1;
}

.vibe-review__title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px;
}

.vibe-review__rating {
    align-items: center;
    display: flex;
    gap: 10px;
}

.vibe-review__stars {
    display: flex;
    gap: 2px;
}

.vibe-review__star {
    color: #ddd;
    font-size: 20px;
}

.vibe-review__star.is-filled {
    color: #ffc107;
}

.vibe-review__score {
    color: #333;
    font-size: 18px;
    font-weight: 700;
}

.vibe-review__description {
    color: #666;
    line-height: 1.7;
    margin: 0 0 20px;
}

.vibe-review__pros-cons {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 20px;
}

.vibe-review__pros,
.vibe-review__cons {
    border-radius: 8px;
    padding: 15px;
}

.vibe-review__pros h4,
.vibe-review__cons h4 {
    font-size: 16px;
    margin: 0 0 10px;
}

.vibe-review__pros ul,
.vibe-review__cons ul {
    margin: 0;
    padding-left: 20px;
}

.vibe-review__pros {
    background: #e8f5e9;
}

.vibe-review__pros h4 {
    color: #2e7d32;
}

.vibe-review__cons {
    background: #ffebee;
}

.vibe-review__cons h4 {
    color: #c62828;
}

.vibe-review__cta {
    text-align: center;
}

.vibe-review__button {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-radius: 50px;
    color: #fff;
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    padding: 15px 40px;
    text-decoration: none;
}

/* ==========================================================================
   ランキング
   ========================================================================== */
.ranking-block {
    margin: 30px 0;
}

.ranking-block__title {
    background: #f8f8f8;
    border-left: 4px solid #06c;
    border-radius: 0 4px 4px 0;
    color: #333;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    padding: 10px 15px;
}

.ranking-block__items {
    display: flex;
    flex-direction: column;
}

.ranking-item {
    margin-bottom: 20px;
}

.ranking-item:last-child {
    margin-bottom: 0;
}

.ranking-item__inner {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    gap: 20px;
    padding: 20px;
    position: relative;
}

.ranking-item__rank {
    align-items: center;
    background: #666;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    color: #fff;
    display: flex;
    font-size: 16px;
    font-weight: 700;
    height: 40px;
    justify-content: center;
    left: -10px;
    position: absolute;
    top: -10px;
    width: 40px;
}

.ranking-item--gold .ranking-item__rank {
    background: linear-gradient(135deg, gold, #ffb700);
}

.ranking-item--silver .ranking-item__rank {
    background: linear-gradient(135deg, silver, #a0a0a0);
}

.ranking-item--bronze .ranking-item__rank {
    background: linear-gradient(135deg, #cd7f32, #b87333);
}

.ranking-item__content {
    flex: 1;
    min-width: 0;
    padding-left: 30px;
}

.ranking-item__name {
    color: #333;
    display: block;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px;
}

.ranking-item__description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* ==========================================================================
   リンクカード
   ========================================================================== */
/* <a>タグがある場合とない場合の両方に対応 */
.vibe-link-card,
.wp-block-vibe-link-card {
    margin: 20px 0;
    display: flex;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.vibe-link-card:hover,
.wp-block-vibe-link-card:hover {
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* <a>タグがある場合（VBボタンで挿入） */
.vibe-link-card__link {
    display: flex;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    flex: 1;
}

/* <a>タグがある場合、親のボーダーを消す */
.vibe-link-card:has(.vibe-link-card__link),
.wp-block-vibe-link-card:has(.vibe-link-card__link) {
    border: none;
    background: transparent;
    overflow: visible;
}

.vibe-link-card__link:hover {
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.vibe-link-card__image {
    width: 200px;
    min-height: 130px;
    flex-shrink: 0;
    background: #f5f5f5;
}

.vibe-link-card__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vibe-link-card__content {
    flex: 1;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.vibe-link-card__title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vibe-link-card__description {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vibe-link-card__meta {
    font-size: 12px;
    color: #999;
}

.vibe-link-card__site {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.vibe-link-card__site::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>') center / contain no-repeat;
}

/* 画像なしの場合 */
.vibe-link-card__link:not(:has(.vibe-link-card__image)) .vibe-link-card__content {
    padding: 20px 25px;
}
