/* 沧海公众号封面图生成器 - 自定义样式文件 */

/* 主题色配置 */
:root {
    --primary: #149c86;
    --primary-hover: #10806d;
}

/* 字体配置 */
.font-yahei {
    font-family: "Microsoft YaHei", sans-serif;
}

/* 工具类 */
.content-auto {
    content-visibility: auto;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preview-shadow {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* 上传区域样式 */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background-color: #f0fdfa;
}

/* 折叠面板样式 */
.collapse-content {
    max-height: none;
    overflow: visible;
    opacity: 1;
    transition: all 0.3s ease;
}

.collapse-content.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.collapse-summary {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    background-color: rgba(107, 114, 128, 0.08);
    padding: 4px 8px;
    border-radius: 6px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collapse-summary.visible {
    opacity: 0.8;
    visibility: visible;
}

.collapse-toggle {
    transition: all 0.3s ease;
    border-radius: 6px;
    padding: 6px 8px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collapse-toggle:hover {
    transform: scale(1.05);
    background-color: rgba(20, 156, 134, 0.1);
    color: var(--primary);
}

.collapse-toggle i {
    font-size: 14px;
}

/* 面板按钮样式 */
.panel-toggle-btn {
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.panel-toggle-btn:hover {
    background-color: var(--primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(20, 156, 134, 0.2);
}

.panel-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.panel-toggle-btn i {
    transition: all 0.3s ease;
}

.panel-toggle-btn:hover i {
    transform: scale(1.1);
}

.panel-toggle-btn .collapse-toggle {
    transition: transform 0.3s ease;
}

.panel-toggle-btn .collapse-summary {
    background-color: transparent;
    color: rgba(255, 255, 255, 0.8);
    padding: 0;
    border-radius: 0;
    font-size: 11px;
    max-width: 80px;
}

/* 面板间距优化 */
.mb-6 {
    margin-bottom: 1.5rem !important;
}

/* 折叠面板容器优化 - 按钮风格 */
.control-panel-content > div:not(:last-child) {
    margin-bottom: 1.5rem;
}

.control-panel-content > div {
    margin-bottom: 0 !important;
}

.control-panel-content > div:first-child {
    padding-top: 0;
}

/* Toast 背景遮罩 */
.toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    transition: all 0.3s ease;
}

/* Toast 消息样式 - 中间显示蓝色版 */
.toast-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #3b82f6;
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    transition: all 0.4s ease;
    font-weight: 600;
    font-size: 16px;
    max-width: 400px;
    min-width: 300px;
    text-align: center;
    word-wrap: break-word;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* 图标颜色类 */
.text-blue-500 { color: #3b82f6; }
.text-green-500 { color: #10b981; }
.text-purple-500 { color: #8b5cf6; }
.text-orange-500 { color: #f59e0b; }
.text-indigo-500 { color: #6366f1; }
.text-red-500 { color: #ef4444; }

/* 裁剪容器样式 */
.cropper-container {
    overflow: hidden;
    position: relative;
    cursor: grab;
    border: 2px solid var(--primary);
    border-radius: 0.5rem;
    background-color: #f9fafb;
}

.cropper-container:active {
    cursor: grabbing;
}

.cropper-container-left {
    width: 100%;
    max-width: 500px;
    height: 212px;
    margin: 0 auto;
}

.cropper-container-right {
    width: 100%;
    max-width: 300px;
    height: 300px;
    margin: 0 auto;
}

/* 图片预览样式 */
.cropper-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center;
    transition: transform 0.1s ease;
    max-width: none;
    pointer-events: none;
}

.cropper-box {
    position: absolute;
    border: 2px dashed white;
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
    z-index: 10;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* 夜间模式样式 */
.night-mode-bg {
    background-color: #1a202c;
}

.night-mode-panel {
    background-color: #2d3748;
}

.night-mode-text {
    color: #e2e8f0;
}

.night-mode-panel h2,
.night-mode-panel label,
.night-mode-panel .text-gray-800,
.night-mode-panel .text-gray-600,
.night-mode-panel .text-gray-500 {
    color: #ffffff !important;
}

.night-mode-panel input[type="text"],
.night-mode-panel textarea,
.night-mode-panel select {
    background-color: #4a5568;
    color: #ffffff;
    border-color: #718096;
}

.night-mode-panel input[type="text"]::placeholder,
.night-mode-panel textarea::placeholder {
    color: #a0aec0;
}

/* 位置指示器 */
.position-indicator {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    z-index: 30;
    pointer-events: none;
    bottom: 10px;
    left: 10px;
}

.drag-instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 20;
    pointer-events: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

.scale-display {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    z-index: 30;
    pointer-events: none;
}

.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 30;
}

.zoom-btn {
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.zoom-btn:hover {
    background: rgba(20, 156, 134, 0.8);
}

/* 预览区域样式 */
.left-preview-area {
    width: 900px;
    height: 383px;
}

.right-preview-area {
    width: 383px;
    height: 383px;
}

.area-active {
    background-color: var(--primary) !important;
    color: white !important;
}

.area-inactive {
    background-color: #e5e7eb !important;
    color: #374151 !important;
}

.size-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(20, 156, 134, 0.9);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    z-index: 30;
    pointer-events: none;
    font-weight: bold;
}

/* 下载尺寸修复样式 */
.cover-preview-fixed {
    width: 1283px !important;
    height: 383px !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* 预览容器优化 */
.preview-container {
    width: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 0.75rem;
    box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: relative;
}

/* 预览控制栏 */
.preview-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 1283px;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
    gap: 100px;
}

.preview-controls-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 预览缩放控制 */
.preview-zoom-controls {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-zoom-btn {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    font-size: 14px;
}

.preview-zoom-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.preview-zoom-btn:active {
    transform: scale(0.95);
}

.preview-zoom-indicator {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
}

/* 预览内容区域 */
.preview-content {
    position: relative;
    transform-origin: center;
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* 颜色选择器样式 */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    transition: all 0.2s ease;
}

.color-picker-container:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(20, 156, 134, 0.1);
}

.color-picker-container input[type="color"] {
    width: 32px;
    height: 32px;
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.color-picker-container input[type="color"]:hover {
    border-color: var(--primary);
}

.color-picker-container input[type="text"] {
    border: none;
    background: transparent;
    font-size: 12px;
    font-family: monospace;
    font-weight: bold;
    color: #374151;
    width: 70px;
    outline: none;
}

/* 图片加载状态 */
.image-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #f3f4f6, #e5e7eb);
    color: #6b7280;
    font-size: 14px;
}

.image-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #d1d5db;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加载指示器 */
#loadingIndicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    z-index: 9999;
}

/* 二维码弹窗样式优化 */
#qrModal {
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

#qrModal .bg-white {
    max-width: 90%;
    max-height: 90vh;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#qrModal img {
    width: 280px;
    height: 280px;
    max-width: 280px;
    max-height: 280px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 3px solid #f0f0f0;
    background: white;
    transition: transform 0.2s ease;
}

#qrModal img:hover {
    transform: scale(1.02);
}

#qrModal h3 {
    color: #2d3748;
    margin-bottom: 16px;
    font-weight: 600;
}

#qrModal button {
    margin-top: 20px;
    min-width: 100px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#qrModal button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 弹窗动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 响应式优化 */
@media (max-width: 480px) {
    #qrModal img {
        width: 240px;
        height: 240px;
        max-width: 240px;
        max-height: 240px;
    }
    
    #qrModal .bg-white {
        margin: 20px;
        padding: 24px;
    }
    
    #qrModal h3 {
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    #qrModal img {
        width: 200px;
        height: 200px;
        max-width: 200px;
        max-height: 200px;
    }
    
    #qrModal .bg-white {
        margin: 16px;
        padding: 20px;
    }
}

/* Tailwind 主题色配置 */
.text-primary { 
    color: var(--primary); 
}

.bg-primary { 
    background-color: var(--primary); 
}

.border-primary { 
    border-color: var(--primary); 
}

.hover\:bg-primary\/90:hover { 
    background-color: rgba(20, 156, 134, 0.9); 
}

.focus\:ring-primary\/50:focus { 
    --tw-ring-color: rgba(20, 156, 134, 0.5); 
}

.focus\:border-primary:focus { 
    border-color: var(--primary); 
}

.accent-primary { 
    accent-color: var(--primary); 
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .cropper-container-left {
        max-width: 400px;
        height: 170px;
    }
    
    .cropper-container-right {
        max-width: 250px;
        height: 250px;
    }
}

@media (max-width: 768px) {
    .cropper-container-left {
        max-width: 300px;
        height: 128px;
    }
    
    .cropper-container-right {
        max-width: 200px;
        height: 200px;
    }
    
    .preview-container {
        padding: 1rem;
    }
    
    .preview-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .preview-controls-right {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* 特殊尺寸类 - 对应1283x383的封面尺寸 */
.w-\[1283px\] {
    width: 1283px;
}

.h-\[383px\] {
    height: 383px;
}

/* 修复Tailwind中缺失的一些类 */
.text-\[clamp\(1\.8rem\,3vw\,2\.5rem\)\] {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.min-w-\[3rem\] {
    min-width: 3rem;
}

.space-y-2 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-y-reverse: 0;
    margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
    margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
}

/* 优化预览按钮状态 */
.bg-primary\/10 {
    background-color: rgba(20, 156, 134, 0.1);
}

/* 修复一些可能缺失的Tailwind类 */
.flex-grow {
    flex-grow: 1;
}

.backdrop-filter {
    backdrop-filter: blur(10px);
}

/* 确保所有图标正常显示 */
.fa {
    font-family: FontAwesome;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 控制面板响应式滚动 */
#controlPanel {
    display: flex;
    flex-direction: column;
    /* 限制最大高度，减去头部和页脚的大致高度 */
    max-height: calc(100vh - 12rem); 
}

.control-panel-content {
    flex: 1;
    overflow-y: auto;
    /* 为滚动条留出空间，避免内容紧贴 */
    padding-right: 15px; 
    margin-right: -15px;
    /* 优化滚动条样式 (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #f1f5f9;
}

/* 折叠面板样式 */
.collapse-toggle {
    cursor: pointer;
    transition: all 0.3s ease;
}

.collapse-toggle i {
    transition: transform 0.3s ease;
}

.collapse-toggle:hover {
    background-color: rgba(20, 156, 134, 0.1);
    color: var(--primary);
}

.collapse-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.collapse-content.collapsed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    margin: 0;
}

/* 移除重复的面板标题样式，使用前面定义的优化版本 */

/* 移除重复的折叠摘要样式，使用前面定义的优化版本 */

/* 面板激活状态 - 按钮风格 */
.panel-toggle-btn.active {
    background-color: var(--primary-hover) !important;
    box-shadow: 0 3px 6px rgba(20, 156, 134, 0.3);
}

/* 优化滚动条样式 (Chrome, Edge, Safari) */
.control-panel-content::-webkit-scrollbar {
    width: 8px;
}

.control-panel-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.control-panel-content::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
    border: 2px solid #f1f5f9;
}

.control-panel-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-hover);
}