/* ===========================================
   抖音卡片H5页面样式 - 黑白风格
   =========================================== */

/* 全局设置 - 防止横向溢出 */
.douyin-page *,
.douyin-page *::before,
.douyin-page *::after {
    box-sizing: border-box;
    max-width: 100%;
}

/* 页面容器 - 使用固定定位完全脱离文档流 */
.page.douyin-page {
    /* 使用固定定位，不受父元素padding影响 */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100vw !important; /* 防止横向溢出 */
    
    /* 样式 */
    background: #f5f5f5 !important;
    overflow-x: hidden !important; /* 禁止横向滚动 */
    overflow-y: auto !important;
    padding: 0 !important;
    padding-bottom: 120px !important; /* 优化底部间距，减少空白区域 */
    margin: 0 !important;
    
    /* 布局 */
    display: flex !important;
    flex-direction: column !important;
    
    /* 层级 */
    z-index: 999 !important;
}

/* 隐藏状态 */
.page.douyin-page {
    display: none !important;
}

/* 显示状态 */
.page.douyin-page.active {
    display: flex !important;
}

/* 页面头部 */
.douyin-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    padding: 12px 16px;
    margin: 0 !important; /* 确保头部没有外边距 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0; /* 防止头部被压缩 */
}

/* 微信浏览器特殊处理 - 移除顶部空白 */
.douyin-page .douyin-header:first-child {
    margin-top: 0 !important;
    padding-top: 12px !important;
}

.back-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f5f5f5;
    border: none;
    color: #333;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #e5e5e5;
}

.douyin-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.header-placeholder {
    width: 36px;
}

/* 主容器 */
.douyin-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    flex: 1; /* 占据剩余空间 */
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* 防止内容横向溢出 */
}

/* 表单 */
.douyin-form {
    background: transparent;
}

/* 表单组 */
.douyin-form-group {
    margin-bottom: 20px;
}

/* 表单标签 */
.douyin-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.douyin-form-label.required::after {
    content: ' *';
    color: #ff4757;
}

/* 表单输入框 */
.douyin-form-input,
.douyin-form-select,
.douyin-form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.douyin-form-input:focus,
.douyin-form-select:focus,
.douyin-form-textarea:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* 禁用状态的选择器 */
.douyin-form-select:disabled {
    background-color: #f0f0f0 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    border-color: #e0e0e0 !important;
    opacity: 0.8;
}

.douyin-form-select:disabled:hover {
    border-color: #e0e0e0 !important;
}

.douyin-form-select:disabled:focus {
    outline: none !important;
    border-color: #e0e0e0 !important;
    box-shadow: none !important;
}


.douyin-form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    line-height: 1.6;
}

/* 图片上传区域（中间页图片等通用样式） */
.douyin-image-upload {
    background: #fff;
    border: 2px dashed #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.douyin-image-upload:hover {
    border-color: #333;
}

.douyin-image-preview {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.douyin-image-preview i {
    font-size: 48px;
    color: #ccc;
}

.douyin-image-preview p {
    font-size: 13px;
    color: #999;
    margin: 0;
}

.douyin-image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
}

.douyin-upload-btn {
    width: 100%;
    padding: 10px 20px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.douyin-upload-btn:hover {
    background: #000;
    transform: translateY(-1px);
}

.douyin-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    margin-bottom: 0;
}

/* 封面容器 - 左右布局（仅用于封面图片） */
.douyin-cover-container {
    display: flex;
    gap: 12px;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px;
}

/* 左侧：封面预览 */
.douyin-cover-preview {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: #f5f5f5;
}

.douyin-cover-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
}

.douyin-cover-empty span {
    font-size: 12px;
    color: #999;
    text-align: center;
}

.douyin-cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 右侧：信息区域 */
.douyin-cover-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

/* 标题区域 */
.douyin-cover-titles {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}

.douyin-cover-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.douyin-cover-title.empty {
    color: #ccc;
    font-weight: 400;
}

.douyin-cover-subtitle {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.douyin-cover-subtitle.empty {
    color: #ccc;
}

/* 按钮组 */
.douyin-cover-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.douyin-cover-btn {
    flex: 1;
    padding: 8px 12px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.douyin-cover-btn:hover {
    background: #000;
}

.douyin-cover-btn:active {
    transform: scale(0.98);
}

.douyin-cover-btn.secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #e5e5e5;
}

.douyin-cover-btn.secondary:hover {
    background: #e8e8e8;
    color: #333;
}

/* 开关样式 */
.douyin-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.douyin-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

.douyin-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.douyin-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 28px;
}

.douyin-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.douyin-switch input:checked + .douyin-switch-slider {
    background-color: #333;
}

.douyin-switch input:checked + .douyin-switch-slider:before {
    transform: translateX(20px);
}

.douyin-switch-text {
    font-size: 14px;
    color: #666;
}

/* 输入组 */
.douyin-input-group {
    display: flex;
    gap: 8px;
}

.douyin-input-group .douyin-form-input {
    flex: 1;
}

.douyin-verify-btn {
    padding: 12px 20px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.douyin-verify-btn:hover {
    background: #000;
}

/* 提示文字 */
.douyin-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    margin-bottom: 0;
}

/* 通知区域 */
.douyin-notice {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.douyin-notice i {
    font-size: 16px;
}

.douyin-notice strong {
    font-weight: 700;
}

.douyin-notice-points {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.douyin-notice-vip {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* 表单操作按钮 */
.douyin-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 20px; /* 优化底部边距，避免过大空白 */
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.douyin-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.douyin-btn i {
    font-size: 16px;
}

.douyin-btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #e5e5e5;
}

.douyin-btn-secondary:hover {
    background: #e5e5e5;
    color: #333;
}

.douyin-btn-primary {
    background: #333;
    color: #fff;
}

.douyin-btn-primary:hover {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.douyin-btn-primary:active {
    transform: translateY(0);
}

.douyin-btn:disabled {
    background: #e5e5e5;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

/* 加载状态 */
.douyin-btn.loading {
    position: relative;
    pointer-events: none;
}

.douyin-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 响应式优化 */
@media (max-width: 480px) {
    .page.douyin-page {
        padding-bottom: 140px !important; /* 移动端优化底部间距 */
    }
    
    .douyin-container {
        padding: 12px;
    }

    .douyin-form-group {
        margin-bottom: 16px;
    }

    .douyin-form-actions {
        flex-direction: column;
        margin-bottom: 30px; /* 移动端优化底部边距 */
    }

    .douyin-btn {
        width: 100%;
    }

    /* 中间页图片等通用上传区域 */
    .douyin-image-upload {
        padding: 15px;
    }

    .douyin-upload-btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    /* 封面容器响应式 */
    .douyin-cover-container {
        padding: 10px;
    }

    .douyin-cover-preview {
        width: 90px;
        height: 90px;
    }

    .douyin-cover-title {
        font-size: 14px;
    }

    .douyin-cover-subtitle {
        font-size: 12px;
    }

    .douyin-cover-btn {
        padding: 6px 10px;
        font-size: 11px;
        gap: 3px;
    }
}

/* 隐藏文件输入 */
input[type="file"] {
    display: none !important;
}

/* ===========================================
   域名选择器样式
   =========================================== */

/* 域名选择器容器 */
.douyin-domain-selector {
    width: 100%;
    position: relative;
}

/* 域名显示区域（可点击） */
.douyin-domain-display {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    position: relative;
}

.douyin-domain-display:hover {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.douyin-domain-display.active {
    border-color: #333;
}

/* 域名文本 - 支持多行显示，最多2行 */
.douyin-domain-text {
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    word-break: break-all;
}

/* 箭头图标 */
.douyin-domain-display i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.douyin-domain-display.active i {
    transform: translateY(-50%) rotate(180deg);
}

/* ===========================================
   域名选择弹窗样式
   =========================================== */

/* 弹窗遮罩 */
.domain-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: flex-end;
}

.domain-modal.active {
    display: flex;
}

/* 遮罩层 */
.domain-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

/* 弹窗内容 */
.domain-modal-content {
    position: relative;
    width: 100%;
    max-height: 70vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    z-index: 1;
}

/* 弹窗头部 */
.domain-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.domain-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.domain-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.domain-modal-close:hover {
    background: #e5e5e5;
    color: #333;
}

/* 弹窗主体 */
.domain-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

/* 加载状态 */
.domain-loading {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 域名列表项 */
.domain-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.domain-item:hover {
    background: #f9f9f9;
}

.domain-item:active {
    background: #f5f5f5;
}

.domain-item:last-child {
    border-bottom: none;
}

/* 域名信息容器 */
.domain-item-info {
    flex: 1;
    overflow: hidden;
}

/* 域名文本 - 最多显示2行，超出显示省略号 */
.domain-item-name {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    word-break: break-all;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}

/* 域名标签 */
.domain-item-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.domain-item-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
    background: #f5f5f5;
    color: #666;
}

.domain-item-tag.default {
    background: #e8f5e9;
    color: #4caf50;
}

/* 选中图标 */
.domain-item-check {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4caf50;
    font-size: 16px;
    opacity: 0;
}

.domain-item.selected .domain-item-check {
    opacity: 1;
}

/* 空状态 */
.domain-empty {
    padding: 60px 20px;
    text-align: center;
}

.domain-empty i {
    font-size: 48px;
    color: #e5e5e5;
    margin-bottom: 12px;
}

.domain-empty-text {
    font-size: 14px;
    color: #999;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}
