/* 统一的阴影变量 */
:root {
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* 工作区布局优化 */
.text-image-workspace {
    display: flex;
    gap: 1.5rem;
    margin: 0.5rem 0;
    height: calc(100vh - 180px);
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
}

/* 左侧设置面板优化 */
.settings-panel {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    padding-right: 0.75rem;
    height: 100%;
}

/* 设置组样式优化 */
.setting-group {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--gray-100);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.setting-group:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-md);
}

.setting-group h3 {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 尺寸预设按钮 */
.size-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.size-btn {
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    color: var(--gray-700);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.size-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.size-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* 尺寸控制区域样式优化 */
.size-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 自定义尺寸输入框样式 */
.custom-size {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.custom-size input {
    width: 70px;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    text-align: center;
    transition: all 0.2s;
}

.custom-size input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.custom-size span {
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
}

/* 文字输入区域优化 */
#textInput {
    width: 100%;
    height: 80px;
    min-height: 80px;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    resize: vertical;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    margin-bottom: 16px;
}

#textInput:focus {
    border-color: var(--primary);
    box-shadow: 
        0 0 0 3px rgba(37, 99, 235, 0.15),
        var(--shadow-sm);
    outline: none;
}

/* 字体选择器优化 */
#fontFamily {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    background: #fff;
    cursor: pointer;
}

#fontFamily optgroup {
    font-weight: 600;
    color: var(--gray-500);
}

#fontFamily option {
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* 预览字体名称 */
#fontFamily option[value="Microsoft YaHei"] { font-family: "Microsoft YaHei"; }
#fontFamily option[value="PingFang SC"] { font-family: "PingFang SC"; }
#fontFamily option[value="SimSun"] { font-family: "SimSun"; }
#fontFamily option[value="SimHei"] { font-family: "SimHei"; }
#fontFamily option[value="KaiTi"] { font-family: "KaiTi"; }
#fontFamily option[value="FangSong"] { font-family: "FangSong"; }
#fontFamily option[value="'Noto Sans SC', sans-serif"] { font-family: "Noto Sans SC"; }
#fontFamily option[value="'ZCOOL XiaoWei', serif"] { font-family: "ZCOOL XiaoWei"; }
#fontFamily option[value="'ZCOOL KuaiLe', cursive"] { font-family: "ZCOOL KuaiLe"; }
#fontFamily option[value="'Ma Shan Zheng', cursive"] { font-family: "Ma Shan Zheng"; }
#fontFamily option[value="'Zhi Mang Xing', cursive"] { font-family: "Zhi Mang Xing"; }
#fontFamily option[value="'Long Cang', cursive"] { font-family: "Long Cang"; }

.font-size-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.font-size-control label {
    font-size: 0.875rem;
    color: var(--gray-700);
    min-width: 40px;
}

.font-size-control input[type="range"] {
    flex: 1;
}

.font-size-value {
    font-size: 0.875rem;
    color: var(--gray-600);
    min-width: 45px;
}

/* 对齐按钮 */
.text-align-control {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.align-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.align-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--gray-700);
}

.align-btn:hover {
    border-color: var(--primary);
}

.align-btn:hover svg {
    fill: var(--primary);
}

.align-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.align-btn.active svg {
    fill: white;
}

/* 颜色选择器 */
.text-color-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.text-color-control label {
    font-size: 0.875rem;
    color: var(--gray-700);
}

input[type="color"] {
    width: 100px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
}

/* 背景设置 */
.background-type {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.bg-type-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    color: var(--gray-700);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bg-type-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.bg-type-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.bg-setting {
    margin-top: 1rem;
}

#bgGradient {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#gradientDirection {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.875rem;
}

.bg-opacity-control {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 右侧预览区域优化 */
.preview-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;  /* 更浅的背景色 */
    border-radius: 12px;
    overflow: hidden;
    border: 2px dashed #e2e8f0;  /* 更柔和的虚线边框 */
    padding: 1.5rem;
    height: 100%;
    position: relative;
    box-shadow: var(--shadow-md);
}

/* 背景网格纹理 */
.preview-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.5;
    pointer-events: none;
}

/* 画布容器优化 */
.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 画布样式优化 */
#previewCanvas {
    position: relative;
    transform-origin: center center;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transition: box-shadow 0.3s ease;
}

/* 尺寸提示优化 */
.size-indicator {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.06);
    pointer-events: none;
    z-index: 10;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    /* 隐藏顶部导航 */
    body .menu-bar,
    body .menu-bar *,
    body nav.menu-bar,
    body nav.menu-bar *,
    body .tool-nav,
    body .tool-nav * {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
    }

    /* 工作区布局 */
    body .text-image-workspace {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* 预览区域 */
    body .preview-panel {
        flex: none !important;
        width: 100% !important;
        height: 50vh !important;
        margin: 0 !important;
        padding: 0.5rem !important;
        background: #fff !important;
        border-radius: 0 !important;
        border: none !important;
    }

    /* 设置面板 */
    body .settings-panel {
        width: 100% !important;
        max-height: calc(100vh - 50vh) !important;
        padding: 0.75rem !important;
        background: #fff !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -2px 4px -1px rgba(0, 0, 0, 0.1) !important;
        overflow-y: auto !important;
    }

    /* 控件样式优化 */
    body .setting-group {
        margin-bottom: 0.75rem !important;
        padding: 0.75rem !important;
    }

    /* 输入框优化 */
    body #textInput {
        height: 60px !important;
        min-height: 60px !important;
        font-size: 14px !important;
        padding: 0.75rem !important;
    }

    /* 按钮和控件尺寸优化 */
    body .align-btn,
    body input[type="color"],
    body select,
    body .custom-size input {
        height: 40px !important;
        min-width: 40px !important;
    }

    /* 表情选择器滚动优化 */
    body .emoji-content {
        padding: 0.75rem !important;
        max-height: 160px !important;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important; /* 增加iOS滚动惯性 */
    }

    /* 表情网格布局优化 */
    body .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)) !important;
        gap: 0.5rem !important;
        padding-bottom: 0.5rem !important; /* 增加底部间距防止最后一行被切断 */
    }

    /* 表情项优化 */
    body .emoji-item {
        font-size: 1.25rem !important;
        padding: 0.5rem !important;
        touch-action: manipulation !important; /* 优化触摸操作 */
    }

    /* 表情分类标签优化 */
    body .emoji-tabs {
        padding: 0.5rem !important;
        gap: 0.375rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE/Edge */
    }

    /* 隐藏滚动条但保持功能 */
    body .emoji-tabs::-webkit-scrollbar {
        display: none !important;
    }

    body .emoji-tab {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 0.375rem 0.75rem !important;
    }

    /* 滑块控件优化 */
    body input[type="range"] {
        height: 24px !important;
    }

    /* 控制组间距优化 */
    body .font-size-control,
    body .text-align-control,
    body .text-color-control,
    body .letter-spacing-control,
    body .line-height-control,
    body .vertical-position-control {
        margin-bottom: 0.75rem !important;
        gap: 0.5rem !important;
    }

    /* 颜色选择器优化 */
    body input[type="color"] {
        width: 44px !important;
        height: 44px !important;
        padding: 2px !important;
    }

    /* 工具状态提示优化 */
    body .tool-status {
        bottom: 20px !important;
        top: auto !important;
        padding: 8px 16px !important;
        font-size: 14px !important;
        border-radius: 20px !important;
        background: rgba(0, 0, 0, 0.9) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }

    body .tool-status.brush {
        background: rgba(37, 99, 235, 0.9) !important;
    }

    body .tool-status.eraser {
        background: rgba(239, 68, 68, 0.9) !important;
    }

    body .tool-status.reset {
        background: rgba(234, 88, 12, 0.9) !important;
    }
}

/* 移动端横屏优化 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    body .text-image-workspace {
        flex-direction: row !important;
    }

    body .preview-panel {
        width: 60% !important;
        height: 100vh !important;
    }

    body .settings-panel {
        width: 40% !important;
        height: 100vh !important;
        max-height: none !important;
        border-radius: 0 !important;
        margin-top: 0 !important;
    }
}

/* 平台选择下拉框样式 */
.platform-select {
    margin: 1rem 0;
}

#platformSelect {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--gray-700);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

#platformSelect:hover {
    border-color: var(--primary);
}

#platformSelect:focus {
    border-color: var(--primary);
    box-shadow: 
        0 0 0 3px rgba(37, 99, 235, 0.15),
        var(--shadow-sm);
    outline: none;
}

#platformSelect optgroup {
    font-weight: 600;
    color: var(--gray-500);
}

#platformSelect option {
    padding: 0.5rem;
    font-weight: normal;
    color: var(--gray-700);
}

/* 字体粗细控制 */
.font-weight-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.font-weight-control label {
    font-size: 0.875rem;
    color: var(--gray-700);
    min-width: 40px;
}

.font-weight-control input[type="range"] {
    flex: 1;
}

.font-weight-value {
    font-size: 0.875rem;
    color: var(--gray-600);
    min-width: 45px;
}

/* 颜色选择器阴影 */
input[type="color"]:hover {
    box-shadow: var(--shadow-sm);
}

/* 下拉菜单阴影 */
select:hover {
    box-shadow: var(--shadow-sm);
}

/* 字间距和行间距控制 */
.letter-spacing-control,
.line-height-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.letter-spacing-control label,
.line-height-control label {
    font-size: 0.875rem;
    color: var(--gray-700);
    min-width: 40px;
}

.letter-spacing-control input[type="range"],
.line-height-control input[type="range"] {
    flex: 1;
}

.letter-spacing-value,
.line-height-value {
    font-size: 0.875rem;
    color: var(--gray-600);
    min-width: 45px;
}

/* 表情选择器样式优化 */
.emoji-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.emoji-tab {
    padding: 0.375rem 0.75rem;
    font-size: 0.813rem;
    border-radius: 4px;
    border: 1px solid transparent;
    background: none;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.emoji-tab:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.emoji-tab.active {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}

.emoji-content {
    padding: 0.75rem;
    max-height: 180px;
    overflow-y: auto;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 0.375rem;
    padding: 0.25rem;
}

.emoji-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.emoji-item:hover {
    background: var(--gray-100);
    transform: scale(1.1);
}

/* 垂直位置控制 */
.vertical-position-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.vertical-position-control label {
    font-size: 0.875rem;
    color: var(--gray-700);
    min-width: 40px;
}

.vertical-position-control input[type="range"] {
    flex: 1;
}

.vertical-position-value {
    font-size: 0.875rem;
    color: var(--gray-600);
    min-width: 45px;
}

/* 小红书表情样式 */
.emoji-tab[data-category="xiaohongshu"] {
    color: #ff2442;  /* 小红书红色 */
}

.emoji-tab[data-category="xiaohongshu"].active {
    background: #fff1f1;
    border-color: #ff2442;
    color: #ff2442;
}

.emoji-tab[data-category="xiaohongshu"]:hover {
    background: #fff1f1;
    color: #ff2442;
}

/* 画笔工具样式 */
.brush-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brush-toolbar {
    display: flex;
    gap: 8px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.brush-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.brush-btn svg {
    width: 24px;
    height: 24px;
    fill: #64748b;
    transition: all 0.2s;
}

.brush-btn:hover {
    border-color: var(--primary);
    background: #f1f5f9;
}

.brush-btn:hover svg {
    fill: var(--primary);
}

.brush-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.brush-btn.active svg {
    fill: white;
}

.brush-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brush-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brush-size-control label,
.brush-color-control label {
    font-size: 14px;
    color: #475569;
    min-width: 60px;
}

.brush-size-control input[type="range"] {
    flex: 1;
}

.brush-size-value {
    font-size: 14px;
    color: #64748b;
    min-width: 40px;
}

.brush-color-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brush-color-control input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
}

/* 添加工具状态提示样式 */
.tool-status {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.tool-status.active {
    opacity: 1;
}

.tool-status.brush {
    background: rgba(37, 99, 235, 0.9);
}

.tool-status.eraser {
    background: rgba(239, 68, 68, 0.9);
}

/* 重置提示样式 */
.tool-status.reset {
    background: rgba(234, 88, 12, 0.9); /* 使用橙色背景 */
}

/* 文字贴纸控件样式 */
.text-sticker-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#textStickerInput {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 14px;
}

.text-sticker-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.text-sticker-font-row {
    width: 100%;
}

.text-sticker-color-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-sticker-color-row label {
    min-width: 60px;
    font-size: 14px;
    color: #475569;
}

.text-sticker-button-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

#textStickerFont {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 14px;
}

#textStickerColor {
    width: 45px;
    height: 35px;
    padding: 2px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    cursor: pointer;
}

#addTextSticker {
    padding: 6px 12px;
    white-space: nowrap;
    min-width: 90px;
}

/* 辅助线样式 */
.canvas-container {
    position: relative;
}

.canvas-container::before,
.canvas-container::after {
    content: '';
    position: absolute;
    background: rgba(0, 120, 255, 0.1);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s;
}

.canvas-container::before {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
}

.canvas-container::after {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    transform: translateY(-50%);
}

/* 文字内容区域样式优化 */
.font-controls {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    border-radius: 6px;
    padding: 16px;
}

/* 调整字体选择器和其他控件的间距 */
#fontFamily {
    margin-bottom: 16px;
    width: 100%;
}

/* 调整文字输入框和字体控制区域的间距 */
#textInput {
    margin-bottom: 16px;
}

#textStickerBold {
    padding: 6px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#textStickerBold svg {
    fill: #64748b;
}

#textStickerBold.active {
    background: var(--primary);
    border-color: var(--primary);
}

#textStickerBold.active svg {
    fill: white;
} 