/* ==============================
   工作日志总结插件 — 面板样式
   ============================== */

/* 面板容器 */
#work-log-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 500px;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e8e8e8;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

#work-log-panel.wl-visible {
    transform: translateX(0);
}

/* 暗色模式 */
[data-theme="dark"] #work-log-panel {
    background: #1e1e1e;
    border-right-color: #333;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
}

/* ---- 头部 ---- */
.wl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-header {
    border-bottom-color: #333;
}

.wl-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wl-header-icon {
    font-size: 18px;
}

.wl-header-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

[data-theme="dark"] .wl-header-title {
    color: #e0e0e0;
}

.wl-header-actions {
    display: flex;
    gap: 4px;
}

.wl-header-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.wl-header-btn:hover {
    background: #f0f0f0;
}

[data-theme="dark"] .wl-header-btn:hover {
    background: #333;
}

/* ---- 日期选择器（周视图） ---- */
.wl-date-bar {
    padding: 10px 16px 8px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-date-bar {
    border-bottom-color: #333;
}

.wl-week-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.wl-cal-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

[data-theme="dark"] .wl-cal-title {
    color: #f5f5f7;
}

.wl-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;
}

.wl-cal-nav:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #ccc;
}

.wl-cal-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

[data-theme="dark"] .wl-cal-nav {
    background: #2a2a2a;
    border-color: #444;
    color: #ccc;
}

[data-theme="dark"] .wl-cal-nav:hover:not(:disabled) {
    background: #383838;
}

.wl-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 4px;
}

.wl-cal-weekdays span {
    font-size: 12px;
    color: #86868b;
    padding: 2px 0;
}

.wl-week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.wl-cal-day {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    font-size: 13px;
    color: #1d1d1f;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.wl-cal-day:hover:not(.wl-cal-day-disabled) {
    background: #f0f0f5;
}

[data-theme="dark"] .wl-cal-day {
    color: #e5e5ea;
}

[data-theme="dark"] .wl-cal-day:hover:not(.wl-cal-day-disabled) {
    background: #3a3a3c;
}

.wl-cal-day-today {
    color: #3A6EE7;
    font-weight: 700;
    background: #EBF2FF;
}

[data-theme="dark"] .wl-cal-day-today {
    color: #5A9CFF;
    background: #1a2a44;
}

.wl-cal-day-selected {
    border-color: #3A6EE7;
    font-weight: 600;
}

[data-theme="dark"] .wl-cal-day-selected {
    border-color: #5A9CFF;
}

.wl-cal-day-disabled {
    color: #ccc;
    cursor: not-allowed;
}

[data-theme="dark"] .wl-cal-day-disabled {
    color: #48484a;
}

.wl-cal-dot {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #34C759;
}

.wl-date-display {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

[data-theme="dark"] .wl-date-display {
    color: #aaa;
}

/* ---- 统计栏 ---- */
.wl-stats-bar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-stats-bar {
    border-bottom-color: #333;
}

.wl-stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    background: #f8f9fa;
    border-radius: 8px;
    gap: 2px;
}

[data-theme="dark"] .wl-stat-item {
    background: #2a2a2a;
}

.wl-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #3A6EE7;
}

.wl-stat-label {
    font-size: 11px;
    color: #999;
}

/* ---- 操作栏 ---- */
.wl-action-bar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-action-bar {
    border-bottom-color: #333;
}

.wl-action-btn {
    flex: 1;
    height: 34px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.wl-action-btn.primary {
    background: #3A6EE7;
    color: #fff;
}

.wl-action-btn.primary:hover {
    background: #2d5bd7;
}

.wl-action-btn.primary:disabled {
    background: #a0b8e8;
    cursor: not-allowed;
}

.wl-action-btn.primary.wl-cooldown {
    background: #a0b8e8;
    cursor: not-allowed;
}

.wl-action-btn.secondary {
    background: #f0f0f0;
    color: #555;
}

.wl-action-btn.secondary:hover {
    background: #e4e4e4;
}

.wl-action-btn.secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

[data-theme="dark"] .wl-action-btn.secondary {
    background: #2a2a2a;
    color: #ccc;
}

[data-theme="dark"] .wl-action-btn.secondary:hover {
    background: #383838;
}

/* ---- 内容区域 ---- */
.wl-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-user-select: text;
    user-select: text;
    cursor: text;
}

.wl-content::-webkit-scrollbar {
    width: 4px;
}

.wl-content::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 2px;
}

[data-theme="dark"] .wl-content::-webkit-scrollbar-thumb {
    background: #444;
}

/* 空状态 */
.wl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.wl-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.wl-empty-text {
    font-size: 14px;
    text-align: center;
    line-height: 1.6;
}

.wl-empty-sub {
    font-size: 12px;
    color: #bbb;
    margin-top: 4px;
}

/* 加载状态 */
.wl-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.wl-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e8e8e8;
    border-top-color: #3A6EE7;
    border-radius: 50%;
    animation: wl-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.wl-loading-text {
    font-size: 14px;
    color: #666;
}

[data-theme="dark"] .wl-loading-text {
    color: #aaa;
}

.wl-loading-sub {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    text-align: center;
    line-height: 1.5;
}

[data-theme="dark"] .wl-loading-sub {
    color: #777;
}

/* 采集进度 */
.wl-progress-info {
    margin-top: 16px;
    width: 220px;
}

.wl-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 12px;
}

.wl-progress-label {
    color: #999;
}

[data-theme="dark"] .wl-progress-label {
    color: #777;
}

.wl-progress-value {
    font-weight: 600;
    color: #3A6EE7;
    font-variant-numeric: tabular-nums;
}

.wl-progress-bar-wrap {
    width: 100%;
    height: 4px;
    background: #e8e8e8;
    border-radius: 2px;
    margin: 6px 0 8px;
    overflow: hidden;
}

[data-theme="dark"] .wl-progress-bar-wrap {
    background: #333;
}

.wl-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3A6EE7, #5c8bf5);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* 总结内容 */
.wl-summary-section {
    margin-bottom: 16px;
}

.wl-summary-time {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-bottom: 12px;
}

.wl-summary-formatted {
    font-size: 13px;
    line-height: 1.8;
    color: #333;
}

[data-theme="dark"] .wl-summary-formatted {
    color: #ddd;
}

.wl-summary-formatted .wl-section-title {
    font-weight: 600;
    font-size: 14px;
    margin: 16px 0 8px;
    color: #1a1a1a;
}

[data-theme="dark"] .wl-summary-formatted .wl-section-title {
    color: #e0e0e0;
}

.wl-summary-formatted .wl-numbered-item {
    padding: 4px 0 4px 8px;
    border-left: 2px solid #3A6EE7;
    margin: 4px 0;
}

.wl-summary-formatted .wl-sub-item {
    padding-left: 16px;
    color: #666;
}

[data-theme="dark"] .wl-summary-formatted .wl-sub-item {
    color: #aaa;
}

.wl-summary-formatted .wl-paragraph-gap {
    height: 8px;
}

.wl-summary-formatted strong {
    color: #3A6EE7;
}

/* 错误状态 */
.wl-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    text-align: center;
}

.wl-error-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.wl-error-text {
    font-size: 14px;
    color: #e74c3c;
    margin-bottom: 6px;
}

.wl-error-detail {
    font-size: 12px;
    color: #999;
    margin-bottom: 16px;
}

.wl-retry-btn {
    padding: 6px 20px;
    border: 1px solid #3A6EE7;
    background: transparent;
    color: #3A6EE7;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.wl-retry-btn:hover {
    background: #3A6EE7;
    color: #fff;
}

/* 消息日志列表 */
.wl-msg-group {
    margin-bottom: 16px;
}

.wl-msg-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #3A6EE7;
    padding: 4px 8px;
    background: #f0f4ff;
    border-radius: 4px;
    margin-bottom: 6px;
}

[data-theme="dark"] .wl-msg-group-title {
    background: #1e2a40;
    color: #6b9bff;
}

.wl-msg-item {
    display: flex;
    gap: 8px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 4px;
}

.wl-msg-item:hover {
    background: #f8f8f8;
}

[data-theme="dark"] .wl-msg-item:hover {
    background: #2a2a2a;
}

.wl-msg-time {
    color: #999;
    flex-shrink: 0;
    font-size: 11px;
}

.wl-msg-sender {
    color: #3A6EE7;
    flex-shrink: 0;
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wl-msg-sender.mine {
    color: #27ae60;
}

.wl-msg-text {
    color: #555;
    word-break: break-all;
}

[data-theme="dark"] .wl-msg-text {
    color: #bbb;
}

/* 标签切换 */
.wl-tabs {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-tabs {
    border-bottom-color: #333;
}

.wl-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #999;
    transition: all 0.2s;
    position: relative;
}

.wl-tab.active {
    color: #3A6EE7;
    font-weight: 600;
}

.wl-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    width: 60%;
    height: 2px;
    background: #3A6EE7;
    border-radius: 1px;
}

.wl-tab:hover:not(.active) {
    color: #666;
}

/* 导航栏徽标 */
.wl-nav-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #3A6EE7;
    border-radius: 50%;
    display: none;
}

/* 底部状态栏 */
.wl-footer {
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
    font-size: 11px;
    color: #bbb;
    text-align: center;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-footer {
    border-top-color: #333;
    color: #555;
}

/* ---- 提交按钮 ---- */
.wl-action-btn.submit {
    background: #27ae60;
    color: #fff;
    flex: 0 0 80px;
}

.wl-action-btn.submit:hover {
    background: #219a52;
}

.wl-action-btn.submit:disabled {
    background: #8cc5a0;
    cursor: not-allowed;
}

/* ---- 提交确认弹窗 ---- */
.wl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.wl-modal-overlay.wl-modal-visible {
    opacity: 1;
}

.wl-modal {
    width: 520px;
    max-width: 90vw;
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.wl-modal-visible .wl-modal {
    transform: scale(1) translateY(0);
}

[data-theme="dark"] .wl-modal {
    background: #1e1e1e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.wl-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-modal-header {
    border-bottom-color: #333;
}

.wl-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

[data-theme="dark"] .wl-modal-title {
    color: #e0e0e0;
}

.wl-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: all 0.15s;
}

.wl-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

[data-theme="dark"] .wl-modal-close:hover {
    background: #333;
    color: #ccc;
}

.wl-modal-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #f8f9fa;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-modal-meta {
    background: #252525;
}

.wl-modal-date {
    font-size: 13px;
    font-weight: 500;
    color: #3A6EE7;
}

.wl-modal-hint {
    font-size: 12px;
    color: #999;
}

.wl-modal-body {
    flex: 1;
    padding: 16px 20px;
    overflow: hidden;
    display: flex;
}

.wl-modal-textarea {
    width: 100%;
    min-height: 280px;
    max-height: 50vh;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    color: #333;
    background: #fff;
}

.wl-modal-textarea:focus {
    border-color: #3A6EE7;
    box-shadow: 0 0 0 3px rgba(58, 110, 231, 0.1);
}

[data-theme="dark"] .wl-modal-textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #ddd;
}

[data-theme="dark"] .wl-modal-textarea:focus {
    border-color: #3A6EE7;
    box-shadow: 0 0 0 3px rgba(58, 110, 231, 0.2);
}

.wl-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .wl-modal-footer {
    border-top-color: #333;
}

.wl-modal-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.wl-modal-btn.cancel {
    background: #f0f0f0;
    color: #666;
}

.wl-modal-btn.cancel:hover {
    background: #e4e4e4;
}

[data-theme="dark"] .wl-modal-btn.cancel {
    background: #2a2a2a;
    color: #ccc;
}

[data-theme="dark"] .wl-modal-btn.cancel:hover {
    background: #383838;
}

.wl-modal-btn.confirm {
    background: #27ae60;
    color: #fff;
}

.wl-modal-btn.confirm:hover {
    background: #219a52;
}

.wl-modal-btn.confirm:disabled {
    background: #8cc5a0;
    cursor: not-allowed;
}

/* ---- Toast 提示 ---- */
.wl-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10002;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
}

.wl-toast.wl-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wl-toast-success {
    background: #27ae60;
    color: #fff;
}

.wl-toast-error {
    background: #e74c3c;
    color: #fff;
}

.wl-toast-info {
    background: #3A6EE7;
    color: #fff;
}
