/* KiviCare AI Summary Plugin — Styles */

/* ─── Panel Container ─── */
.kcais-panel {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    margin: 24px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Panel Header ─── */
.kcais-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #fff;
}

.kcais-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.kcais-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.kcais-title {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
}

.kcais-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.kcais-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.kcais-last-updated {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
}

/* ─── Buttons ─── */
.kcais-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
    white-space: nowrap;
    text-decoration: none;
}

.kcais-btn:focus { outline: 2px solid #60a5fa; outline-offset: 2px; }

.kcais-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}
.kcais-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.45);
    color: #fff;
}
.kcais-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.kcais-btn-secondary {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}
.kcais-btn-secondary:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* ─── Content Area ─── */
.kcais-content {
    padding: 24px;
    min-height: 120px;
}

/* ─── Empty State ─── */
.kcais-empty-state {
    text-align: center;
    padding: 32px 16px;
    color: #64748b;
}
.kcais-empty-icon { font-size: 48px; margin-bottom: 12px; }
.kcais-empty-state p { margin: 6px 0; }
.kcais-empty-hint { font-size: 13px; color: #94a3b8; max-width: 420px; margin: 8px auto 0; }

/* ─── Loading Spinner ─── */
.kcais-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
    color: #64748b;
}
.kcais-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: kcais-spin 0.8s linear infinite;
}
@keyframes kcais-spin { to { transform: rotate(360deg); } }

/* ─── Summary Sections Grid ─── */
.kcais-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.kcais-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow 0.15s;
}
.kcais-section:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.kcais-section-full { grid-column: 1 / -1; }

.kcais-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}
.kcais-section-icon { font-size: 16px; }

/* ─── Risk Badge ─── */
.kcais-risk-section {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
}

.kcais-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
}
.kcais-risk-bajo  { background: #dcfce7; color: #166534; }
.kcais-risk-medio { background: #fef9c3; color: #854d0e; }
.kcais-risk-alto  { background: #fee2e2; color: #991b1b; }

.kcais-risk-desc { font-size: 13px; color: #475569; line-height: 1.5; }

/* ─── Summary Text ─── */
.kcais-summary-text {
    font-size: 14px;
    color: #334155;
    line-height: 1.65;
}

/* ─── Info Grid (datos demográficos, signos vitales) ─── */
.kcais-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.kcais-info-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}

.kcais-info-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin-bottom: 3px;
}

.kcais-info-value {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

/* ─── List Items ─── */
.kcais-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kcais-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
}

.kcais-list li::before {
    content: '•';
    color: #3b82f6;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.kcais-list.kcais-list-warning li::before { color: #f59e0b; }
.kcais-list.kcais-list-danger  li::before { color: #ef4444; }

/* ─── Attention Points ─── */
.kcais-attention-item {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 3px solid #f97316;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #431407;
    line-height: 1.5;
}

/* ─── Last Visit ─── */
.kcais-last-visit-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

/* ─── Empty List State ─── */
.kcais-empty-list {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

/* ─── Disclaimer ─── */
.kcais-disclaimer {
    padding: 12px 24px;
    background: #fefce8;
    border-top: 1px solid #fde68a;
    font-size: 12px;
    color: #713f12;
    line-height: 1.5;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .kcais-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .kcais-header-actions { width: 100%; justify-content: flex-end; }
    .kcais-sections { grid-template-columns: 1fr; }
    .kcais-info-grid { grid-template-columns: 1fr 1fr; }
    .kcais-content { padding: 16px; }
}
