/* 综合农医厨园 - 通用样式 v1.0 */
/* 配合 Tailwind CDN 使用 */

:root {
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #dcfce7;
    --accent: #ea580c;
    --accent-dark: #c2410c;
    --bg-body: #f5f7fa;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

body {
    background: var(--bg-body);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-bottom: 60px;
    -webkit-font-smoothing: antialiased;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-hover {
    transition: box-shadow 0.2s, transform 0.2s;
}
.card-hover:hover {
    box-shadow: var(--shadow-md);
}
.card-hover:active {
    transform: scale(0.98);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.article-content {
    line-height: 1.8;
    color: var(--text-secondary);
}
.article-content p { margin: 0.75rem 0; }
.article-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 1rem 0; }
.article-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.8;
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-green { background: var(--primary-light); color: var(--primary-dark); }

.msg-bubble {
    max-width: 80%;
    padding: 0.625rem 0.875rem;
    border-radius: 1.125rem;
    line-height: 1.4;
    word-break: break-word;
}
.msg-self { background: var(--primary); color: #fff; border-bottom-right-radius: 0.25rem; }
.msg-other { background: #fff; color: var(--text-secondary); border-bottom-left-radius: 0.25rem; }

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }
.drawer {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 50;
    transition: right 0.3s;
    overflow-y: auto;
}
.drawer.active { right: 0; }

.swiper-h {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    display: flex;
    -webkit-overflow-scrolling: touch;
}
.swiper-h .item {
    scroll-snap-align: start;
    flex: 0 0 100%;
}

.text-primary { color: var(--primary); }
.bg-primary { background: var(--primary); color: #fff; }
.bg-primary:hover { background: var(--primary-dark); }
.bg-body { background: var(--bg-body); }
.rounded-box { border-radius: var(--radius); }
.shadow-box { box-shadow: var(--shadow); }

/* ===== 后台表格滚动 ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 800px; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }