/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    /* 添加高度和透明度的过渡效果 */
    transition: opacity 0.5s ease-out, height 0.5s ease-out, padding 0.5s ease-out, margin 0.5s ease-out;
    height: auto;
    opacity: 1;
}

/* 添加消失状态的样式 */
.loading.fade-out {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* 晃动动画 */
@keyframes shake {
    0%, 100% {transform: translateX(0);}
    10%, 30%, 50%, 70%, 90% {transform: translateX(-5px);}
    20%, 40%, 60%, 80% {transform: translateX(5px);}
}

.shake-animation {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    border-color: #ff4d4f !important;
}

.shake-animation:focus {
    border-color: var(--primary-color) !important;
}

/* 冻结状态样式 */
.frozen {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}


/* 控制面板按钮激活状态 */
.control-group .btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.control-group .btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.control-group .btn {
    transition: all 0.3s ease;
}


/* 字体按钮样式 */
.font-btn[data-font="default"] {
    font-family: 'Noto Sans SC', sans-serif;
}

.font-btn[data-font="serif"] {
    font-family: 'Noto Serif SC', serif;
}

.font-btn[data-font="cursive"] {
    font-family: 'Ma Shan Zheng', cursive;
}

.font-btn[data-font="xiaowei"] {
    font-family: 'ZCOOL XiaoWei', serif;
}

.font-btn[data-font="kuaile"] {
    font-family: 'ZCOOL KuaiLe', sans-serif;
}

.font-btn[data-font="longcang"] {
    font-family: 'Long Cang', cursive;
}

.font-btn[data-font="thin"] {
    font-family: 'Noto Sans SC', sans-serif;
    font-weight: 100;
}

.font-btn[data-font="bold"] {
    font-family: 'Noto Serif SC', serif;
    font-weight: 900;
}

.font-btn[data-font="qingke"] {
    font-family: 'ZCOOL QingKe HuangYou', sans-serif;
}

.font-btn[data-font="heavy"] {
    font-family: 'Noto Sans SC', sans-serif;
    font-weight: 900;
}

.font-btn[data-font="light"] {
    font-family: 'Noto Serif SC', serif;
    font-weight: 200;
}

.font-btn[data-font="zhimang"] {
    font-family: 'Zhi Mang Xing', cursive;
}

.font-btn[data-font="elegant"] {
    font-family: 'Noto Serif SC', serif;
    font-weight: 500;
    letter-spacing: 1px;
}

.font-btn[data-font="zilla"] {
    font-family: 'Zilla Slab', serif;
    font-weight: 500;
}

.font-btn[data-font="crimson"] {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
}

.font-btn[data-font="poppins"] {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.font-btn[data-font="lora"] {
    font-family: 'Lora', serif;
    font-weight: 400;
}

.font-btn[data-font="montserrat"] {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
}

.font-btn[data-font="roboto"] {
    font-family: 'Roboto Slab', serif;
    font-weight: 500;
}

.font-btn[data-font="playfair"] {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
}

/* 调整字体按钮的基础样式 */
.font-btn {
    padding: 8px 16px;
    font-size: 16px;
    line-height: 1.5;
    min-width: 100px;
    text-align: center;
    white-space: nowrap;
    transition: all 0.3s ease;
}

/* 确保字体加载时的平滑过渡 */
.font-btn {
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* 输入框基础样式调整 */
.form-input {
    box-sizing: border-box;
    width: calc(100% - 32px);  /* 减小总宽度 */
    margin: 8px 16px 16px;     /* 统一左右边距为16px */
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(0, 0, 0, 0.08);  /* 更淡的边框颜色 */
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
    resize: vertical;
    overflow: auto;          /* 确保滚动条在内容区域内 */
}

/* 自定义滚动条样式 */
.form-input::-webkit-scrollbar {
    width: 3px;
    height: 3px;
    margin-right: 2px;      /* 添加右侧边距 */
}

.form-input::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;          /* 上下添加边距，避免超出圆角 */
}

.form-input::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 1.5px;
    margin: 4px 0;          /* 上下添加边距，避免超出圆角 */
}

.form-input::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);  /* 悬停时稍微深一点 */
}

/* 暗色主题滚动条样式 */
.dark-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.dark-input::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* 输入框容器标签样式 */
.input-group label {
    padding-left: 16px;        /* 调整标签左边距 */
    box-sizing: border-box;    /* label也添加box-sizing */
    display: block;
    width: 100%;              /* 确保label宽度一致 */
    margin-bottom: 8px;
    padding-left: 24px;
    color: var(--text-color);
}

.dark-input {
    background-color: var(--dark-input-bg);
    border-color: rgba(255, 255, 255, 0.08);  /* 暗色主题下更淡的边框 */
}

.form-input:hover {
    border-color: rgba(0, 0, 0, 0.15);  /* 悬停时稍微深一点 */
}

.dark-input:hover {
    border-color: rgba(255, 255, 255, 0.15);  /* 暗色主题下悬停时的边框 */
}

.form-input:focus,
.dark-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.08);  /* 减小阴影强度 */
    outline: none;
}


/* 文章卡片文本框样式 */
.article-card textarea {
    box-sizing: border-box;
    width: calc(100% - 32px);  /* 与form-input保持一致的宽度计算 */
    margin: 8px 6px 16px;     /* 与form-input保持一致的边距 */
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
    resize: vertical;
    overflow: auto;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

/* 暗色主题样式 */
.dark-theme .article-card textarea {
    background-color: var(--dark-input-bg);
    border-color: rgba(255, 255, 255, 0.08);
}

/* 滚动条样式 */
.article-card textarea::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

.article-card textarea::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.article-card textarea::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 1.5px;
    margin: 4px 0;
}

.article-card textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* 暗色主题滚动条 */
.dark-theme .article-card textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.dark-theme .article-card textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* 悬停和焦点状态 */
.article-card textarea:hover {
    border-color: rgba(0, 0, 0, 0.15);
}

.dark-theme .article-card textarea:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.article-card textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.08);
    outline: none;
}


/* 文章卡片容器样式调整 */
.article-card {
    padding-right: 16px;       /* 添加右侧内边距，与input-group一致 */
    box-sizing: border-box;
    width: 100%;
}