/**
 * 版块布局设计器样式
 */

/* 基础布局 */
.layout-designer {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 20px;
    margin-top: 20px;
    min-height: 600px;
}

.designer-left,
.designer-center,
.designer-right {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 页面选择标签 */
.page-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}

/* 组件列表 */
.widget-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.widget-item {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    user-select: none;
}

.widget-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.widget-item:active,
.widget-item.dragging {
    cursor: grabbing;
    opacity: 0.8;
    transform: rotate(2deg);
}

.widget-item .fas {
    color: #6c757d;
}

/* 布局预览区域 */
.layout-preview {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    min-height: 400px;
}

.layout-main,
.layout-sidebar {
    position: relative;
}

.layout-main::before {
    content: "主要内容区";
    position: absolute;
    top: -25px;
    left: 0;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.layout-sidebar::before {
    content: "侧边栏";
    position: absolute;
    top: -25px;
    left: 0;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* 拖放区域 */
.drop-zone {
    min-height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.drop-zone.drag-over {
    border-color: #007bff;
    background-color: #f0f8ff;
    transform: scale(1.02);
}

.drop-zone::after {
    content: attr(data-count) "个组件";
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 11px;
    color: #6c757d;
    background: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 10px;
}

.drop-zone[data-count="0"]::after,
.drop-zone:not([data-count])::after {
    display: none;
}

.drop-hint {
    text-align: center;
    color: #999;
    font-style: italic;
    margin: auto;
}

/* 已放置的组件 */
.dropped-widget {
    background: #e7f3ff;
    border: 1px solid #007bff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.dropped-widget:hover {
    background: #d1ecf1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,123,255,0.2);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.widget-name {
    font-weight: 500;
    color: #0056b3;
}

.widget-type {
    font-size: 11px;
    color: #6c757d;
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

.widget-info {
    margin-bottom: 8px;
}

.widget-info small {
    color: #6c757d;
    font-size: 11px;
}

.widget-controls {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
}

.widget-controls button {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.widget-controls .btn-config:hover {
    background: #007bff;
    color: white;
}

.widget-controls .btn-move:hover {
    background: #28a745;
    color: white;
}

.widget-controls .btn-remove:hover {
    background: #dc3545;
    color: white;
}

/* 组件设置面板 */
.widget-settings {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 200px;
    border: 1px solid #e9ecef;
}

.settings-form .form-group {
    margin-bottom: 15px;
}

.settings-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 13px;
}

.settings-form .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.settings-form .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.settings-form textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.settings-form input[type="checkbox"] {
    margin-right: 8px;
}

/* 广告位配置特殊样式 */
.settings-form label small {
    color: #6c757d;
    font-weight: normal;
    font-size: 11px;
}

.settings-form .form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.settings-form .form-text.text-muted {
    color: #6c757d;
}

/* 广告类型选择特殊样式 */
.settings-form select[onchange*="adType"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: 500;
}

.settings-form select[onchange*="adType"] option {
    background: white;
    color: #333;
}

/* Adsense配置区域 */
.settings-form input[placeholder*="ca-pub"] {
    font-family: 'Courier New', monospace;
    background: #f0f8ff;
    border-color: #4285f4;
}

.settings-form input[placeholder*="ca-pub"]:focus {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.25);
}

/* 自定义HTML文本域 */
.settings-form textarea[placeholder*="HTML"] {
    font-family: 'Courier New', monospace;
    background: #f8f8f8;
    border: 2px dashed #ddd;
    min-height: 120px;
}

.settings-form textarea[placeholder*="HTML"]:focus {
    background: #fff;
    border-style: solid;
    border-color: #007bff;
}

/* 操作按钮 */
.layout-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.layout-actions .btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 通知消息 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: #28a745;
}

.notification-error {
    background: #dc3545;
}

.notification-info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .layout-designer {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .layout-preview {
        grid-template-columns: 1fr;
    }
    
    .layout-sidebar {
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .page-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .widget-controls {
        flex-wrap: wrap;
    }
    
    .layout-actions .btn {
        padding: 12px;
        font-size: 16px;
    }
}

/* 拖拽动画效果 */
.widget-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg) scale(0.95);
}

.drop-zone.drag-over::before {
    content: "释放以添加组件";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
}

/* 加载状态 */
.loading {
    position: relative;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 10px;
    color: #495057;
}

.empty-state p {
    margin-bottom: 0;
    font-size: 14px;
} 
/* 前端布局组件样式 - 与原有样式协调 */
.widget-article-list {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.widget-article-list .article-item {
    border-bottom: 1px solid #eee;
    padding: 20px 0;
}

.widget-article-list .article-item:last-child {
    border-bottom: none;
}

.widget-article-list .article-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
}

.widget-article-list .article-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.widget-article-list .article-title a:hover {
    color: #007bff;
}

.widget-article-list .article-meta {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

.widget-article-list .meta-item {
    margin-right: 15px;
}

.widget-article-list .meta-item i {
    margin-right: 5px;
    color: #999;
}

.widget-article-list .article-excerpt {
    margin: 10px 0;
    color: #666;
    line-height: 1.6;
}

.widget-article-list .article-tags {
    margin-top: 10px;
}

.widget-article-list .tag-link {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    background: #f8f9fa;
    color: #666;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.3s;
}

.widget-article-list .tag-link:hover {
    background: #007bff;
    color: white;
}

/* 实时预览系统样式 */
.style-preview {
    background: var(--bg-color, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: var(--border-radius, 8px);
    padding: 15px;
    margin: 10px 0;
    position: relative;
    overflow: hidden;
}

.style-preview::before {
    content: '实时预览';
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 10px;
    color: var(--text-muted, #6c757d);
    background: var(--bg-color, #fff);
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 10;
}

.preview-widget {
    background: var(--bg-color, #fff);
    border: 1px solid var(--border-color, #e9ecef);
    border-radius: var(--border-radius, 6px);
    padding: var(--spacing-md, 15px);
    box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
    transition: all var(--transition-duration, 0.3s) ease;
}

.preview-widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 8px rgba(0,0,0,0.15));
}

.preview-widget .widget-title {
    margin: 0 0 10px 0;
    font-size: var(--font-size-lg, 1.1em);
    font-weight: var(--font-weight-bold, 600);
    color: var(--primary-color, #007bff);
    border-bottom: 2px solid var(--primary-color, #007bff);
    padding-bottom: 5px;
}

.preview-widget .widget-content {
    color: var(--text-color, #333);
    line-height: var(--line-height, 1.6);
}

/* 预览内容样式 */
.preview-widget .article-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-widget .article-item {
    padding: 10px;
    border: 1px solid var(--border-color, #e9ecef);
    border-radius: var(--border-radius, 4px);
    background: var(--bg-color, #fff);
    transition: all var(--transition-duration, 0.2s) ease;
}

.preview-widget .article-item:hover {
    background: var(--hover-bg, #f8f9fa);
    border-color: var(--primary-color, #007bff);
}

.preview-widget .article-title {
    margin: 0 0 5px 0;
    font-size: var(--font-size-md, 0.9em);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-color, #333);
}

.preview-widget .article-excerpt {
    margin: 5px 0;
    font-size: var(--font-size-sm, 0.85em);
    color: var(--text-muted, #6c757d);
    line-height: 1.4;
}

.preview-widget .article-meta {
    display: flex;
    gap: 10px;
    font-size: var(--font-size-xs, 0.75em);
    color: var(--text-muted, #6c757d);
}

.preview-widget .more-articles {
    text-align: center;
    color: var(--text-muted, #6c757d);
    font-style: italic;
    padding: 10px;
}

/* 分类导航预览 */
.preview-widget .category-nav {
    margin: 0;
}

.preview-widget .category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.preview-widget .category-link {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-color, #f8f9fa);
    color: var(--text-color, #333);
    text-decoration: none;
    border-radius: var(--border-radius, 4px);
    border: 1px solid var(--border-color, #dee2e6);
    transition: all var(--transition-duration, 0.2s) ease;
    font-size: var(--font-size-sm, 0.85em);
}

.preview-widget .category-link:hover {
    background: var(--primary-color, #007bff);
    color: var(--bg-color, #fff);
    border-color: var(--primary-color, #007bff);
}

/* 标签云预览 */
.preview-widget .tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preview-widget .tag-link {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-color, #f8f9fa);
    color: var(--text-color, #333);
    text-decoration: none;
    border-radius: var(--border-radius, 15px);
    font-size: var(--font-size-xs, 0.75em);
    transition: all var(--transition-duration, 0.2s) ease;
}

.preview-widget .tag-link:hover {
    background: var(--primary-color, #007bff);
    color: var(--bg-color, #fff);
}

/* 搜索框预览 */
.preview-widget .search-form {
    margin: 0;
}

.preview-widget .search-input-group {
    display: flex;
    gap: 8px;
}

.preview-widget .search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: var(--border-radius, 4px);
    font-size: var(--font-size-sm, 0.85em);
    background: var(--bg-color, #fff);
    color: var(--text-color, #333);
}

.preview-widget .search-input:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.preview-widget .search-button {
    padding: 8px 16px;
    background: var(--primary-color, #007bff);
    color: var(--bg-color, #fff);
    border: 1px solid var(--primary-color, #007bff);
    border-radius: var(--border-radius, 4px);
    font-size: var(--font-size-sm, 0.85em);
    cursor: pointer;
    transition: all var(--transition-duration, 0.2s) ease;
}

.preview-widget .search-button:hover {
    background: var(--primary-hover, #0056b3);
    border-color: var(--primary-hover, #0056b3);
}

/* 广告预览 */
.preview-widget .ad-preview {
    text-align: center;
    padding: 20px;
    background: var(--bg-color, #f8f9fa);
    border: 2px dashed var(--border-color, #dee2e6);
    border-radius: var(--border-radius, 4px);
}

.preview-widget .ad-placeholder,
.preview-widget .custom-ad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.preview-widget .ad-label {
    font-size: var(--font-size-sm, 0.85em);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-muted, #6c757d);
}

.preview-widget .ad-size,
.preview-widget .ad-content {
    font-size: var(--font-size-xs, 0.75em);
    color: var(--text-muted, #6c757d);
}

/* 自定义HTML预览 */
.preview-widget .custom-html-preview {
    text-align: center;
    padding: 15px;
    background: var(--bg-color, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: var(--border-radius, 4px);
}

.preview-widget .html-label {
    font-size: var(--font-size-sm, 0.85em);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-muted, #6c757d);
    margin-bottom: 5px;
}

.preview-widget .html-content {
    font-size: var(--font-size-xs, 0.75em);
    color: var(--text-muted, #6c757d);
}

/* 通用预览占位符 */
.preview-widget .preview-placeholder {
    text-align: center;
    padding: 20px;
    color: var(--text-muted, #6c757d);
    font-style: italic;
}

/* 响应式预览 */
@media (max-width: 768px) {
    .style-preview {
        padding: 10px;
    }
    
    .preview-widget {
        padding: var(--spacing-sm, 10px);
    }
    
    .preview-widget .category-list {
        flex-direction: column;
    }
    
    .preview-widget .search-input-group {
        flex-direction: column;
    }
    
    .preview-widget .tags-cloud {
        justify-content: center;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .style-preview {
        background: var(--bg-color, #2d3748);
        border-color: var(--border-color, #4a5568);
    }
    
    .preview-widget {
        background: var(--bg-color, #1a202c);
        border-color: var(--border-color, #2d3748);
        color: var(--text-color, #e2e8f0);
    }
    
    .preview-widget .article-item {
        background: var(--bg-color, #2d3748);
        border-color: var(--border-color, #4a5568);
    }
    
    .preview-widget .article-item:hover {
        background: var(--hover-bg, #4a5568);
    }
}

/* 区域分组样式 */
.zone-section {
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    background: #f8f9fa;
}

.zone-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #495057;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.zone-section h4::before {
    content: "📍";
    font-size: 12px;
}

.zone-section .drop-zone {
    margin: 0;
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    min-height: 120px;
}

.zone-section .drop-zone:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.zone-section .drop-zone.drag-over {
    border-color: #28a745;
    background: #f8fff8;
}

/* 隐藏旧版区域 */
.legacy-zone {
    display: none !important;
}

/* 多位置布局支持 */
.layout-main .zone-section:nth-child(1) h4::before { content: "⬆️"; }
.layout-main .zone-section:nth-child(2) h4::before { content: "➡️"; }
.layout-main .zone-section:nth-child(3) h4::before { content: "⬇️"; }

.layout-sidebar .zone-section:nth-child(1) h4::before { content: "⬆️"; }
.layout-sidebar .zone-section:nth-child(2) h4::before { content: "➡️"; }
.layout-sidebar .zone-section:nth-child(3) h4::before { content: "⬇️"; }

/* 位置提示样式 */
.zone-section .drop-hint {
    font-size: 12px;
    color: #6c757d;
    margin: 10px 0;
}
