/* =====================================================
  AI提示词库 - 页面样式（简化版）
  ===================================================== */

/* iframe 内需要 html 和 body 填满容器 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
}

/* 整体容器 */
.prompt-studio-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    overflow-y: auto;
    background: #f5f7fa;
    padding: 60px 20px 20px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

/* 隐藏导航栏时的容器 - iframe嵌入模式 */
.prompt-studio-container.no-navbar {
    padding: 0;
    height: 100%;
    min-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 固定头部区域 */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #f5f7fa;
    padding: 8px 20px;
    margin: 0 -20px;
}

/* 隐藏导航栏时固定头部 */
.prompt-studio-container.no-navbar .sticky-header {
    top: 0;
}

/* 搜索区域 */
.search-section {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
}

.search-input {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 22px;
    padding: 0 20px 0 44px;
    font-size: 15px;
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-input:focus {
    outline: none;
    background: white;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

/* 分类Tab */
.category-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 1200px;
    margin: 8px auto 0;
    padding-bottom: 4px;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.category-tab.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.category-tab .cat-icon {
    font-size: 16px;
}

/* 工具栏操作按钮 */
.btn-my-prompts {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid #667eea;
    border-radius: 20px;
    background: white;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    margin-left: auto;
}

.btn-my-prompts:hover {
    background: #667eea;
    color: white;
}

/* 卡片列表头部 */
.card-header {
    max-width: 1200px;
    margin: 0 auto 16px;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.list-title {
    font-size: 14px;
    color: #666;
}

.list-title strong {
    color: #667eea;
    font-size: 16px;
}

/* 我的提示词标签 */
.my-prompt-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 500;
    margin-right: 8px;
}

/* 卡片网格 */
.prompt-grid {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* 提示词卡片 */
.prompt-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.prompt-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
}

/* 卡片底部按钮（使用、复制、保存） */
.card-footer {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.card-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 8px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.card-btn i {
    font-size: 12px;
}

.use-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.use-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.copy-btn {
    background: #f0f4ff;
    color: #667eea;
}

.copy-btn:hover {
    background: #667eea;
    color: white;
}

.save-btn {
    background: #f5f5f5;
    color: #666;
}

.save-btn:hover {
    background: #ff6b6b;
    color: white;
}

.save-btn.saved {
    background: #f6ffed;
    color: #52c41a;
}

.save-btn.saved:hover {
    background: #ff6b6b;
    color: white;
}

/* 编辑按钮 */
.edit-btn {
    background: #f5f5f5;
    color: #666;
}

.edit-btn:hover {
    background: #333;
    color: white;
}

/* 删除按钮 */
.delete-btn {
    background: #fff5f5;
    color: #dc3545;
}

.delete-btn:hover {
    background: #dc3545;
    color: white;
}

/* 我的提示词按钮选中状态 */
.btn-my-prompts.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.role-tag {
    padding: 4px 10px;
    background: #f0f0f0;
    color: #666;
    border-radius: 12px;
    font-size: 12px;
}

.card-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

/* 加载更多 */
.load-more-wrapper {
    text-align: center;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.load-more-btn {
    padding: 12px 32px;
    border: 2px solid #667eea;
    border-radius: 24px;
    background: white;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-btn:hover {
    background: #667eea;
    color: white;
}

.no-more-data {
    color: #999;
    font-size: 14px;
}

/* =====================================================
  弹窗样式
  ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #f5f7fa;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #ff6b6b;
    color: white;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #eee;
    background: #f9fafb;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.form-group .required {
    color: #ff6b6b;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-hint {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fffbeb;
    border-radius: 6px;
    font-size: 13px;
    color: #92400e;
}

/* 登录提示 */
.login-prompt-content {
    text-align: center;
    padding: 20px;
}

.login-prompt-content i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.login-prompt-content p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* =====================================================
  Toast 提示
  ===================================================== */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: #333;
    color: white;
    border-radius: 30px;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 2000;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast.success .toast-icon {
    color: #52c41a;
}

.toast.error .toast-icon {
    color: #ff6b6b;
}

.toast.info .toast-icon {
    color: #1890ff;
}

.toast .toast-icon {
    font-size: 18px;
}

/* =====================================================
  按钮样式
  ===================================================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
}

.btn-secondary {
    background: #f0f4ff;
    color: #667eea;
}

.btn-secondary:hover {
    background: #e0e5ff;
}

/* =====================================================
  我的提示词弹窗
  ===================================================== */
.my-prompts-modal {
    max-width: 700px;
}

.my-prompts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.my-prompts-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.my-prompts-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 16px;
    background: #f5f5f5;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.my-prompts-tab:hover {
    background: #e9ecef;
}

.my-prompts-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-new-prompt {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-new-prompt:hover {
    background: #5a6fd6;
}

.my-prompts-content {
    max-height: 50vh;
    overflow-y: auto;
}

.my-prompt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 10px;
    background: white;
    transition: all 0.2s;
}

.my-prompt-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.my-prompt-info {
    flex: 1;
    min-width: 0;
}

.my-prompt-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.my-prompt-desc {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-prompt-actions {
    display: flex;
    gap: 8px;
}

.my-prompt-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    color: #666;
}

.my-prompt-btn:hover {
    background: #667eea;
    color: white;
}

.my-prompt-btn.danger {
    background: #fff1f0;
    color: #ff4d4f;
}

.my-prompt-btn.danger:hover {
    background: #ff4d4f;
    color: white;
}

.my-prompts-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.my-prompts-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.my-prompts-empty p {
    margin: 0 0 16px;
}

.btn-new-prompt-inline {
    padding: 10px 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: transparent;
    color: #667eea;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-new-prompt-inline:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

/* =====================================================
  加载状态
  ===================================================== */
.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: #999;
    grid-column: 1 / -1;
}

.empty-state, .error-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    grid-column: 1 / -1;
}

.error-state {
    color: #ff6b6b;
}

/* =====================================================
  响应式设计
  ===================================================== */
@media (max-width: 768px) {
    /* 隐藏导航栏 */
    .navbar, .header, header {
        display: none !important;
    }
    
    /* 移动端顶部留出空间，避免被iframe标题栏遮挡 */
    .prompt-studio-container {
        padding: 12px;
        margin-top: 0;
        /* 确保内容不被顶部区域遮挡 */
        padding-top: max(12px, env(safe-area-inset-top, 12px));
    }
    
    /* 移动端固定头部 */
    .sticky-header {
        padding: 8px 0;
        margin: 0 -12px;
        background: #f5f7fa;
    }
    
    /* 搜索区域更紧凑 */
    .search-section {
        margin-bottom: 8px;
        gap: 8px;
    }
    
    .search-input {
        height: 36px;
        font-size: 15px;
        padding: 0 12px 0 36px;
    }
    
    .search-icon {
        font-size: 14px;
        left: 12px;
    }
    
    /* 分类标签两行显示 */
    .category-tabs {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        max-width: 100%;
        margin: 8px auto 0;
        padding: 8px 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    
    .category-tab {
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 16px;
    }
    
    .btn-my-prompts {
        padding: 6px 10px;
        font-size: 13px;
        flex-shrink: 0;
    }
    
    /* 卡片列表头部 - 移动端隐藏 */
    .card-header {
        display: none;
    }
    
    .list-title {
        font-size: 13px;
    }
    
    .list-title strong {
        font-size: 15px;
    }
    
    .my-prompt-badge {
        padding: 3px 10px;
        font-size: 12px;
    }
    
    /* 卡片网格更紧凑 */
    .prompt-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .prompt-card {
        padding: 12px;
        border: 1px solid #e0e0e0;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }
    
    .card-title {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .card-roles {
        margin-bottom: 6px;
    }
    
    .role-tag {
        padding: 2px 6px;
        font-size: 11px;
    }
    
    .card-desc {
        font-size: 13px;
        margin-bottom: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .card-footer {
        padding-top: 8px;
    }
    
    .card-btn {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .card-btn i {
        font-size: 11px;
    }
    
    /* 加载更多按钮 */
    .load-more-wrapper {
        padding: 16px 0;
    }
    
    .load-more-btn {
        padding: 10px 24px;
        font-size: 13px;
    }
    
    /* 弹窗标题栏头像样式 */
    .modal-title-with-avatar {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .modal-user-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        overflow: hidden;
        background: #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #999;
    }
    
    .modal-user-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .my-prompt-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .my-prompt-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-body {
        padding: 12px;
    }
}

/* =====================================================
  提示词详情弹窗
  ===================================================== */
.prompt-detail-modal {
    max-width: 700px;
}

.detail-category {
    margin-bottom: 12px;
}

.detail-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f0f0;
    border-radius: 15px;
    font-size: 12px;
    color: #666;
}

.detail-desc {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.detail-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.detail-roles .role-tag {
    padding: 4px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 12px;
}

.detail-content {
    margin-top: 16px;
}

.detail-content label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.detail-content-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.8;
    max-height: 400px;
    overflow-y: auto;
    color: #333;
}
