/**
 * D5 AI 运营策略建议 — 样式表
 *
 * CSS 前缀: aos- (acquisition operation strategy)
 */

/* ═══════════════════════════════════════════════════
   页面容器
   ═══════════════════════════════════════════════════ */

.aos-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1f2937;
    background: #f9fafb;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════
   头部标题栏
   ═══════════════════════════════════════════════════ */

.aos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.aos-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aos-header-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aos-header-title-icon {
    font-size: 22px;
}

.aos-header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #6b7280;
}

.aos-generated-at {
    font-size: 12px;
    color: #9ca3af;
}

/* ═══════════════════════════════════════════════════
   来源标签
   ═══════════════════════════════════════════════════ */

.aos-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
}

.aos-source-badge--ai {
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

.aos-source-badge--rule {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* ═══════════════════════════════════════════════════
   刷新按钮
   ═══════════════════════════════════════════════════ */

.aos-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.aos-refresh-btn:hover {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.aos-refresh-btn:active {
    transform: scale(0.97);
}

.aos-refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.aos-refresh-btn .aos-refresh-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.aos-refresh-btn.is-spinning .aos-refresh-icon {
    animation: aos-spin 0.8s linear infinite;
}

@keyframes aos-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════
   摘要横幅
   ═══════════════════════════════════════════════════ */

.aos-summary-banner {
    margin: 24px 24px 0;
    padding: 20px 24px;
    background: linear-gradient(135deg, #eff6ff, #f0f9ff, #ecfdf5);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.aos-summary-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.aos-summary-label {
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.aos-summary-text {
    font-size: 15px;
    line-height: 1.7;
    color: #1e3a5f;
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════
   Tab切换栏
   ═══════════════════════════════════════════════════ */

.aos-tab-bar {
    display: flex;
    gap: 0;
    margin: 24px 24px 0;
    border-bottom: 2px solid #e5e7eb;
}

.aos-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.aos-tab:hover {
    color: #374151;
}

.aos-tab--active {
    color: #6366f1;
    border-bottom-color: #6366f1;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   筛选栏
   ═══════════════════════════════════════════════════ */

.aos-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 24px;
    flex-wrap: wrap;
}

.aos-filter-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.aos-filter-select {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    cursor: pointer;
    min-width: 120px;
}

.aos-filter-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* ═══════════════════════════════════════════════════
   策略卡片网格
   ═══════════════════════════════════════════════════ */

.aos-strategy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 24px 24px;
}

/* ═══════════════════════════════════════════════════
   策略卡片
   ═══════════════════════════════════════════════════ */

.aos-strategy-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    border-left: 4px solid transparent;
}

.aos-strategy-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* 优先级左边条 */
.aos-strategy-card--urgent {
    border-left-color: #ef4444;
}

.aos-strategy-card--high {
    border-left-color: #f59e0b;
}

.aos-strategy-card--normal {
    border-left-color: #3b82f6;
}

/* 已采纳标记 */
.aos-strategy-card--adopted {
    opacity: 0.85;
    border-left-color: #22c55e;
    background: #f9fdfb;
}

.aos-strategy-card--adopted::after {
    content: '✓ 已采纳';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #22c55e;
    padding: 2px 8px;
    background: #dcfce7;
    border-radius: 4px;
}

/* 已暂缓标记 */
.aos-strategy-card--dismissed {
    opacity: 0.65;
    border-left-color: #9ca3af;
    background: #f9fafb;
}

.aos-strategy-card--dismissed::after {
    content: '已暂缓';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    padding: 2px 8px;
    background: #f3f4f6;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════
   卡片内部元素
   ═══════════════════════════════════════════════════ */

.aos-strategy-card__category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 12px;
}

.aos-category--acquisition { background: #ecfdf5; color: #059669; }
.aos-category--conversion  { background: #eff6ff; color: #2563eb; }
.aos-category--retention   { background: #fef2f2; color: #dc2626; }
.aos-category--cost        { background: #fefce8; color: #ca8a04; }
.aos-category--channel     { background: #f5f3ff; color: #7c3aed; }
.aos-category--anomaly     { background: #fff7ed; color: #ea580c; }

.aos-strategy-card__title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    line-height: 1.4;
    padding-right: 70px; /* 给已采纳/暂缓标记留空间 */
}

.aos-strategy-card__desc {
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 12px;
}

.aos-strategy-card__impact {
    font-size: 12px;
    line-height: 1.5;
    color: #059669;
    background: #ecfdf5;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.aos-strategy-card__impact::before {
    content: '📊 预估影响：';
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   卡片操作按钮
   ═══════════════════════════════════════════════════ */

.aos-strategy-card__actions {
    display: flex;
    gap: 8px;
}

.aos-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.aos-btn--adopt {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}

.aos-btn--adopt:hover {
    background: #16a34a;
    border-color: #16a34a;
}

.aos-btn--adopt:disabled {
    background: #86efac;
    cursor: not-allowed;
}

.aos-btn--dismiss {
    background: #fff;
    color: #6b7280;
    border-color: #d1d5db;
}

.aos-btn--dismiss:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

.aos-btn--dismiss:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aos-btn--primary {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.aos-btn--primary:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

/* ═══════════════════════════════════════════════════
   历史列表（紧凑行模式）
   ═══════════════════════════════════════════════════ */

.aos-history-list {
    padding: 0 24px 24px;
}

.aos-history-group {
    margin-bottom: 20px;
}

.aos-history-group-date {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.aos-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.aos-history-item:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.aos-history-item__time {
    font-size: 12px;
    color: #9ca3af;
    min-width: 70px;
}

.aos-history-item__counts {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #6b7280;
}

.aos-history-item__counts .urgent {
    color: #ef4444;
    font-weight: 600;
}

.aos-history-item__counts .high {
    color: #f59e0b;
    font-weight: 600;
}

.aos-history-item__source {
    font-size: 11px;
    font-weight: 500;
    padding: 1px 8px;
    border-radius: 8px;
}

.aos-history-source--ai {
    background: #ede9fe;
    color: #7c3aed;
}

.aos-history-source--rule {
    background: #f3f4f6;
    color: #6b7280;
}

.aos-load-more {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #6366f1;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.aos-load-more:hover {
    background: #f5f3ff;
    border-color: #c7d2fe;
}

.aos-load-more:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   空态
   ═══════════════════════════════════════════════════ */

.aos-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.aos-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.aos-empty-text {
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 8px;
}

.aos-empty-desc {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 20px;
}

.aos-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.aos-empty-btn:hover {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ═══════════════════════════════════════════════════
   加载态 — 骨架屏
   ═══════════════════════════════════════════════════ */

.aos-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.aos-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: aos-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.aos-loading-text {
    font-size: 14px;
    color: #6b7280;
}

.aos-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 24px 24px;
}

.aos-skeleton-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    border-left: 4px solid #e5e7eb;
}

.aos-skeleton-line {
    height: 14px;
    background: #e5e7eb;
    border-radius: 4px;
    animation: aos-pulse 1.5s ease-in-out infinite;
    margin-bottom: 10px;
}

.aos-skeleton-line:nth-child(1) { width: 30%; height: 12px; }
.aos-skeleton-line:nth-child(2) { width: 70%; height: 16px; }
.aos-skeleton-line:nth-child(3) { width: 95%; height: 12px; }
.aos-skeleton-line:nth-child(4) { width: 60%; height: 12px; }
.aos-skeleton-line:nth-child(5) { width: 40%; height: 14px; margin-top: 8px; }

@keyframes aos-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════
   错误态
   ═══════════════════════════════════════════════════ */

.aos-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.aos-error-icon {
    font-size: 36px;
    color: #f87171;
    margin-bottom: 12px;
}

.aos-error-text {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════
   响应式 — 768px 断点
   ═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .aos-strategy-grid,
    .aos-skeleton-grid {
        grid-template-columns: 1fr;
    }

    .aos-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .aos-summary-banner {
        margin: 16px 16px 0;
        padding: 16px;
    }

    .aos-tab-bar {
        margin: 16px 16px 0;
    }

    .aos-filter-bar {
        margin: 12px 16px;
    }

    .aos-strategy-grid {
        padding: 0 16px 16px;
    }

    .aos-history-list {
        padding: 0 16px 16px;
    }

    .aos-strategy-card {
        padding: 16px;
    }

    .aos-strategy-card__title {
        font-size: 15px;
    }
}

/* ═══════════════════════════════════════════════════
   响应式 — 480px 断点
   ═══════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .aos-header {
        padding: 12px;
    }

    .aos-header-title {
        font-size: 17px;
    }

    .aos-summary-banner {
        margin: 12px 12px 0;
        padding: 12px;
    }

    .aos-summary-text {
        font-size: 13px;
    }

    .aos-tab-bar {
        margin: 12px 12px 0;
    }

    .aos-tab {
        padding: 8px 14px;
        font-size: 13px;
    }

    .aos-filter-bar {
        margin: 10px 12px;
        gap: 8px;
    }

    .aos-filter-select {
        font-size: 12px;
        padding: 5px 8px;
        min-width: 100px;
    }

    .aos-strategy-grid {
        padding: 0 12px 12px;
        gap: 12px;
    }

    .aos-history-list {
        padding: 0 12px 12px;
    }

    .aos-strategy-card {
        padding: 14px;
    }

    .aos-strategy-card__title {
        font-size: 14px;
        padding-right: 60px;
    }

    .aos-strategy-card__desc {
        font-size: 12px;
    }

    .aos-strategy-card__impact {
        font-size: 11px;
    }

    .aos-btn {
        font-size: 11px;
        padding: 5px 10px;
    }

    .aos-refresh-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .aos-empty {
        padding: 40px 12px;
    }

    .aos-empty-icon {
        font-size: 36px;
    }

    .aos-loading {
        padding: 40px 12px;
    }

    .aos-skeleton-grid {
        padding: 0 12px 12px;
    }
}
