/* ===== 共通カード（お知らせ） ===== */

.pines-notice-card {
    max-width: 900px;
    margin: 16px auto;
    padding: 12px 16px;
    border-radius: 10px;
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid #1f2937;
    box-shadow: 0 8px 16px rgba(15,23,42,0.4);
    font-size: 14px;
}
.pines-notice-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 6px;
    font-weight: 600;
}
.pines-notice-header.pine {
    color: #38bdf8;
}
.pines-notice-header.soumu {
    color: #a5b4fc;
}
.pines-notice-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34,197,94,0.8);
}
.pines-notice-body {
    margin-bottom: 8px;
    line-height: 1.5;
}
.pines-notice-status {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(15,23,42,0.9);
    border: 1px dashed #1f2937;
    font-size: 13px;
}
.pines-notice-status-title {
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.85;
}
.pines-notice-status ul {
    margin: 0;
    padding-left: 18px;
}
.pines-notice-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}
.pines-notice-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    background: #22c55e;
    color: #052e16;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}
.pines-notice-button:hover {
    background: #4ade80;
    box-shadow: 0 4px 10px rgba(34,197,94,0.5);
    transform: translateY(-1px);
}
.pines-notice-button span.icon {
    font-size: 14px;
}

/* ===== チャット全体 ===== */

.pines-chat-wrapper {
    --pines-base-font: 13px;
    max-width: 960px;
    margin: 16px auto;
    padding: 16px;
    border-radius: 12px;
    background: #020617;
    color: #e5e7eb;
    border: 1px solid #1f2937;
    font-size: var(--pines-base-font);
}

/* タイトル・説明 */
.pines-chat-title {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 18px;
}
.pines-chat-desc {
    font-size: 13px;
    margin-bottom: 8px;
    opacity: 0.8;
}
.pines-chat-mode-label {
    font-size: 12px;
    margin-bottom: 6px;
    opacity: 0.8;
}

/* 文字サイズ切替 */
.pines-chat-wrapper[data-font-size="small"] {
    --pines-base-font: 13px;
}
.pines-chat-wrapper[data-font-size="medium"] {
    --pines-base-font: 15px;
}
.pines-chat-wrapper[data-font-size="large"] {
    --pines-base-font: 17px;
}

/* テーマ: ダーク */
.pines-chat-wrapper[data-theme="dark"] {
    background: #020617;
    color: #e5e7eb;
    border-color: #1f2937;
}
.pines-chat-wrapper[data-theme="dark"] .pines-chat-messages {
    background: #020617;
    border-color: #1f2937;
}
.pines-chat-wrapper[data-theme="dark"] .pines-chat-bubble.user {
    background: #064e3b;
    color: #ecfdf5;
}
.pines-chat-wrapper[data-theme="dark"] .pines-chat-bubble.ai {
    background: #020617;
    border-color: #1f2937;
}
.pines-chat-wrapper[data-theme="dark"] textarea {
    background: #020617;
    color: #e5e7eb;
    border-color: #374151;
}
.pines-chat-wrapper[data-theme="dark"] .pines-chat-title {
    color: #f9fafb;
}

/* テーマ: ライト */
.pines-chat-wrapper[data-theme="light"] {
    background: #f9fafb;
    color: #111827;
    border-color: #d1d5db;
}
.pines-chat-wrapper[data-theme="light"] .pines-chat-messages {
    background: #ffffff;
    border-color: #e5e7eb;
}
.pines-chat-wrapper[data-theme="light"] .pines-chat-bubble.user {
    background: #d1fae5;
    color: #065f46;
}
.pines-chat-wrapper[data-theme="light"] .pines-chat-bubble.ai {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}
.pines-chat-wrapper[data-theme="light"] textarea {
    background: #ffffff;
    color: #111827;
    border-color: #d1d5db;
}
.pines-chat-wrapper[data-theme="light"] .pines-chat-status {
    color: #6b7280;
}
.pines-chat-wrapper[data-theme="light"] .pines-chat-title {
    color: #111827;
}

/* 共通パーツ */
.pines-chat-messages {
    max-height: 480px;
    overflow-y: auto;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #1f2937;
    font-size: 1em;
}
.pines-chat-message {
    margin-bottom: 8px;
}
.pines-chat-message.system {
    color: #9ca3af;
    font-style: italic;
}
.pines-chat-message.user {
    text-align: right;
}
.pines-chat-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.85em;
    margin-bottom: 2px;
}
.pines-chat-badge.user {
    background: rgba(34,197,94,0.15);
    color: #bbf7d0;
}
.pines-chat-badge.ai {
    background: rgba(56,189,248,0.15);
    color: #bae6fd;
}
.pines-chat-bubble {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    max-width: 100%;
    text-align: left;
    white-space: pre-wrap;
    border: 1px solid transparent;
}
.pines-chat-input {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.pines-chat-input textarea {
    flex: 1;
    min-height: 60px;
    max-height: 200px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #374151;
    font-size: 1em;
}
.pines-chat-input button {
    padding: 8px 14px;
    border-radius: 999px;
    border: none;
    background: #22c55e;
    color: #052e16;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.pines-chat-input button:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ツールバー */
.pines-chat-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    font-size: 0.9em;
    margin-bottom: 8px;
}
.pines-chat-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.pines-chat-toolbar select {
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    font-size: 0.9em;
}

/* ステータス＋待ち時間ギミック */
.pines-chat-status {
    margin-top: 6px;
    font-size: 0.8em;
    color: #9ca3af;
}
.pines-chat-status.thinking::before {
    content: "⏳ ";
}
.pines-chat-status.thinking {
    animation: pines-thinking-pulse 1s infinite;
}
@keyframes pines-thinking-pulse {
    0%   { opacity: 0.6; }
    50%  { opacity: 1;   }
    100% { opacity: 0.6; }
}

/* 「AI入力中…」吹き出し */
.pines-chat-message.typing .pines-chat-bubble.ai {
    opacity: 0.9;
}
.pines-chat-typing-bubble {
    min-width: 40px;
}
.pines-chat-typing-dots {
    display: inline-flex;
    gap: 4px;
}
.pines-chat-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #38bdf8;
    opacity: 0.3;
    animation: pines-typing-dots 1s infinite ease-in-out;
}
.pines-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.pines-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes pines-typing-dots {
    0%   { opacity: 0.3; transform: translateY(0); }
    40%  { opacity: 1;   transform: translateY(-2px); }
    80%  { opacity: 0.3; transform: translateY(0); }
    100% { opacity: 0.3; transform: translateY(0); }
}

/* ===== 伝言ボタン／パネル ===== */

.pines-memos-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #4b5563;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.9em;
}
.pines-memos-toggle:hover {
    background: rgba(148,163,184,0.15);
}
.pines-memos-badge {
    display: none;
    min-width: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #f9fafb;
    font-size: 0.75em;
    text-align: center;
}

/* 伝言パネル本体 */
.pines-memos-panel {
    margin-bottom: 8px;
    display: none;
}
.pines-memos-panel[aria-hidden="false"] {
    display: block;
}
.pines-memos-panel-inner {
    border-radius: 8px;
    padding: 8px;
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.9em;
}

/* テーマ別のパネル背景 */
.pines-chat-wrapper[data-theme="dark"] .pines-memos-panel-inner {
    background: #020617;
    border: 1px solid #4b5563;
}
.pines-chat-wrapper[data-theme="light"] .pines-memos-panel-inner {
    background: #ffffff;
    border: 1px solid #d1d5db;
}

.pines-memos-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
}
.pines-memos-panel-header button.pines-memos-close {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #6b7280;
    background: transparent;
    color: inherit;
    font-size: 0.8em;
    cursor: pointer;
}

.pines-memos-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pines-memos-item {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #4b5563;
}
.pines-memos-item.is-unread {
    border-color: #f97316;
    box-shadow: 0 0 0 1px rgba(249,115,22,0.3);
}
.pines-memos-item.is-read {
    opacity: 0.8;
}

.pines-memos-content {
    margin-bottom: 4px;
    white-space: pre-wrap;
}
.pines-memos-meta {
    font-size: 0.75em;
    opacity: 0.8;
    margin-bottom: 4px;
}
.pines-memos-actions {
    display: flex;
    gap: 6px;
}
.pines-memos-read-btn {
    padding: 3px 10px;
    border-radius: 999px;
    border: none;
    background: #22c55e;
    color: #052e16;
    font-size: 0.8em;
    cursor: pointer;
}
.pines-memos-read-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.pines-memos-empty,
.pines-memos-error,
.pines-memos-loading {
    font-size: 0.85em;
    opacity: 0.85;
}
.pines-memos-error {
    color: #f97316;
}
