/* ===== Groq Chatbot Styles v1.3.0 ===== */

.groq-chatbot-wrap {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 720px;
    margin: 20px auto;
    background: #fff;
}

/* ヘッダー */
.groq-chatbot-header {
    background: linear-gradient(135deg, #6B46C1, #4F46E5);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.groq-chatbot-icon {
    font-size: 22px;
}

.groq-chatbot-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex: 1;
}

/* 音読ON/OFFトグルボタン（ヘッダー内） */
.groq-tts-toggle {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.groq-tts-toggle:hover {
    background: rgba(255,255,255,0.25);
}

.groq-tts-toggle.groq-tts-on {
    background: rgba(255,255,255,0.3);
    border-color: #fff;
    font-weight: 600;
}

/* メッセージエリア */
.groq-chatbot-messages {
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 各メッセージ */
.groq-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    gap: 4px;
}

.groq-msg span {
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.6;
    word-break: break-word;
}

/* ユーザーメッセージ（右） */
.groq-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.groq-msg-user span {
    background: linear-gradient(135deg, #6B46C1, #4F46E5);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* AIメッセージ（左） */
.groq-msg-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.groq-msg-assistant span {
    background: #fff;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 音読ボタン（各メッセージの下） */
.groq-tts-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 2px 10px;
    font-size: 13px;
    cursor: pointer;
    color: #6B7280;
    transition: background 0.15s, color 0.15s;
    align-self: flex-start;
    margin-left: 4px;
}

.groq-tts-btn:hover {
    background: #f3f4f6;
    color: #6B46C1;
    border-color: #6B46C1;
}

/* ローディング */
.groq-loading span {
    color: #9ca3af !important;
}

.groq-loading span::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: groq-blink 1s infinite;
}

@keyframes groq-blink {
    0%, 100% { opacity: 0.2; }
    50%       { opacity: 1; }
}

/* 入力エリア */
.groq-chatbot-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    align-items: flex-end;
}

.groq-chatbot-input-area textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s;
    min-height: 40px;
    max-height: 120px;
}

.groq-chatbot-input-area textarea:focus {
    border-color: #6B46C1;
    box-shadow: 0 0 0 3px rgba(107,70,193,0.1);
}

.groq-chatbot-input-area button {
    background: linear-gradient(135deg, #6B46C1, #4F46E5);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap;
    height: 40px;
}

.groq-chatbot-input-area button:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.groq-chatbot-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* スクロールバー（Chrome/Edge） */
.groq-chatbot-messages::-webkit-scrollbar { width: 5px; }
.groq-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.groq-chatbot-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

/* ===== 音読トグルボタン（ヘッダー） ===== */
.groq-tts-toggle {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.groq-tts-toggle:hover {
    background: rgba(255,255,255,0.35);
}
.groq-tts-toggle.groq-tts-off {
    background: rgba(0,0,0,0.25);
    opacity: 0.7;
}

/* ===== 各メッセージの🔊ボタン ===== */
.groq-speak-btn {
    display: inline-block;
    margin-left: 8px;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.15s, transform 0.1s;
    padding: 0;
}
.groq-speak-btn:hover {
    background: #f3f4f6;
    transform: scale(1.1);
}
.groq-speak-btn.groq-speaking {
    background: #ede9fe;
    border-color: #6B46C1;
    animation: groq-pulse 1s infinite;
}
@keyframes groq-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(107,70,193,0.3); }
    50%      { box-shadow: 0 0 0 5px rgba(107,70,193,0); }
}

/* ===== ヘッダーボタン群 ===== */
.groq-header-btns {
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ===== 音読トグルボタン ===== */
.groq-tts-toggle {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.groq-tts-toggle:hover  { background: rgba(255,255,255,0.35); }
.groq-tts-toggle.groq-tts-off { background: rgba(0,0,0,0.25); opacity: 0.7; }

/* ===== 履歴リセットボタン ===== */
.groq-reset-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}
.groq-reset-btn:hover { background: rgba(220,50,50,0.5); }

/* ===== 履歴バナー ===== */
.groq-history-notice {
    display: none;
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    background: #f0f4ff;
    border: 1px dashed #c7d2fe;
    border-radius: 8px;
    padding: 6px 12px;
    margin: 6px 0 10px;
}

/* ===== 音読ボタン（各メッセージ横） ===== */
.groq-speak-btn {
    display: inline-block;
    margin-left: 8px;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.15s, transform 0.1s;
    padding: 0;
}
.groq-speak-btn:hover { background: #f3f4f6; transform: scale(1.1); }
.groq-speak-btn.groq-speaking {
    background: #ede9fe;
    border-color: #6B46C1;
    animation: groq-pulse 1s infinite;
}
@keyframes groq-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(107,70,193,0.3); }
    50%      { box-shadow: 0 0 0 5px rgba(107,70,193,0); }
}

/* ===== 楽天アフィリエイト商品カード ===== */
.groq-rakuten-wrap {
    padding: 6px 12px 10px;
}
.groq-rakuten-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.groq-rakuten-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.1s;
}
.groq-rakuten-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
    border-color: #bf0000;
}
.groq-rakuten-card img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
    background: #f9f9f9;
}
.groq-rakuten-info {
    flex: 1;
    min-width: 0;
}
.groq-rakuten-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 3px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.groq-rakuten-sub {
    font-size: 11px;
    color: #6b7280;
    margin: 0 0 2px;
}
.groq-rakuten-price {
    font-size: 13px;
    font-weight: 700;
    color: #bf0000;
    margin: 4px 0 0;
}
/* 楽天ラベル（PHPで出力）*/
.groq-rakuten-label {
    font-size: 12px;
    color: #bf0000;
    font-weight: 700;
    margin: 0 0 8px;
    padding-left: 2px;
}

/* ===== 入室画面 ===== */
.groq-entry-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.groq-entry-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.groq-entry-icon {
    font-size: 48px;
    margin-bottom: 8px;
}
.groq-entry-box h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    color: #1a1a1a;
}
.groq-entry-box p {
    font-size: 14px;
    color: #555;
    margin: 0 0 16px;
}
.groq-entry-box input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}
.groq-entry-box input:focus {
    border-color: #6B46C1;
    box-shadow: 0 0 0 3px rgba(107,70,193,0.1);
}
.groq-entry-error {
    color: #c00;
    font-size: 13px;
    min-height: 18px;
    margin: 0 0 8px !important;
}
.groq-entry-box button {
    width: 100%;
    background: linear-gradient(135deg, #6B46C1, #4F46E5);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.groq-entry-box button:hover { opacity: 0.9; }

/* ===== 楽天クレジット ===== */
.groq-rakuten-credit {
    text-align: right;
    font-size: 11px;
    padding: 4px 8px 0;
}
.groq-rakuten-credit a {
    color: #bf0000;
    text-decoration: none;
}
.groq-rakuten-credit a:hover { text-decoration: underline; }

/* ===== 楽天「もっと見る」ボタン ===== */
.groq-rakuten-more-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: #fff;
    border: 1px solid #bf0000;
    border-radius: 8px;
    color: #bf0000;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.groq-rakuten-more-btn:hover:not(:disabled) {
    background: #bf0000;
    color: #fff;
}
.groq-rakuten-more-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ===== 楽天クレジット（チャット外） ===== */
.groq-rakuten-credit-outer {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin: 4px 0 0;
    padding: 0;
}
.groq-rakuten-credit-outer a {
    color: #bf0000;
    text-decoration: none;
}
.groq-rakuten-credit-outer a:hover { text-decoration: underline; }

/* ===== カード内に「もっと見る」ボタンを収める ===== */
.groq-rakuten-wrap {
    padding: 6px 0 4px;
}
.groq-rakuten-card {
    margin-bottom: 0;
}
.groq-rakuten-more-btn {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 7px 10px;
    background: #fff;
    border: 1px solid #bf0000;
    border-radius: 0 0 10px 10px;
    color: #bf0000;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    box-sizing: border-box;
}
.groq-rakuten-more-btn:hover {
    background: #bf0000;
    color: #fff;
    text-decoration: none;
}

/* ===========================
   楽天広告エリア（チャット外）
   =========================== */
.groq-ad-area {
    position: relative;
    margin-top: 12px;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* フェードイン */
@keyframes groq-ad-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.groq-ad-fadein {
    animation: groq-ad-fadein 0.4s ease forwards;
}

/* PRラベル - 非表示 */
.groq-ad-label { display: none; }

/* 広告内のラベル（「楽天市場のおすすめ」など）*/
.groq-ad-content .groq-rakuten-label {
    margin: 0;
    padding: 10px 14px 6px;
    font-size: 12px;
    color: #666;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
}

/* 広告内カード */
.groq-ad-content .groq-rakuten-wrap {
    padding: 0;
}
.groq-ad-content .groq-rakuten-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    border-radius: 0;
    border: none;
    box-shadow: none;
    border-bottom: 1px solid #f0f0f0;
}
.groq-ad-content .groq-rakuten-card:last-of-type {
    border-bottom: none;
}
.groq-ad-content .groq-rakuten-card:hover {
    background: #fafafa;
    box-shadow: none;
    transform: none;
}
.groq-ad-content .groq-rakuten-card img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 8px;
    background: #f5f5f5;
    flex-shrink: 0;
}
.groq-ad-content .groq-rakuten-info {
    flex: 1;
    min-width: 0;
}
.groq-ad-content .groq-rakuten-title {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    margin: 0 0 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}
.groq-ad-content .groq-rakuten-sub {
    font-size: 11px;
    color: #888;
    margin: 0 0 2px;
}
.groq-ad-content .groq-rakuten-price {
    font-size: 15px;
    font-weight: 700;
    color: #bf0000;
    margin: 4px 0 0;
}

/* 「もっと見る」ボタン（広告エリア内）*/
.groq-ad-content .groq-rakuten-more-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: linear-gradient(90deg, #bf0000, #e00000);
    border: none;
    border-radius: 0 0 12px 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.2s;
    box-sizing: border-box;
    letter-spacing: 0.03em;
}
.groq-ad-content .groq-rakuten-more-btn:hover {
    opacity: 0.88;
    text-decoration: none;
    color: #fff;
}

/* チャット内の商品表示は非表示（広告エリアに移したため）*/
.groq-chatbot-messages .groq-rakuten-wrap {
    display: none;
}

/* ===== 入室フォーム 追加スタイル ===== */

/* 説明文 */
.groq-entry-desc {
    font-size: 13px;
    color: #666;
    margin: 0 0 14px;
}

/* 言語選択行 */
.groq-entry-lang-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    background: #f8f4ff;
    border: 1px solid #e9d8fd;
    border-radius: 8px;
    padding: 10px 14px;
}
.groq-entry-lang-label {
    font-size: 13px;
    font-weight: 600;
    color: #6B46C1;
    white-space: nowrap;
}
.groq-entry-lang-select {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    background: #fff;
}
.groq-entry-lang-select:focus {
    border-color: #6B46C1;
    box-shadow: 0 0 0 2px rgba(107,70,193,0.12);
}

/* ログインボタン（設定ページのラベルを使う） */
.groq-entry-login-btn {
    width: 100%;
    background: linear-gradient(135deg, #6B46C1, #4F46E5);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    letter-spacing: 0.05em;
}
.groq-entry-login-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.groq-entry-login-btn:active {
    transform: translateY(0);
}

/* ===========================
   カルーセル広告エリア
   =========================== */
.groq-ad-area {
    position: relative;
    margin-top: 12px;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ヘッダー行 */
.groq-carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
    border-bottom: 1px solid #f0f0f0;
}
.groq-carousel-label {
    font-size: 12px;
    font-weight: 700;
    color: #bf0000;
}

/* 矢印ナビ */
.groq-carousel-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}
.groq-carousel-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #bf0000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}
.groq-carousel-btn:hover { background: #fdf0f0; }

/* ドット */
.groq-carousel-dots {
    display: flex;
    gap: 4px;
}
.groq-carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: background 0.2s;
}
.groq-carousel-dot.active { background: #bf0000; }

/* スライドビューポート */
.groq-carousel-viewport {
    overflow: hidden;
    padding: 10px 12px;
}
.groq-carousel-track {
    display: flex;
    gap: 12px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* カード */
.groq-carousel-card {
    flex: 0 0 140px;
    width: 140px;
}
.groq-carousel-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.15s, transform 0.1s;
    background: #fafafa;
    height: 100%;
}
.groq-carousel-link:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    text-decoration: none;
}
.groq-carousel-link img {
    width: 100%;
    height: 110px;
    object-fit: contain;
    background: #fff;
    display: block;
}
.groq-carousel-title {
    font-size: 11px;
    color: #222;
    margin: 6px 6px 2px;
    line-height: 1.4;
    min-height: 30px;
}
.groq-carousel-price {
    font-size: 12px;
    font-weight: 700;
    color: #bf0000;
    margin: 0 6px 6px;
}

/* もっと見るリンク */
.groq-carousel-more-btn {
    display: block;
    text-align: center;
    padding: 9px;
    background: linear-gradient(90deg, #bf0000, #e00000);
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: opacity 0.2s;
    letter-spacing: 0.03em;
}
.groq-carousel-more-btn:hover { opacity: 0.88; }
