/**
 * Paper AI Chat Styles
 *
 * Light theme consistent with AIDB site design (paper-frontend.css).
 * Covers archive listing, single chat page, shortcode embed.
 */

/* ============================================
   Common
   ============================================ */

.aidb-pchat-outer {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
    line-height: 1.8;
    color: #1a1a1a;
}

.aidb-pchat-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.aidb-pchat-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6366f1;
    background: #eef2ff;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
}

/* Link Buttons */
.aidb-pchat-link-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: opacity 0.2s;
    cursor: pointer;
    background: #6366f1;
    color: #fff;
    border: none;
}

.aidb-pchat-link-btn:hover {
    opacity: 0.85;
    color: #fff;
    text-decoration: none;
}

.aidb-pchat-link-btn--secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.aidb-pchat-link-btn--secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

.aidb-pchat-link-btn--primary {
    background: #6366f1;
    color: #fff;
}

.aidb-pchat-link-btn--primary:hover {
    opacity: 0.85;
    color: #fff;
}

.aidb-pchat-link-btn--twitter {
    background: #000;
    color: #fff;
}

.aidb-pchat-link-btn--twitter:hover {
    opacity: 0.85;
    color: #fff;
}

/* ============================================
   Archive / Listing Page
   ============================================ */

.aidb-pchat-archive-header {
    text-align: center;
    padding: 32px 32px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.aidb-pchat-archive-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 12px;
    line-height: 1.4;
}

.aidb-pchat-archive-desc {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 16px;
    line-height: 1.6;
}

/* Tier Badges */
.aidb-pchat-tier-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.aidb-pchat-tier-premium {
    background: #eef2ff;
    color: #6366f1;
    border: 1px solid #c7d2fe;
}

.aidb-pchat-tier-free {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.aidb-pchat-tier-visitor {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.aidb-pchat-tier-visitor a {
    color: #6366f1;
    text-decoration: none;
}

.aidb-pchat-tier-visitor a:hover {
    text-decoration: underline;
}

/* Card Grid */
.aidb-pchat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.aidb-pchat-card {
    display: block;
    padding: 20px 32px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.15s;
}

.aidb-pchat-card:last-child {
    border-bottom: none;
}

.aidb-pchat-card:hover {
    background: #f9fafb;
    text-decoration: none;
    color: inherit;
}

.aidb-pchat-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.aidb-pchat-card-license {
    display: inline-block;
    padding: 2px 8px;
    background: #eef2ff;
    color: #6366f1;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.aidb-pchat-card-date {
    font-size: 12px;
    color: #9ca3af;
}

.aidb-pchat-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px;
    line-height: 1.4;
}

.aidb-pchat-card-title-en {
    font-size: 12px;
    color: #9ca3af;
    margin: 0 0 8px;
    line-height: 1.4;
}

.aidb-pchat-card-summary {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 10px;
    line-height: 1.6;
}

.aidb-pchat-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.aidb-pchat-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.aidb-pchat-card-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 3px;
    font-size: 11px;
}

.aidb-pchat-card-qa-count {
    font-size: 12px;
    color: #6366f1;
    font-weight: 500;
    white-space: nowrap;
}

/* Pagination */
.aidb-pchat-pagination {
    padding: 20px 32px 32px;
    text-align: center;
}

.aidb-pchat-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.aidb-pchat-pagination li {
    display: inline-block;
}

.aidb-pchat-pagination a,
.aidb-pchat-pagination span {
    display: inline-block;
    padding: 8px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.aidb-pchat-pagination a:hover {
    background: #e5e7eb;
    text-decoration: none;
}

.aidb-pchat-pagination .current {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

/* Empty State */
.aidb-pchat-empty {
    text-align: center;
    padding: 60px 32px;
    color: #9ca3af;
}

/* ============================================
   Single Paper Chat Page
   ============================================ */

/* Breadcrumb */
.aidb-pchat-breadcrumb {
    font-size: 13px;
    padding: 16px 32px;
    color: #9ca3af;
    border-bottom: 1px solid #e5e7eb;
}

.aidb-pchat-breadcrumb a {
    color: #6366f1;
    text-decoration: none;
}

.aidb-pchat-breadcrumb a:hover {
    text-decoration: underline;
}

.aidb-pchat-breadcrumb-sep {
    margin: 0 8px;
    color: #d1d5db;
}

/* Header */
.aidb-pchat-single-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.aidb-pchat-single-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    line-height: 1.4;
}

.aidb-pchat-single-title-en {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 12px;
    line-height: 1.4;
}

.aidb-pchat-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #6b7280;
}

.aidb-pchat-meta-label {
    font-weight: 600;
    color: #4b5563;
    margin-right: 4px;
}

.aidb-pchat-license-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #eef2ff;
    color: #6366f1;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.aidb-pchat-single-tags {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.aidb-pchat-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 3px;
    font-size: 12px;
}

/* Summary Points */
.aidb-pchat-summary {
    background: #fafafa;
    padding: 16px 20px;
    border-left: 3px solid #6366f1;
    border-radius: 0 4px 4px 0;
    margin-bottom: 16px;
}

.aidb-pchat-summary-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #6366f1;
    display: inline-block;
}

.aidb-pchat-summary-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
}

.aidb-pchat-summary-list li {
    margin-bottom: 6px;
    font-size: 15px;
    line-height: 1.9;
    color: #374151;
}

.aidb-pchat-summary-list li:last-child {
    margin-bottom: 0;
}

/* Links Row */
.aidb-pchat-single-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   Chat Section
   ============================================ */

.aidb-pchat-chat-section {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
}

.aidb-pchat-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aidb-pchat-section-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px;
    line-height: 1.6;
}

.aidb-pchat-remaining {
    color: #6366f1;
    font-size: 13px;
    font-weight: 500;
}

.aidb-pchat-remaining a {
    color: #6366f1;
    text-decoration: none;
}

.aidb-pchat-remaining a:hover {
    text-decoration: underline;
}

/* Suggested Questions */
.aidb-pchat-suggestions {
    margin-bottom: 16px;
}

.aidb-pchat-suggestions-label {
    font-size: 13px;
    color: #9ca3af;
    margin: 0 0 8px;
}

.aidb-pchat-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aidb-pchat-suggestion-btn {
    display: inline-block;
    padding: 7px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    color: #4b5563;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.3;
}

.aidb-pchat-suggestion-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #6366f1;
}

.aidb-pchat-suggestion-btn:active {
    transform: scale(0.97);
}

/* Chat Input */
.aidb-pchat-input-area {
    margin-bottom: 16px;
}

.aidb-pchat-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aidb-pchat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.aidb-pchat-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.aidb-pchat-input::placeholder {
    color: #9ca3af;
}

.aidb-pchat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.aidb-pchat-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
    font-size: 16px;
}

.aidb-pchat-send-btn:hover:not(:disabled) {
    opacity: 0.85;
}

.aidb-pchat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.aidb-pchat-send-icon {
    font-size: 16px;
}

.aidb-pchat-limit-msg {
    font-size: 13px;
    color: #dc2626;
    margin: 8px 0 0;
}

/* Login Prompt */
.aidb-pchat-login-prompt {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.aidb-pchat-login-prompt p {
    color: #6b7280;
    margin: 0 0 16px;
    font-size: 14px;
}

.aidb-pchat-login-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Live Response */
.aidb-pchat-live-response {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.aidb-pchat-live-q {
    font-size: 14px;
    color: #111827;
    font-weight: 500;
    margin-bottom: 12px;
    padding-left: 12px;
    border-left: 3px solid #6366f1;
}

.aidb-pchat-live-a {
    font-size: 14px;
    color: #374151;
    line-height: 1.7;
}

.aidb-pchat-error-text {
    color: #dc2626 !important;
}

/* Thinking Animation */
.aidb-pchat-thinking {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 0;
}

.aidb-pchat-thinking span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: aidb-pchat-dot 1.4s infinite ease-in-out both;
}

.aidb-pchat-thinking span:nth-child(1) {
    animation-delay: -0.32s;
}

.aidb-pchat-thinking span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes aidb-pchat-dot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   Q&A Section
   ============================================ */

.aidb-pchat-qa-section {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
}

.aidb-pchat-qa-count {
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 10px;
    border-radius: 12px;
}

.aidb-pchat-qa-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aidb-pchat-qa-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    transition: border-color 0.2s;
}

.aidb-pchat-qa-item:hover {
    border-color: #d1d5db;
}

.aidb-pchat-qa-new {
    animation: aidb-pchat-fade-in 0.5s ease-out;
    border-color: #c7d2fe;
}

@keyframes aidb-pchat-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aidb-pchat-qa-question,
.aidb-pchat-qa-answer {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.aidb-pchat-qa-question {
    margin-bottom: 10px;
}

.aidb-pchat-qa-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    color: #374151;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.aidb-pchat-qa-icon-a {
    background: #eef2ff;
    color: #6366f1;
}

.aidb-pchat-qa-text {
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
    flex: 1;
}

.aidb-pchat-qa-question .aidb-pchat-qa-text {
    font-weight: 600;
    color: #111827;
}

.aidb-pchat-qa-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
    padding-left: 34px;
}

.aidb-pchat-qa-empty {
    text-align: center;
    padding: 32px 20px;
    color: #9ca3af;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.aidb-pchat-qa-empty p {
    margin: 0;
    font-size: 14px;
}

/* Share Section */
.aidb-pchat-share {
    text-align: center;
    padding: 24px 32px 32px;
}

/* ============================================
   Premium Gate Page
   ============================================ */

.aidb-pchat-gate {
    padding: 48px 32px;
    text-align: center;
}

.aidb-pchat-gate-inner {
    max-width: 480px;
    margin: 0 auto;
}

.aidb-pchat-gate-message {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px;
    line-height: 1.6;
}

.aidb-pchat-gate-sub {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px;
    line-height: 1.6;
}

.aidb-pchat-gate-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* ============================================
   Shortcode Embed
   ============================================ */

.aidb-pchat-shortcode {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin: 24px 0;
    color: #1a1a1a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
}

.aidb-pchat-shortcode-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.aidb-pchat-shortcode-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.aidb-pchat-shortcode-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px;
    line-height: 1.4;
}

.aidb-pchat-shortcode-title-en {
    font-size: 12px;
    color: #9ca3af;
    margin: 0 0 12px;
    line-height: 1.4;
}

.aidb-pchat-shortcode-summary {
    margin-top: 12px;
}

.aidb-pchat-shortcode-remaining {
    font-size: 12px;
    color: #6366f1;
    font-weight: 500;
    margin: 6px 0 0;
}

.aidb-pchat-limit-note {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 400;
    margin-left: 4px;
}

.aidb-pchat-shortcode-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

/* Shortcode Teaser (non-premium) */
.aidb-pchat-shortcode-teaser {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 24px;
    margin: 24px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
}

.aidb-pchat-shortcode-teaser-inner {
    text-align: center;
}

.aidb-pchat-shortcode-teaser-title {
    font-size: 16px;
    font-weight: 600;
    color: #92400e;
    margin: 0 0 8px;
}

.aidb-pchat-shortcode-teaser-desc {
    font-size: 14px;
    color: #92400e;
    margin: 0 0 16px;
    line-height: 1.5;
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 640px) {
    .aidb-pchat-outer {
        padding: 10px;
    }

    .aidb-pchat-archive-header {
        padding: 20px 16px;
    }

    .aidb-pchat-archive-title {
        font-size: 20px;
    }

    .aidb-pchat-breadcrumb {
        padding: 12px 16px;
    }

    .aidb-pchat-single-header {
        padding: 20px 16px;
    }

    .aidb-pchat-single-title {
        font-size: 20px;
    }

    .aidb-pchat-single-meta {
        flex-direction: column;
        gap: 6px;
    }

    .aidb-pchat-card {
        padding: 16px;
    }

    .aidb-pchat-card-title {
        font-size: 15px;
    }

    .aidb-pchat-chat-section,
    .aidb-pchat-qa-section {
        padding: 20px 16px;
    }

    .aidb-pchat-suggestion-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .aidb-pchat-input {
        font-size: 16px; /* Prevent iOS zoom */
    }

    .aidb-pchat-qa-item {
        padding: 12px 16px;
    }

    .aidb-pchat-single-links {
        flex-direction: column;
    }

    .aidb-pchat-link-btn {
        text-align: center;
    }

    .aidb-pchat-login-btns {
        flex-direction: column;
    }

    .aidb-pchat-share {
        padding: 20px 16px 24px;
    }

    .aidb-pchat-pagination {
        padding: 16px;
    }

    .aidb-pchat-shortcode {
        padding: 16px;
        margin: 16px 0;
    }

    .aidb-pchat-shortcode-title {
        font-size: 16px;
    }

    .aidb-pchat-shortcode-teaser {
        padding: 16px;
        margin: 16px 0;
    }
}
