/* ====== 聊天记录总结插件样式 ====== */

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

/* 主容器 */
#group-ai-summary-widget {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    transition: box-shadow 0.3s;
    background: #ffffff;
}
#group-ai-summary-widget:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* 头部 */
#ai-summary-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid #e5e5e7;
}
.ai-summary-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-summary-header-title {
    font-weight: 700;
    color: #1d1d1f;
    font-size: 18px;
}
.ai-summary-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ai-summary-header-btn {
    background: #f0f0f0;
    border: none;
    color: #666;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.ai-summary-header-btn:hover {
    background: #e0e0e0;
    color: #333;
}

/* 主体 */
#ai-summary-body {
    background: #ffffff;
    border-radius: 0 0 16px 16px;
    overflow: hidden;
}

/* 工具栏 */
#ai-summary-toolbar {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f0f0f0;
}
#ai-summary-date-input {
    flex: 1;
    height: 38px;
    border: 2px solid #f0a020;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 15px;
    color: #1d1d1f;
    background: #fff;
    cursor: pointer;
    outline: none;
    font-weight: 500;
}
#ai-summary-date-input:focus {
    border-color: #3478F6;
}
.ai-summary-action-btn {
    height: 38px;
    padding: 0 16px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: #fff;
    color: #333;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.ai-summary-action-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}
.ai-summary-action-primary {
    background: #3478F6;
    color: #fff;
    border-color: #3478F6;
}
.ai-summary-action-primary:hover {
    background: #2563EB;
    border-color: #2563EB;
}

/* 周日期选择器 */
#ai-summary-week-picker {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
}
.ai-week-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ai-cal-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}
.ai-cal-nav {
    width: 28px;
    height: 28px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}
.ai-cal-nav:hover {
    background: #f5f5f5;
    border-color: #ccc;
}
.ai-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 6px;
}
.ai-cal-weekdays span {
    font-size: 12px;
    color: #86868b;
    padding: 2px 0;
}
.ai-week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.ai-cal-day {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    font-size: 14px;
    color: #1d1d1f;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.ai-cal-day:hover {
    background: #f0f0f5;
}
.ai-cal-day-empty {
    cursor: default;
}
.ai-cal-day-empty:hover {
    background: transparent;
}
.ai-cal-day-today {
    color: #3478F6;
    font-weight: 700;
    background: #EBF2FF;
}
.ai-cal-day-selected {
    border: 2px solid #3478F6;
    font-weight: 600;
}
.ai-cal-day-future {
    color: #ccc;
    cursor: default;
}
.ai-cal-day-future:hover {
    background: transparent;
}
.ai-cal-dot {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #34C759;
}

/* 日历提示 */
#ai-summary-calendar-hint {
    padding: 6px 16px;
    font-size: 12px;
    color: #86868b;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    margin: 0 16px 6px;
}
.ai-summary-hint-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34C759;
}
#ai-summary-hint-text {
    padding: 0 16px 10px;
    font-size: 12px;
    color: #86868b;
}

/* ====== Tab 栏 ====== */
#ai-summary-tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e7;
}
.ai-summary-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 14px;
    color: #86868b;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    user-select: none;
}
.ai-summary-tab:hover {
    color: #333;
}
.ai-summary-tab-active {
    color: #3478F6;
    font-weight: 600;
}
.ai-summary-tab-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2.5px;
    background: #3478F6;
    border-radius: 2px;
}

/* Tab 内容面板 */
#ai-summary-tab-content {
    position: relative;
}
.ai-summary-panel {
    min-height: 60px;
}

/* 会话信息 */
#ai-summary-group-info {
    padding: 10px 16px;
    background: #f5f5f7;
    border-bottom: 1px solid #e5e5e7;
    display: none;
}
#ai-summary-group-name {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 13px;
}
#ai-summary-msg-count {
    font-size: 11px;
    color: #86868b;
    margin-top: 2px;
}

/* 内容区域 */
#ai-summary-content {
    padding: 16px;
    color: #3c3c43;
    font-size: 13px;
    line-height: 1.7;
    max-height: 300px;
    overflow-y: auto;
}
#ai-summary-content::-webkit-scrollbar {
    width: 4px;
}
#ai-summary-content::-webkit-scrollbar-track {
    background: transparent;
}
#ai-summary-content::-webkit-scrollbar-thumb {
    background: #d1d1d6;
    border-radius: 2px;
}

/* 消息记录面板 */
#ai-summary-records-content {
    padding: 16px;
    color: #3c3c43;
    font-size: 13px;
    line-height: 1.7;
    max-height: 340px;
    overflow-y: auto;
}
#ai-summary-records-content::-webkit-scrollbar {
    width: 4px;
}
#ai-summary-records-content::-webkit-scrollbar-track {
    background: transparent;
}
#ai-summary-records-content::-webkit-scrollbar-thumb {
    background: #d1d1d6;
    border-radius: 2px;
}
.ai-records-formatted {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 12px;
    line-height: 1.8;
}
.ai-record-time {
    color: #86868b;
    font-size: 11px;
}
.ai-record-sender {
    color: #3478F6;
    font-weight: 600;
}

/* 时间戳 */
#ai-summary-time {
    padding: 8px 16px;
    font-size: 11px;
    color: #86868b;
    text-align: right;
    border-top: 1px solid #e5e5e7;
    display: none;
}

/* 占位提示 */
.ai-summary-placeholder {
    text-align: center;
    color: #86868b;
    padding: 20px 0;
}
.ai-summary-placeholder-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

/* 加载状态 */
.ai-summary-loading {
    text-align: center;
    padding: 30px 0;
}
.ai-summary-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e5e7;
    border-top-color: #3478F6;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: ai-spin 0.8s linear infinite;
}
.ai-summary-loading-text {
    color: #6e6e73;
    font-size: 13px;
}
.ai-summary-loading-subtext {
    color: #86868b;
    font-size: 11px;
    margin-top: 4px;
}

/* 空消息提示 */
.ai-summary-empty {
    text-align: center;
    color: #86868b;
    padding: 20px 0;
}
.ai-summary-empty-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

/* 错误提示 */
.ai-summary-error {
    text-align: center;
    padding: 20px 0;
}
.ai-summary-error-icon {
    font-size: 28px;
    margin-bottom: 8px;
}
.ai-summary-error-text {
    color: #FF3B30;
    font-size: 13px;
    margin-bottom: 8px;
}
.ai-summary-error-detail {
    color: #86868b;
    font-size: 11px;
    word-break: break-all;
}
.ai-summary-retry-btn {
    margin-top: 12px;
    padding: 6px 16px;
    background: linear-gradient(135deg, #3478F6, #2563EB);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.ai-summary-retry-btn:hover {
    box-shadow: 0 3px 10px rgba(52, 120, 246, 0.35);
}

/* 格式化内容 */
.ai-summary-formatted {
    padding: 2px 0;
}
.ai-summary-section-title {
    font-weight: 600;
    color: #1d1d1f;
    margin: 8px 0 2px;
}
.ai-summary-numbered-item {
    margin: 4px 0;
    padding-left: 4px;
}
.ai-summary-sub-item {
    margin: 2px 0 2px 12px;
    color: #3c3c43;
}
.ai-summary-paragraph-gap {
    margin: 4px 0;
}

/* 工具栏按钮 */
#rong-tools-ai-summary-btn {
    display: inline-block;
    border: 0;
    margin-left: 10px;
    width: 24px;
    height: 24px;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 20px 20px;
    cursor: pointer;
    padding: 0;
    vertical-align: top;
    outline: none;
    transition: transform 0.2s;
}

/* Toast 提示 */
#ai-summary-toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}
#ai-summary-toast.ai-summary-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ====== 暗色模式适配 ====== */
html[data-theme="dark"] #group-ai-summary-widget {
    background: #2c2c2e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] #group-ai-summary-widget:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] #ai-summary-header {
    border-bottom-color: #3a3a3c;
}
html[data-theme="dark"] .ai-summary-header-title {
    color: #f5f5f7;
}
html[data-theme="dark"] .ai-summary-header-btn {
    background: #3a3a3c;
    color: #ccc;
}
html[data-theme="dark"] .ai-summary-header-btn:hover {
    background: #48484a;
}
html[data-theme="dark"] #ai-summary-body {
    background: #2c2c2e;
}
html[data-theme="dark"] #ai-summary-toolbar {
    border-bottom-color: #3a3a3c;
}
html[data-theme="dark"] #ai-summary-date-input {
    background: #1c1c1e;
    color: #f5f5f7;
    border-color: #f0a020;
}
html[data-theme="dark"] .ai-summary-action-btn {
    background: #3a3a3c;
    color: #e5e5ea;
    border-color: #48484a;
}
html[data-theme="dark"] .ai-summary-action-btn:hover {
    background: #48484a;
}
html[data-theme="dark"] .ai-summary-action-primary {
    background: #3478F6;
    color: #fff;
    border-color: #3478F6;
}
html[data-theme="dark"] #ai-summary-week-picker {
    border-bottom-color: #3a3a3c;
}
html[data-theme="dark"] .ai-cal-title {
    color: #f5f5f7;
}
html[data-theme="dark"] .ai-cal-nav {
    background: #3a3a3c;
    border-color: #48484a;
    color: #ccc;
}
html[data-theme="dark"] .ai-cal-nav:hover {
    background: #48484a;
}
html[data-theme="dark"] .ai-cal-weekdays span {
    color: #86868b;
}
html[data-theme="dark"] .ai-cal-day {
    color: #e5e5ea;
}
html[data-theme="dark"] .ai-cal-day:hover {
    background: #3a3a3c;
}
html[data-theme="dark"] .ai-cal-day-today {
    color: #5A9CFF;
    background: #1a2a44;
}
html[data-theme="dark"] .ai-cal-day-selected {
    border-color: #5A9CFF;
}
html[data-theme="dark"] .ai-cal-day-future {
    color: #48484a;
}
html[data-theme="dark"] #ai-summary-calendar-hint {
    border-color: #3a3a3c;
    color: #86868b;
}
html[data-theme="dark"] #ai-summary-hint-text {
    color: #86868b;
}
html[data-theme="dark"] #ai-summary-tabs {
    border-bottom-color: #3a3a3c;
}
html[data-theme="dark"] .ai-summary-tab {
    color: #86868b;
}
html[data-theme="dark"] .ai-summary-tab:hover {
    color: #ccc;
}
html[data-theme="dark"] .ai-summary-tab-active {
    color: #5A9CFF;
}
html[data-theme="dark"] .ai-summary-tab-active::after {
    background: #5A9CFF;
}
html[data-theme="dark"] #ai-summary-group-info {
    background: #1c1c1e;
    border-bottom-color: #3a3a3c;
}
html[data-theme="dark"] #ai-summary-group-name {
    color: #f5f5f7;
}
html[data-theme="dark"] #ai-summary-msg-count {
    color: #86868b;
}
html[data-theme="dark"] #ai-summary-content {
    color: #e5e5ea;
}
html[data-theme="dark"] #ai-summary-content::-webkit-scrollbar-thumb {
    background: #48484a;
}
html[data-theme="dark"] #ai-summary-records-content {
    color: #e5e5ea;
}
html[data-theme="dark"] #ai-summary-records-content::-webkit-scrollbar-thumb {
    background: #48484a;
}
html[data-theme="dark"] .ai-record-time {
    color: #86868b;
}
html[data-theme="dark"] .ai-record-sender {
    color: #5A9CFF;
}
html[data-theme="dark"] #ai-summary-time {
    color: #86868b;
    border-top-color: #3a3a3c;
}
html[data-theme="dark"] .ai-summary-placeholder {
    color: #86868b;
}
html[data-theme="dark"] .ai-summary-loading-text {
    color: #a1a1a6;
}
html[data-theme="dark"] .ai-summary-loading-subtext {
    color: #86868b;
}
html[data-theme="dark"] .ai-summary-spinner {
    border-color: #3a3a3c;
    border-top-color: #3478F6;
}
html[data-theme="dark"] .ai-summary-empty {
    color: #86868b;
}
html[data-theme="dark"] .ai-summary-error-text {
    color: #FF3B30;
}
html[data-theme="dark"] .ai-summary-error-detail {
    color: #86868b;
}
html[data-theme="dark"] .ai-summary-retry-btn {
    box-shadow: none;
}
html[data-theme="dark"] .ai-summary-retry-btn:hover {
    box-shadow: 0 3px 10px rgba(52, 120, 246, 0.4);
}
html[data-theme="dark"] .ai-summary-section-title {
    color: #f5f5f7;
}
html[data-theme="dark"] .ai-summary-sub-item {
    color: #a1a1a6;
}
