/**
 * 通用AI文案润色组件样式
 * 可在任何页面中复用
 */

/* AI润色按钮基础样式 - 无背景图标按钮 */
.polish-btn {
    border: none;
    background: transparent;
    color: #17a2b8;
    cursor: pointer;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.polish-btn:hover {
    background: rgba(23, 162, 184, 0.1);
    color: #138496;
    transform: scale(1.1);
}

.polish-btn:disabled {
    background: transparent;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.polish-btn:active {
    transform: scale(0.95);
}

/* 输入框内按钮样式（适配不同布局） */
.input-actions .polish-btn {
    margin-right: 8px;
}

/* AI润色弹窗样式 */
.polish-popup {
    max-width: 600px;
    max-height: 70vh;
}

.polish-popup .popup-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.polish-popup .popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.polish-popup .popup-title i {
    color: #17a2b8;
    font-size: 20px;
}

.polish-popup .popup-content {
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

/* 加载状态时禁止滚动条 */
.polish-popup .polish-loading {
    text-align: center;
    padding: 40px 20px;
    overflow: hidden; /* 禁止滚动条 */
}

.polish-popup .popup-content.loading {
    overflow: hidden; /* 加载时禁止整个内容区域滚动 */
}

.polish-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.polish-option {
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.polish-option:hover {
    border-color: #17a2b8;
    background: rgba(23, 162, 184, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.2);
}

.polish-option:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.polish-option-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
    padding-right: 30px; /* 为右上角的勾选标记留空间 */
}

.polish-option-reason {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.4;
    padding-right: 30px;
}

/* 加载状态样式 */
.polish-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.polish-loading i {
    font-size: 24px;
    color: #17a2b8;
    margin-bottom: 12px;
    display: block;
    animation: polishSpin 1s linear infinite;
}

.polish-loading p {
    margin: 0;
    font-size: 14px;
}

/* 错误状态样式 */
.polish-error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    margin: 16px 0;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.polish-error i {
    font-size: 24px;
    margin-bottom: 12px;
    display: block;
}

.polish-error p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* 弹窗底部按钮样式 */
.polish-popup .popup-footer {
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-radius: 0 0 12px 12px;
}

.polish-popup .btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.polish-popup .btn-primary {
    background: #17a2b8;
    color: white;
}

.polish-popup .btn-primary:hover:not(:disabled) {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.polish-popup .btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.polish-popup .btn-secondary {
    background: transparent;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.polish-popup .btn-secondary:hover {
    background: #f8f9fa;
    color: #495057;
    border-color: #adb5bd;
}

/* 动画效果 */
@keyframes polishSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式适配 */
@media (max-width: 768px) {
    .polish-popup {
        max-width: 95vw;
        margin: 10px;
    }
    
    .polish-popup .popup-header,
    .polish-popup .popup-content,
    .polish-popup .popup-footer {
        padding: 16px;
    }
    
    .polish-option {
        padding: 12px;
    }
    
    .polish-option-text {
        font-size: 13px;
        padding-right: 25px;
    }
    
    .polish-option-reason {
        font-size: 11px;
        padding-right: 25px;
    }
    
    .polish-option.selected::before {
        width: 18px;
        height: 18px;
        font-size: 11px;
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .polish-btn span {
        display: none; /* 在小屏幕上只显示图标 */
    }
    
    .polish-btn {
        padding: 8px;
        min-width: 32px;
        justify-content: center;
    }
    
    .polish-popup .popup-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .polish-popup .btn {
        width: 100%;
    }
}

/* 深色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    .polish-popup .popup-header {
        background: #2c3e50;
        border-bottom-color: #34495e;
    }
    
    .polish-popup .popup-title {
        color: #ecf0f1;
    }
    
    .polish-popup .popup-content {
        background: #34495e;
    }
    
    .polish-option {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .polish-option:hover {
        border-color: #17a2b8;
        background: #34495e;
    }
    
    .polish-option.selected {
        background: rgba(23, 162, 184, 0.15);
    }
    
    .polish-option-text {
        color: #ecf0f1;
    }
    
    .polish-option-reason {
        color: #bdc3c7;
    }
    
    .polish-popup .popup-footer {
        background: #2c3e50;
        border-top-color: #34495e;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .polish-option {
        border-width: 3px;
    }
    
    .polish-option:hover,
    .polish-option.selected {
        border-width: 3px;
        border-color: #000;
    }
    
    .polish-popup .btn {
        border-width: 2px;
    }
}