/* ==========================================================================
   AI Veterinary Treatment Planner — Design System
   Same direction as the AI Vet Drug Info plugin: Apple-grade precision +
   Notion-grade calm. Quiet neutral surface, one deliberate accent, and a
   signature "safety callout" block for the plan's own contraindication /
   uncertainty flags.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

#ai-vet-planner {
    --av-bg: #ffffff;
    --av-bg-subtle: #fafaf8;
    --av-bg-card: #f6f6f4;
    --av-border: #e6e4df;
    --av-border-strong: #d7d5cf;

    --av-text: #1c1c1a;
    --av-text-secondary: #6f6d68;
    --av-text-tertiary: #9c9a94;

    --av-accent: #16342a;
    --av-accent-hover: #204a3b;
    --av-accent-active: #0f261e;
    --av-accent-wash: rgba(22, 52, 42, 0.07);

    --av-danger: #b3261e;
    --av-danger-bg: #fdf1ef;
    --av-danger-border: #f3c9c3;

    --av-warning: #92620b;
    --av-warning-bg: #fdf6e8;
    --av-warning-border: #f0dcab;

    --av-radius-sm: 8px;
    --av-radius-md: 12px;
    --av-radius-lg: 18px;

    --av-shadow-sm: 0 1px 2px rgba(20, 20, 18, 0.04);
    --av-shadow-md: 0 2px 8px rgba(20, 20, 18, 0.05), 0 12px 32px rgba(20, 20, 18, 0.04);
    --av-shadow-lg: 0 8px 24px rgba(20, 20, 18, 0.08), 0 24px 64px rgba(20, 20, 18, 0.10);

    --av-font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    --av-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

#ai-vet-planner,
#ai-vet-modal {
    font-family: var(--av-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

#ai-vet-planner *,
#ai-vet-modal * {
    box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
    #ai-vet-planner *,
    #ai-vet-modal * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* --------------------------------------------------------------------
   Landing panel
   -------------------------------------------------------------------- */

#ai-vet-planner {
    width: 100%;
    margin: 0;
    padding: 120px 24px 140px;
    background: var(--av-bg);
    box-sizing: border-box;
    position: relative;
}

#ai-vet-title {
    text-align: center;
    max-width: 620px;
    margin: 0 auto 56px;
}

#ai-vet-title .av-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--av-accent);
    background: var(--av-accent-wash);
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 22px;
}

#ai-vet-title h2 {
    font-size: 44px;
    margin: 0 0 14px;
    color: var(--av-text);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.12;
}

#ai-vet-title p {
    font-size: 17px;
    color: var(--av-text-secondary);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.55;
    font-weight: 400;
}

/* Form */

#ai-vet-form {
    display: flex;
    flex-direction: column;
    max-width: 520px;
    margin: 0 auto;
}

#ai-vet-form label {
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--av-text);
    font-size: 13px;
    letter-spacing: 0.02em;
}

#ai-vet-form input {
    padding: 15px 18px;
    margin-bottom: 14px;
    border: 1px solid var(--av-border-strong);
    border-radius: var(--av-radius-md);
    font-size: 16px;
    font-family: var(--av-font);
    background: var(--av-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    color: var(--av-text);
}

#ai-vet-form input:hover {
    border-color: var(--av-text-tertiary);
}

#ai-vet-form input:focus {
    border-color: var(--av-accent);
    box-shadow: 0 0 0 4px var(--av-accent-wash);
}

#ai-vet-form input::placeholder {
    color: var(--av-text-tertiary);
}

#ai-vet-form button {
    padding: 15px 28px;
    background: var(--av-accent);
    color: #ffffff;
    border: none;
    border-radius: var(--av-radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--av-font);
    letter-spacing: 0.01em;
    transition: background 0.15s ease, transform 0.08s ease;
}

#ai-vet-form button:hover {
    background: var(--av-accent-hover);
}

#ai-vet-form button:active {
    background: var(--av-accent-active);
    transform: scale(0.98);
}

#ai-vet-form button:focus-visible,
#ai-vet-form input:focus-visible {
    outline: 2px solid var(--av-accent);
    outline-offset: 2px;
}

/* Inline result / error messages on the landing panel */

#ai-vet-result {
    margin: 22px auto 0;
    max-width: 520px;
    padding: 0;
    background: transparent;
}

#ai-vet-result .error {
    color: var(--av-danger);
    font-weight: 500;
    font-size: 14px;
    padding: 14px 16px;
    background: var(--av-danger-bg);
    border: 1px solid var(--av-danger-border);
    border-radius: var(--av-radius-sm);
}

#ai-vet-result .success {
    color: #1b7a4d;
    font-weight: 500;
    font-size: 14px;
    padding: 14px 16px;
    background: #eef8f2;
    border: 1px solid #cbe9d7;
    border-radius: var(--av-radius-sm);
}

/* --------------------------------------------------------------------
   Loader — quiet Apple-style spinner
   -------------------------------------------------------------------- */

#ai-vet-loader {
    position: fixed;
    inset: 0;
    background: rgba(28, 28, 26, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#ai-vet-loader .av-loader-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    padding: 18px 24px;
    border-radius: var(--av-radius-md);
    box-shadow: var(--av-shadow-lg);
    font-size: 14px;
    font-weight: 500;
    color: var(--av-text);
}

#ai-vet-loader .av-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--av-border-strong);
    border-top-color: var(--av-accent);
    border-radius: 50%;
    animation: av-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes av-spin {
    to { transform: rotate(360deg); }
}

/* Legacy fallback if markup still uses a bare <p> */
#ai-vet-loader p {
    background: #ffffff;
    padding: 16px 22px;
    border-radius: var(--av-radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--av-text);
    box-shadow: var(--av-shadow-lg);
    margin: 0;
}

/* --------------------------------------------------------------------
   Fullscreen modal
   -------------------------------------------------------------------- */

#ai-vet-modal {
    position: fixed;
    inset: 0;
    background: rgba(250, 250, 248, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: none;
    z-index: 10000;
    overflow: auto;
    animation: av-fade-in 0.22s ease;
}

@keyframes av-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#ai-vet-modal-content {
    width: 100%;
    min-height: 100vh;
    padding: 88px 0 80px;
    box-sizing: border-box;
    position: relative;
    animation: av-slide-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes av-slide-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

#ai-vet-modal-content .protocol {
    width: 100%;
    max-width: 760px;
    padding: 0 24px;
    margin: 0 auto;
    box-sizing: border-box;
    line-height: 1.7;
    color: var(--av-text);
    font-size: 16px;
}

/* Headings inside generated content */

#ai-vet-modal-content .protocol h1,
#ai-vet-modal-content .protocol h2,
#ai-vet-modal-content .protocol h3 {
    color: var(--av-text);
    font-weight: 600;
    letter-spacing: -0.015em;
}

#ai-vet-modal-content .protocol h1 {
    font-size: 34px;
    margin: 0 0 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--av-border);
    letter-spacing: -0.02em;
}

#ai-vet-modal-content .protocol h2 {
    font-size: 22px;
    margin: 44px 0 16px;
}

#ai-vet-modal-content .protocol h3 {
    font-size: 18px;
    margin: 32px 0 12px;
}

#ai-vet-modal-content .protocol p {
    margin: 0 0 18px;
    color: var(--av-text);
}

#ai-vet-modal-content .protocol ul,
#ai-vet-modal-content .protocol ol {
    margin: 0 0 20px 22px;
    padding: 0;
}

#ai-vet-modal-content .protocol li {
    margin-bottom: 10px;
    color: var(--av-text);
}

#ai-vet-modal-content .protocol strong {
    color: var(--av-text);
    font-weight: 600;
}

#ai-vet-modal-content .protocol code {
    background: var(--av-bg-card);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: var(--av-mono);
    font-size: 13.5px;
    color: var(--av-accent);
}

#ai-vet-modal-content .protocol blockquote {
    border-left: 3px solid var(--av-border-strong);
    padding-left: 18px;
    margin: 0 0 20px;
    color: var(--av-text-secondary);
}

#ai-vet-modal-content .protocol hr {
    border: none;
    border-top: 1px solid var(--av-border);
    margin: 36px 0;
}

/* --------------------------------------------------------------------
   Signature element — safety callouts
   The prompt forces explicit "❌ CONTRAINDICATED", "⚠️ Use with caution"
   and "⚠️ Uncertain / insufficient reliable data" lines. JS wraps those
   into Notion-style callout blocks so the most safety-critical
   information is also the most visually distinct.
   -------------------------------------------------------------------- */

#ai-vet-modal-content .protocol .av-callout {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--av-radius-sm);
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.55;
    border: 1px solid transparent;
    list-style: none;
}

#ai-vet-modal-content .protocol .av-callout .av-callout-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1.55;
}

#ai-vet-modal-content .protocol .av-callout .av-callout-text {
    display: block;
    margin: 0;
}

#ai-vet-modal-content .protocol .av-callout--danger {
    background: var(--av-danger-bg);
    border-color: var(--av-danger-border);
    color: #7a1a14;
}

#ai-vet-modal-content .protocol .av-callout--warning {
    background: var(--av-warning-bg);
    border-color: var(--av-warning-border);
    color: #6b4a08;
}

#ai-vet-modal-content .protocol .av-callout--uncertain {
    background: var(--av-bg-card);
    border-color: var(--av-border-strong);
    color: var(--av-text-secondary);
    font-style: italic;
}

/* Persistent "verify before use" disclaimer appended to every response */
#ai-vet-modal-content .protocol .av-disclaimer {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 40px;
    padding: 14px 16px;
    border-radius: var(--av-radius-sm);
    background: var(--av-bg-subtle);
    border: 1px solid var(--av-border);
    color: var(--av-text-secondary);
    font-size: 13.5px;
    line-height: 1.6;
}

/* --------------------------------------------------------------------
   Feedback form
   -------------------------------------------------------------------- */

#ai-vet-modal-content .protocol form {
    margin-top: 8px;
}

#ai-vet-modal-content .protocol textarea {
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--av-border-strong);
    border-radius: var(--av-radius-md);
    font-size: 15px;
    font-family: var(--av-font);
    background: var(--av-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    color: var(--av-text);
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}

#ai-vet-modal-content .protocol textarea:focus {
    border-color: var(--av-accent);
    box-shadow: 0 0 0 4px var(--av-accent-wash);
}

#ai-vet-modal-content .protocol textarea::placeholder {
    color: var(--av-text-tertiary);
}

#ai-vet-modal-content .protocol .feedback-button {
    padding: 12px 24px;
    background: var(--av-accent);
    color: #ffffff;
    border: none;
    border-radius: var(--av-radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--av-font);
    transition: background 0.15s ease, transform 0.08s ease;
}

#ai-vet-modal-content .protocol .feedback-button:hover {
    background: var(--av-accent-hover);
}

#ai-vet-modal-content .protocol .feedback-button:active {
    background: var(--av-accent-active);
    transform: scale(0.98);
}

#ai-vet-modal-content .protocol .success {
    color: #1b7a4d;
    font-weight: 500;
    font-size: 14px;
    padding: 12px 14px;
    background: #eef8f2;
    border: 1px solid #cbe9d7;
    border-radius: var(--av-radius-sm);
    margin: 0 0 12px;
}

#ai-vet-modal-content .protocol .error {
    color: var(--av-danger);
    font-weight: 500;
    font-size: 14px;
    padding: 12px 14px;
    background: var(--av-danger-bg);
    border: 1px solid var(--av-danger-border);
    border-radius: var(--av-radius-sm);
    margin: 0 0 12px;
}

/* --------------------------------------------------------------------
   Close button
   -------------------------------------------------------------------- */

#ai-vet-close {
    position: fixed;
    top: 22px;
    right: 22px;
    width: 34px;
    height: 34px;
    font-size: 18px;
    cursor: pointer;
    color: var(--av-text-secondary);
    background: #ffffff;
    border: 1px solid var(--av-border);
    border-radius: 50%;
    z-index: 10001;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--av-shadow-sm);
}

#ai-vet-close:hover {
    background: var(--av-bg-card);
    color: var(--av-text);
    border-color: var(--av-border-strong);
}

#ai-vet-close:active {
    background: var(--av-border);
}

#ai-vet-close:focus-visible {
    outline: 2px solid var(--av-accent);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------- */

@media (max-width: 1068px) {
    #ai-vet-planner {
        padding: 96px 20px 100px;
    }
}

@media (max-width: 734px) {
    #ai-vet-planner {
        padding: 72px 18px 90px;
    }

    #ai-vet-title h2 {
        font-size: 32px;
    }

    #ai-vet-title p {
        font-size: 16px;
    }

    #ai-vet-modal-content {
        padding: 76px 0 60px;
    }

    #ai-vet-modal-content .protocol {
        padding: 0 18px;
        font-size: 15.5px;
    }

    #ai-vet-modal-content .protocol h1 {
        font-size: 26px;
    }

    #ai-vet-modal-content .protocol h2 {
        font-size: 19px;
        margin-top: 36px;
    }

    #ai-vet-modal-content .protocol h3 {
        font-size: 17px;
    }

    #ai-vet-close {
        top: 14px;
        right: 14px;
    }
}

/* --------------------------------------------------------------------
   Print
   -------------------------------------------------------------------- */

@media print {
    #ai-vet-close {
        display: none;
    }

    #ai-vet-modal {
        position: static;
        background: #ffffff;
        backdrop-filter: none;
    }

    #ai-vet-modal-content .protocol {
        padding: 0 20px;
        max-width: 100%;
    }

    #ai-vet-modal-content .protocol form {
        display: none;
    }
}