/* ========== 绿植种植工具容器 ========== */
.pg-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f0faf4;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.pg-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.pg-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #52b788 0%, #2d6a4f 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.35);
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.pg-toolbar .toolbar-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #2d6a4f;
    transition: all 0.3s;
    white-space: nowrap;
}

.pg-toolbar .toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.pg-toolbar .toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.pg-toolbar .toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 主操作按钮金色高亮 */
.pg-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #f6c90e 0%, #e09b00 100%);
    color: #5a3e00;
    box-shadow: 0 2px 8px rgba(230, 159, 0, 0.35);
}

.pg-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffe033 0%, #f6c90e 100%);
    box-shadow: 0 4px 14px rgba(230, 159, 0, 0.5);
}

/* ========== 主内容三栏 ========== */
.pg-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f0faf4;
}

/* ========== 左侧历史面板 ========== */
.pg-history-panel {
    width: 200px;
    background: white;
    border-right: 1px solid #d1e8db;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.pg-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fafafa 0%, #f4faf7 100%);
    border-bottom: 1px solid #d1e8db;
    flex-shrink: 0;
}

.pg-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #2d6a4f;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #52b788;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.pg-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.pg-history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 10px;
    margin-bottom: 4px;
    background: #f8fdf9;
    border: 1px solid #d1e8db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.pg-history-item:hover {
    background: #eef7f1;
    border-color: #74c69d;
    transform: translateX(2px);
}

.pg-history-item.active {
    background: #dcf4e8;
    border-color: #52b788;
    border-left: 3px solid #2d6a4f;
    box-shadow: 0 1px 3px rgba(82, 183, 136, 0.2);
}

.pg-history-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
    padding-right: 22px;
}

.pg-history-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.pg-history-time {
    font-size: 11px;
    color: #b0bec5;
}

.pg-history-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: #fde8e8;
    color: #ef4444;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    line-height: 1;
}

.pg-history-item:hover .pg-history-del {
    opacity: 1;
}

.pg-history-del:hover {
    background: #ef4444;
    color: white;
}

.pg-history-empty {
    text-align: center;
    padding: 24px 12px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.8;
}

/* ========== 中间输入面板 ========== */
.pg-input-panel {
    width: 320px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #d1e8db;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pg-input-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #f4faf7 100%);
    border-bottom: 1px solid #d1e8db;
    font-size: 13px;
    font-weight: 600;
    color: #2d6a4f;
    flex-shrink: 0;
}

.pg-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 20px;
}

/* 表单组 */
.pg-form-group {
    margin-bottom: 13px;
}

.pg-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #3d7a5b;
    margin-bottom: 6px;
}

.pg-form-input,
.pg-form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1e8db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fafff8;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.pg-form-input:focus,
.pg-form-textarea:focus {
    border-color: #52b788;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.12);
}

.pg-form-textarea {
    resize: vertical;
    min-height: 66px;
}

/* Input validation error state */
.pg-form-input.is-error {
    border-color: #ef4444 !important;
    background: #fff5f5 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
    transition: all 0.2s;
}

/* 选项按钮组 */
.pg-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.pg-btn-option {
    padding: 4px 9px;
    border: 1px solid #d1e8db;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    background: #fafff8;
    color: #3d7a5b;
    transition: all 0.2s;
    user-select: none;
}

.pg-btn-option:hover {
    border-color: #40916c;
    color: #40916c;
    background: #eef7f1;
}

.pg-btn-option:focus-visible {
    outline: 2px solid #40916c;
    outline-offset: 2px;
    border-color: #40916c;
}

.pg-btn-option.active {
    border-color: #40916c;
    background: linear-gradient(135deg, #74c69d 0%, #40916c 100%);
    color: white;
    font-weight: 500;
}

/* 快捷键提示 */
.pg-shortcut-hint {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    letter-spacing: 0.2px;
}

/* textarea 字符计数 */
.pg-char-counter {
    text-align: right;
    font-size: 11px;
    color: #b0bec5;
    margin-top: 3px;
    user-select: none;
}

/* 生成按鈕 */
@keyframes pgBtnGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(64, 145, 108, 0.25); }
    50%       { box-shadow: 0 4px 22px rgba(64, 145, 108, 0.55); }
}

.pg-generate-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #52b788 0%, #2d6a4f 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.5px;
    animation: pgBtnGlow 2.4s ease-in-out infinite;
}

.pg-generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 106, 79, 0.45);
    animation: none;
}

.pg-generate-btn:active:not(:disabled) { transform: translateY(0); }

.pg-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

/* 加载动画 */
.pg-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: pgSpin 0.8s linear infinite;
    display: none;
}

.pg-generate-btn.loading .pg-spinner { display: block; }
.pg-generate-btn.loading .pg-btn-text { display: none; }

.pg-btn-loading-text { display: none; font-size: 13px; }
.pg-generate-btn.loading .pg-btn-loading-text { display: inline; }

@keyframes pgSpin { to { transform: rotate(360deg); } }

/* ========== 右侧结果面板 ========== */
.pg-result-panel {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 320px;
}

.pg-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #f4faf7 100%);
    border-bottom: 1px solid #d1e8db;
    flex-shrink: 0;
}

.pg-result-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d6a4f;
}

.pg-result-actions { display: flex; gap: 6px; }

.pg-result-action-btn {
    padding: 4px 10px;
    border: 1px solid #d1e8db;
    border-radius: 4px;
    background: white;
    font-size: 11px;
    cursor: pointer;
    color: #3d7a5b;
    transition: all 0.2s;
}

.pg-result-action-btn:hover {
    border-color: #40916c;
    color: #40916c;
    background: #eef7f1;
}

.pg-result-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 16px 28px;
}

/* ===== 空状态 ===== */
.pg-result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    text-align: center;
    gap: 12px;
}

.pg-empty-icon { font-size: 54px; opacity: 0.6; }

.pg-empty-title {
    font-size: 15px;
    font-weight: 500;
    color: #4a856a;
}

.pg-empty-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.7;
    max-width: 260px;
}

/* ===== 骨架屏 ===== */
.pg-skeleton { display: none; }
.pg-skeleton.show { display: block; }

.pg-skel-item {
    background: linear-gradient(90deg, #edf7f1 25%, #d8f0e5 50%, #edf7f1 75%);
    background-size: 200% 100%;
    animation: pgShimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}

@keyframes pgShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.pg-skel-title { height: 70px; }
.pg-skel-subtitle { height: 30px; width: 40%; }
.pg-skel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.pg-skel-card { height: 80px; margin-bottom: 0; }
.pg-skel-bar { height: 44px; }

/* ===== 结果区 ===== */
.pg-result-wrap { display: none; }
.pg-result-wrap.show {
    display: block;
    animation: pgFadeIn 0.28s ease;
}

@keyframes pgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 植物标题卡 */
.pg-plant-header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #d8f3dc 0%, #b7e4c7 100%);
    border: 1px solid #74c69d;
    border-left: 4px solid #2d6a4f;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
}

.pg-plant-emoji { font-size: 40px; flex-shrink: 0; }

.pg-plant-info { flex: 1; min-width: 0; }

.pg-plant-name {
    font-size: 18px;
    font-weight: 700;
    color: #1b4332;
    margin-bottom: 4px;
}

.pg-plant-overview {
    font-size: 12px;
    color: #40916c;
    line-height: 1.6;
}

.pg-difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(45, 106, 79, 0.1);
    color: #2d6a4f;
    border: 1px solid rgba(45, 106, 79, 0.2);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 4px;
}

/* 分区标题 */
.pg-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #2d6a4f;
    margin: 16px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #b7e4c7;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 养护要点网格 */
.pg-care-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 4px;
}

.pg-care-card {
    background: #f4faf7;
    border: 1px solid #d1e8db;
    border-top: 3px solid #52b788;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.2s;
}

.pg-care-card:hover {
    border-color: #52b788;
    box-shadow: 0 2px 8px rgba(82, 183, 136, 0.12);
    background: #edf7f1;
}

.pg-care-card-title {
    font-size: 12px;
    font-weight: 700;
    color: #2d6a4f;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pg-care-freq {
    font-size: 12px;
    font-weight: 600;
    color: #40916c;
    margin-bottom: 4px;
    background: #dcf4e8;
    border-radius: 3px;
    padding: 1px 5px;
    display: inline-block;
}

.pg-care-detail {
    font-size: 11px;
    color: #64748b;
    line-height: 1.5;
}

/* 四季养护 */
.pg-season-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}

.pg-season-card {
    background: #f4faf7;
    border: 1px solid #d1e8db;
    border-left: 4px solid #52b788;
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.2s;
}

.pg-season-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(82, 183, 136, 0.15);
    border-color: #74c69d;
}

.pg-season-name {
    font-size: 13px;
    font-weight: 700;
    color: #2d6a4f;
    margin-bottom: 5px;
}

.pg-season-tip {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
}

/* 常见问题 */
.pg-problem-list { display: flex; flex-direction: column; gap: 8px; }

.pg-problem-item {
    background: #fdf8f0;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
}

.pg-problem-name {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 4px;
}

.pg-problem-cause {
    font-size: 11px;
    color: #b45309;
    margin-bottom: 4px;
    line-height: 1.5;
}

.pg-problem-solution {
    font-size: 11px;
    color: #064e3b;
    background: #d1fae5;
    border-radius: 4px;
    padding: 4px 8px;
    line-height: 1.5;
}

.pg-problem-solution::before { content: '✅ '; }

/* 繁殖方法 */
.pg-propagation-list { display: flex; flex-direction: column; gap: 8px; }

.pg-propagation-item {
    background: #f0faf9;
    border: 1px solid #99e6d0;
    border-left: 4px solid #0d9488;
    border-radius: 8px;
    padding: 10px 14px;
}

.pg-prop-method {
    font-size: 13px;
    font-weight: 600;
    color: #0f766e;
    margin-bottom: 4px;
}

.pg-prop-steps {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 4px;
}

.pg-prop-time {
    font-size: 11px;
    color: #0f766e;
    background: #ccfbf1;
    border-radius: 3px;
    padding: 1px 7px;
    display: inline-block;
}

.pg-prop-time::before { content: '🗓 最佳时机：'; }

/* 温馨贴士 */
.pg-tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pg-tips-list li {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    padding: 7px 12px;
    background: #f4faf7;
    border-radius: 5px;
    border-left: 4px solid #74c69d;
}

.pg-tips-list li::before { content: '💡 '; }

/* ===== 错误状态 ===== */
.pg-result-error {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 32px;
}

.pg-error-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.85; }

.pg-error-msg {
    font-size: 14px;
    line-height: 1.6;
    color: #ef4444;
    max-width: 260px;
}

.pg-retry-btn {
    margin-top: 14px;
    padding: 8px 22px;
    border: 1px solid #ef4444;
    color: #ef4444;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.pg-retry-btn:hover { background: #fef2f2; }

/* ========== 示例抽屉 ========== */
.pg-drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(2px);
}

.pg-drawer-overlay.show {
    opacity: 1;
    visibility: visible;
}

.pg-example-drawer {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 10002;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.pg-example-drawer.show { right: 0; }

.pg-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #d1e8db;
    flex-shrink: 0;
    background: linear-gradient(135deg, #52b788 0%, #2d6a4f 100%);
    color: white;
}

.pg-drawer-title { font-size: 15px; font-weight: 600; }

.pg-drawer-close {
    width: 30px; height: 30px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pg-drawer-close:hover { background: rgba(255,255,255,0.3); }

.pg-drawer-body { flex: 1; overflow-y: auto; padding: 16px; }

.pg-example-card {
    border: 1px solid #d1e8db;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f4faf7;
}

.pg-example-card:hover {
    border-color: #52b788;
    background: #edf7f1;
    transform: translateX(-3px);
    box-shadow: 2px 0 8px rgba(82, 183, 136, 0.12);
}

.pg-example-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1b4332;
    margin-bottom: 6px;
}

.pg-example-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.pg-example-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: #d8f3dc;
    color: #2d6a4f;
}

.pg-example-card-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

/* ========== Toast ========== */
.pg-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pg-toast {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: pgToastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
}

.pg-toast.success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.pg-toast.error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.pg-toast.info    { background: #e0f2fe; color: #0369a1; border-left: 4px solid #0ea5e9; }

@keyframes pgToastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ========== 自定义滚动条 ========== */
.pg-history-list::-webkit-scrollbar,
.pg-input-body::-webkit-scrollbar,
.pg-result-body::-webkit-scrollbar {
    width: 4px;
}

.pg-history-list::-webkit-scrollbar-track,
.pg-input-body::-webkit-scrollbar-track,
.pg-result-body::-webkit-scrollbar-track {
    background: transparent;
}

.pg-history-list::-webkit-scrollbar-thumb,
.pg-input-body::-webkit-scrollbar-thumb,
.pg-result-body::-webkit-scrollbar-thumb {
    background: rgba(82, 183, 136, 0.35);
    border-radius: 2px;
}

.pg-history-list::-webkit-scrollbar-thumb:hover,
.pg-input-body::-webkit-scrollbar-thumb:hover,
.pg-result-body::-webkit-scrollbar-thumb:hover {
    background: rgba(64, 145, 108, 0.6);
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .pg-history-panel { width: 160px; }
    .pg-input-panel { width: 260px; }
}

@media (max-width: 700px) {
    .pg-history-panel { display: none; }
    .pg-input-panel { width: 280px; }
}
