/* HiRizzi AI — Frontend Styles */
:root {
    --hai-primary: #1e3a5f;
    --hai-accent:  #2563eb;
    --hai-green:   #16a34a;
    --hai-border:  #e2e8f0;
    --hai-bg:      #f8fafc;
    --hai-text:    #1e293b;
    --hai-muted:   #64748b;
    --hai-radius:  12px;
}

.hai-tool { background: #fff; border: 1.5px solid var(--hai-border); border-radius: 16px; padding: 28px; margin: 24px 0; box-shadow: 0 2px 12px rgba(0,0,0,0.05); }

/* Tool header */
.hai-tool-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1.5px solid var(--hai-border); }
.hai-tool-icon   { font-size: 2rem; flex-shrink: 0; width: 52px; height: 52px; background: var(--hai-bg); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.hai-tool-title  { margin: 0 0 4px; font-size: 1.15rem; font-weight: 800; color: var(--hai-primary); }
.hai-tool-sub    { margin: 0; font-size: 0.87rem; color: var(--hai-muted); line-height: 1.5; }

/* Form */
.hai-form  { display: flex; flex-direction: column; gap: 16px; }
.hai-row   { display: flex; flex-direction: column; gap: 6px; }
.hai-row--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hai-row--3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.hai-label  { font-size: 0.83rem; font-weight: 700; color: var(--hai-text); }
.hai-input  { width: 100%; padding: 10px 14px; border: 1.5px solid var(--hai-border); border-radius: 8px; font-size: 0.9rem; box-sizing: border-box; font-family: inherit; transition: border-color 0.15s; }
.hai-input:focus { outline: none; border-color: var(--hai-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.hai-textarea { resize: vertical; min-height: 100px; }
.hai-textarea--sm { min-height: 70px; }
.hai-textarea--code { font-family: monospace; font-size: 0.83rem; min-height: 160px; }

/* Buttons */
.hai-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px; border-radius: 8px; font-size: 0.88rem; font-weight: 700; cursor: pointer; border: none; text-decoration: none; transition: all 0.18s; }
.hai-btn--primary { background: var(--hai-primary); color: #fff; }
.hai-btn--primary:hover { background: #152d4a; color: #fff; }
.hai-btn--ghost { background: transparent; color: var(--hai-primary); border: 1.5px solid var(--hai-border); }
.hai-btn--ghost:hover { border-color: var(--hai-primary); color: var(--hai-primary); }
.hai-btn--sm { padding: 7px 14px; font-size: 0.8rem; }

/* Result area */
.hai-result { margin-top: 20px; border-top: 1.5px solid var(--hai-border); padding-top: 20px; animation: haiSlideIn 0.3s ease; }
@keyframes haiSlideIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* Loading */
.hai-loading { display: flex; align-items: center; gap: 12px; color: var(--hai-muted); font-size: 0.9rem; padding: 20px 0; }
.hai-spinner { width: 20px; height: 20px; border: 2px solid var(--hai-border); border-top-color: var(--hai-accent); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Estimate card */
.hai-estimate-card { }
.hai-estimate-range { background: linear-gradient(135deg, #1e3a5f, #2563eb); color: #fff; border-radius: 12px; padding: 24px; text-align: center; margin-bottom: 20px; }
.hai-estimate-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.7); margin-bottom: 8px; }
.hai-estimate-amount { font-size: 2.2rem; font-weight: 800; margin-bottom: 12px; }
.hai-estimate-meta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hai-pill { display: inline-block; background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.hai-pill--high, .hai-pill--very.hai-pill--high { background: rgba(220,38,38,0.3); }
.hai-pill--medium { background: rgba(217,119,6,0.3); }
.hai-pill--low { background: rgba(22,163,74,0.3); }
.hai-estimate-summary { color: var(--hai-muted); font-size: 0.92rem; line-height: 1.7; margin-bottom: 20px; }
.hai-estimate-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.hai-estimate-section-title { font-size: 0.82rem; font-weight: 700; margin-bottom: 10px; color: var(--hai-text); }
.hai-estimate-list { list-style: none; padding: 0; margin: 0; }
.hai-estimate-list li { font-size: 0.85rem; padding: 5px 0; display: flex; gap: 8px; color: var(--hai-text); border-bottom: 1px solid var(--hai-border); }
.hai-estimate-list li::before { content: '✓'; color: var(--hai-green); font-weight: 700; flex-shrink: 0; }
.hai-estimate-list--warn li::before { content: '⚠'; color: #d97706; }
.hai-estimate-footer { background: var(--hai-bg); border-radius: 10px; padding: 18px; text-align: center; margin-bottom: 14px; }
.hai-estimate-footer p { margin: 0 0 14px; font-size: 0.9rem; color: var(--hai-muted); }
.hai-estimate-disclaimer { font-size: 0.75rem; color: #94a3b8; text-align: center; font-style: italic; }

/* Chat */
.hai-chat { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; max-height: 420px; overflow-y: auto; padding: 4px 0; }
.hai-chat-msg { display: flex; gap: 12px; animation: haiSlideIn 0.25s ease; }
.hai-chat-msg--user { flex-direction: row-reverse; }
.hai-chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--hai-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.hai-chat-msg--user .hai-chat-avatar { background: #475569; }
.hai-chat-bubble { max-width: 76%; background: #f1f5f9; border-radius: 12px; padding: 12px 16px; font-size: 0.88rem; line-height: 1.65; color: var(--hai-text); }
.hai-chat-msg--ai .hai-chat-bubble { background: #eff6ff; border: 1px solid #bfdbfe; }
.hai-chat-msg--user .hai-chat-bubble { background: var(--hai-primary); color: #fff; }
.hai-chat-bubble code { background: rgba(0,0,0,0.08); padding: 1px 5px; border-radius: 4px; font-size: 0.82rem; }
.hai-chat-msg--user .hai-chat-bubble code { background: rgba(255,255,255,0.2); }
.hai-chat-input-wrap { border-top: 1.5px solid var(--hai-border); padding-top: 16px; }
.hai-chat-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* Diagnostics */
.hai-diag-card { }
.hai-diag-header { margin-bottom: 16px; }
.hai-diag-severity { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.hai-diag-severity--green  { background: #d1fae5; color: #065f46; }
.hai-diag-severity--yellow { background: #fef3c7; color: #92400e; }
.hai-diag-severity--orange { background: #fed7aa; color: #9a3412; }
.hai-diag-severity--red    { background: #fee2e2; color: #991b1b; }
.hai-diag-root { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--hai-primary); }
.hai-diag-diagnosis { color: var(--hai-muted); font-size: 0.9rem; line-height: 1.7; margin-bottom: 20px; }
.hai-diag-section-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 14px; color: var(--hai-text); }
.hai-diag-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.hai-diag-step { display: flex; gap: 14px; }
.hai-diag-step-num { width: 28px; height: 28px; background: var(--hai-accent); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.82rem; flex-shrink: 0; margin-top: 2px; }
.hai-diag-step-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; color: var(--hai-text); }
.hai-diag-step-detail { font-size: 0.85rem; color: var(--hai-muted); line-height: 1.65; }
.hai-diag-prevention { background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px; padding: 12px 16px; font-size: 0.87rem; color: #166534; margin-bottom: 14px; }
.hai-diag-dev-note { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 14px 16px; font-size: 0.87rem; color: #1d4ed8; display: flex; flex-direction: column; gap: 4px; }

/* Blog writer */
.hai-blog-output-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; font-weight: 700; font-size: 0.9rem; }
.hai-blog-content { border: 1.5px solid var(--hai-border); border-radius: 8px; padding: 24px; font-size: 0.92rem; line-height: 1.8; color: var(--hai-text); }
.hai-blog-content h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; color: var(--hai-primary); }
.hai-blog-content h2 { font-size: 1.2rem; font-weight: 700; margin: 24px 0 10px; color: var(--hai-primary); }
.hai-blog-content h3 { font-size: 1rem; font-weight: 700; margin: 18px 0 8px; }
.hai-blog-content p { margin-bottom: 14px; }
.hai-blog-content ul, .hai-blog-content ol { padding-left: 20px; margin-bottom: 14px; }
.hai-blog-content li { margin-bottom: 6px; }
.hai-blog-content code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }

/* Notices */
.hai-notice { padding: 12px 16px; border-radius: 8px; font-size: 0.88rem; margin: 12px 0; }
.hai-notice--warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.hai-notice--error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

@media (max-width: 640px) {
    .hai-row--2, .hai-row--3 { grid-template-columns: 1fr; }
    .hai-estimate-cols { grid-template-columns: 1fr; }
    .hai-chat { max-height: 300px; }
    .hai-chat-bubble { max-width: 88%; }
    .hai-tool { padding: 18px; }
}
