/* ============================================
   Agent OCL - Full Page Styles
   ============================================ */

:root {
    --ocl-primary: #2e7d32;
    --ocl-primary-hover: #256b29;
    --ocl-primary-light: #e8f5e9;
    --ocl-bg: #eef1f7;
    --ocl-bg-card: #ffffff;
    --ocl-text: #1a1a1a;
    --ocl-text-muted: #6b7280;
    --ocl-text-light: #9ca3af;
    --ocl-border: #e5e7eb;
    --ocl-source-ocl: #2e7d32;
    --ocl-source-holistic: #1565c0;
    --ocl-source-pubmed: #9e9e9e;
    --ocl-promo-bg: #fffde7;
    --ocl-promo-border: #fff176;
    --ocl-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--ocl-font);
    background: var(--ocl-bg);
    color: var(--ocl-text);
    overflow-x: hidden;
}

/* ==========================================
   Hero / Welcome
   ========================================== */
.ocl-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 24px 56px;
    min-height: 100vh;
}

.ocl-hero-widget {
    display: block;
    width: 100%;
    max-width: 720px;
    height: auto;
    border-radius: 14px;
    margin-bottom: 32px;
    box-shadow: 0 14px 34px -14px rgba(26, 45, 109, 0.4);
}

.ocl-hero-title {
    font-size: 2.1em;
    font-weight: 700;
    text-align: center;
    line-height: 1.25;
    margin-bottom: 12px;
    color: var(--ocl-text);
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.ocl-hero-subtitle {
    font-size: 15px;
    color: var(--ocl-text-muted);
    text-align: center;
    max-width: 640px;
    line-height: 1.6;
    margin-bottom: 32px;
}

/* Controls (input + sources) - inline on welcome, fixed on chat */
.ocl-controls {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

#ocl-app.chat-mode .ocl-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    max-width: none;
    margin: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--ocl-border);
    padding: 16px 24px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

#ocl-app.chat-mode .ocl-controls .ocl-input-wrapper {
    max-width: 760px;
    margin: 0 auto;
}

/* Prompts section */
.ocl-prompts-section {
    width: 100%;
    max-width: 760px;
    margin: 32px auto 0;
}

.ocl-prompts-heading {
    font-size: 15px;
    font-weight: 600;
    color: var(--ocl-text-muted);
    margin-bottom: 14px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: relative;
}


.ocl-prompts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.ocl-prompt-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 1px solid var(--ocl-border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ocl-text);
    text-align: left;
    font-family: var(--ocl-font);
}

.ocl-prompt-card:hover {
    border-color: var(--ocl-primary);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.1);
    transform: translateY(-1px);
}

.ocl-prompt-emoji {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ==========================================
   Chat view
   ========================================== */
.ocl-chat-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ocl-chat-view.active {
    display: block;
}

.ocl-welcome.hidden {
    display: none;
}

.ocl-messages {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 24px 240px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* User message */
.ocl-msg-user {
    align-self: flex-end;
    max-width: 80%;
    background: var(--ocl-primary);
    color: white;
    padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
    font-size: 14px;
    line-height: 1.5;
}

/* Agent message */
.ocl-msg-agent {
    align-self: flex-start;
    max-width: 95%;
    width: 100%;
    background: white;
    border: 1px solid var(--ocl-border);
    border-radius: 16px 16px 16px 4px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.ocl-msg-agent-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ocl-text);
    padding: 0;
}

.ocl-msg-agent-text strong {
    font-weight: 600;
    color: var(--ocl-text);
}

.ocl-msg-agent-text em {
    font-style: italic;
}

.ocl-msg-agent-text ul,
.ocl-msg-agent-text ol {
    margin: 8px 0;
    padding-left: 22px;
}

.ocl-msg-agent-text li {
    margin-bottom: 4px;
    line-height: 1.6;
}

.ocl-msg-agent-text li::marker {
    color: var(--ocl-primary);
}

/* Status / typing */
.ocl-msg-status {
    align-self: flex-start;
    max-width: 95%;
    background: white;
    border: 1px solid var(--ocl-border);
    border-radius: 16px 16px 16px 4px;
    padding: 14px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    color: var(--ocl-text-muted);
    font-style: italic;
    font-size: 13px;
}

.ocl-typing-dots span {
    animation: oclBlink 1.4s infinite both;
    font-size: 16px;
}
.ocl-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ocl-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes oclBlink {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* ==========================================
   Source references (in agent response)
   ========================================== */
.ocl-sources-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--ocl-border);
}

.ocl-sources-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ocl-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.ocl-source-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ocl-source-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: white;
    border: 1px solid var(--ocl-border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s;
}

.ocl-source-card:hover {
    border-color: var(--ocl-primary);
}

.ocl-source-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ocl-source-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--ocl-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.ocl-source-card-meta {
    font-size: 11px;
    color: var(--ocl-text-muted);
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.ocl-source-card-uk {
    font-size: 11px;
    color: var(--ocl-source-holistic);
    font-weight: 500;
    text-decoration: none;
    flex-shrink: 0;
}
.ocl-source-card-uk:hover { text-decoration: underline; }

.ocl-source-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.ocl-source-badge.oczym {
    background: var(--ocl-primary-light);
    color: var(--ocl-source-ocl);
}
.ocl-source-badge.holistic {
    background: #e3f2fd;
    color: var(--ocl-source-holistic);
}
.ocl-source-badge.pubmed {
    background: #f5f5f5;
    color: var(--ocl-source-pubmed);
}

/* Promo section */
.ocl-promo-section {
    margin-top: 12px;
    padding: 10px;
    background: var(--ocl-promo-bg);
    border: 1px solid var(--ocl-promo-border);
    border-radius: 10px;
}

.ocl-promo-label {
    font-size: 11px;
    font-weight: 700;
    color: #f9a825;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ocl-promo-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ocl-promo-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #fffdf5;
    border: 1px solid var(--ocl-promo-border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ocl-promo-card:hover {
    border-color: #f9a825;
    box-shadow: 0 2px 6px rgba(249, 168, 37, 0.15);
}

.ocl-promo-card-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee;
}

.ocl-promo-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ocl-promo-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ocl-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ocl-promo-card-intro {
    font-size: 12px;
    color: var(--ocl-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ocl-promo-card-meta {
    font-size: 11px;
    color: #aaa;
    margin-top: auto;
}

/* Suggestions */
.ocl-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.ocl-suggestion-chip {
    padding: 7px 14px;
    background: white;
    border: 1px solid var(--ocl-primary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--ocl-primary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: var(--ocl-font);
}

.ocl-suggestion-chip:hover {
    background: var(--ocl-primary);
    color: white;
}

/* Show more */
.ocl-show-more {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background: var(--ocl-primary-light);
    color: var(--ocl-primary);
    border: 1px solid var(--ocl-primary);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    font-family: var(--ocl-font);
}
.ocl-show-more:hover { background: #c8e6c9; }

.ocl-no-more {
    text-align: center;
    font-size: 12px;
    color: var(--ocl-text-muted);
    padding: 8px 0;
}

/* ==========================================
   Input + sources (inside .ocl-controls)
   ========================================== */
.ocl-input-wrapper {
    width: 100%;
}

.ocl-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: white;
    border: 1.5px solid var(--ocl-border);
    border-radius: 16px;
    padding: 10px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.ocl-input-row:hover {
    border-color: #cfd4dc;
}

.ocl-input-row:focus-within {
    border-color: var(--ocl-primary);
    box-shadow: 0 2px 12px rgba(46, 125, 50, 0.12);
}

.ocl-input-row textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: var(--ocl-font);
    resize: none;
    max-height: 80px;
    line-height: 1.4;
    padding: 4px 0;
    background: transparent;
}

.ocl-input-row textarea::placeholder {
    color: var(--ocl-text-light);
}

.ocl-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ocl-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, opacity 0.15s;
}
.ocl-send-btn:hover { background: var(--ocl-primary-hover); }
.ocl-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ocl-send-btn svg { width: 18px; height: 18px; fill: white; }

/* Source toggles below input */
.ocl-bottom-sources {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.ocl-bottom-sources-label-group {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    margin-right: 2px;
}

.ocl-bottom-sources-label {
    font-size: 13px;
    color: var(--ocl-text-muted);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.ocl-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    outline: none;
    align-self: flex-start;
    margin-top: -6px;
    line-height: 1;
}

.ocl-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ocl-border);
    color: var(--ocl-text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.ocl-help:hover .ocl-help-icon,
.ocl-help:focus .ocl-help-icon {
    background: var(--ocl-primary);
    color: white;
}

.ocl-help-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1a1a1a;
    color: white;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    padding: 8px 12px;
    border-radius: 8px;
    width: max-content;
    max-width: 260px;
    white-space: normal;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    z-index: 1000;
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.ocl-help-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1a1a;
}

.ocl-help:hover .ocl-help-tooltip,
.ocl-help:focus .ocl-help-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.ocl-source-toggle {
    padding: 9px 18px;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--ocl-border);
    transition: all 0.18s ease;
    user-select: none;
    font-family: var(--ocl-font);
    background: white;
    color: var(--ocl-text);
    line-height: 1.2;
}

.ocl-source-toggle:hover {
    border-color: var(--ocl-primary);
    color: var(--ocl-primary);
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.12);
}

.ocl-source-toggle.active {
    background: var(--ocl-primary);
    color: white;
    border-color: var(--ocl-primary);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.25);
}

.ocl-source-toggle.active:hover {
    background: var(--ocl-primary-hover);
    border-color: var(--ocl-primary-hover);
}

/* Disclaimer */
.ocl-disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--ocl-text-light);
    margin-top: 12px;
    line-height: 1.4;
}

/* Copyright */
.ocl-copyright {
    margin-top: 6px;
    text-align: center;
    font-size: 11px;
    color: var(--ocl-text-light);
}
.ocl-copyright a {
    color: var(--ocl-text-muted);
    text-decoration: none;
}
.ocl-copyright a:hover { text-decoration: underline; }

/* Bottom-of-page copyright on welcome */
.ocl-copyright-welcome {
    margin-top: 32px;
}

/* Hide copyright inside controls when controls are nested in welcome */
.ocl-welcome .ocl-controls .ocl-copyright {
    display: none;
}

/* ==========================================
   Mobile
   ========================================== */
@media (max-width: 640px) {
    .ocl-prompts {
        grid-template-columns: 1fr;
    }
    .ocl-welcome {
        padding: 16px 16px 40px;
    }
    .ocl-hero-title {
        font-size: 1.3em;
        white-space: normal;
    }
    .ocl-hero-subtitle {
        margin-bottom: 32px;
    }
    .ocl-messages {
        padding: 16px 16px 240px;
    }
    #ocl-app.chat-mode .ocl-controls {
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .ocl-msg-user {
        max-width: 90%;
    }
    .ocl-source-toggle {
        padding: 8px 14px;
        font-size: 13px;
    }
    .ocl-bottom-sources {
        gap: 8px;
    }
    .ocl-source-card-body {
        flex-wrap: wrap;
        row-gap: 2px;
    }
    .ocl-source-card-title {
        white-space: normal;
        word-break: break-word;
    }
    .ocl-source-card-meta,
    .ocl-source-card-uk {
        width: 100%;
        flex-shrink: 1;
    }
}
