/* 卡片预览区域样式 */
#cardPreview {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    padding: 3rem;  /* 将内边距增加为原来的2倍 */
    justify-content: center;
}

#cardPreview:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#cardPreview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    border-radius: 0.5rem;
}

/* 行号样式 */
.line-number {
    user-select: none;
    opacity: 0.5;
    margin-right: 1em;
    display: inline-block;
    min-width: 2em;
}

/* Markdown样式 */
.markdown-title {
    margin: 0.8em 0;
    color: #60A5FA;
    line-height: 1.4;
}

code {
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    padding: 0.2em 0.4em;
    border-radius: 0.2em;
    font-size: 0.9em;
}

blockquote {
    border-left: 4px solid #3B82F6;
    margin: 0.5em 0;
    padding-left: 1em;
    color: #9CA3AF;
}

/* Logo容器样式 */
#previewLogo {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 2.5rem;
    flex-shrink: 0;
    min-width: 2.5rem;
}

#previewLogo:empty {
    display: none;
    margin: 0;
    height: 0;
}

#previewLogo img {
    max-height: 2.5rem;
    width: auto;
    object-fit: contain;
    border-radius: 0.25rem;
}

/* 标题样式 */
#previewTitle {
    margin: 0;
    padding: 0;
    margin-bottom: 0.33rem;
    flex-shrink: 0;
    line-height: 1.2;
    transition: margin 0.2s ease;
}

#previewTitle:empty {
    display: none;
    margin: 0;
    height: 0;
}

/* 内容区域样式 */
#previewContent {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: all 0.2s ease;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
}

.line {
    margin: 0;
    padding: 0.1rem 0;
    transition: padding 0.2s ease;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-all;
}

/* 中文字体特殊处理 */
#previewContent.font-kai,
#previewContent.font-song,
#previewContent.font-hei {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 签名样式 */
#previewSignature {
    margin-top: 0.5rem;
    text-align: center;
    flex-shrink: 0;
    width: 100%;
    line-height: 1.2;
    transition: margin 0.2s ease;
}

#previewSignature:empty {
    display: none;
    margin: 0;
    height: 0;
}

/* 自定义提示框样式 */
.toast-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    z-index: 1000;
    font-size: 14px;
    animation: fadeInOut 5s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -20px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    80% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* 当只有内容时的样式调整 */
#cardPreview:has(#previewLogo:empty):has(#previewTitle:empty) {
    padding: 2rem;  /* 将内边距增加为原来的2倍 */
}

/* 当内容很少时的布局调整 */
#cardPreview:has(#previewContent:only-child),
#cardPreview:has(#previewContent + #previewSignature:last-child) {
    padding: 2rem;  /* 将内边距增加为原来的2倍 */
    min-height: fit-content;
    height: auto;
}

/* 输入控件样式优化 */
input[type="text"],
textarea {
    background-color: #F9FAFB;
    transition: all 0.3s ease;
    border: 1px solid #E5E7EB;
    resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
    background-color: #FFFFFF;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    border-color: #6366F1;
}

/* 按钮样式优化 */
button {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

button:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    #cardPreview {
        min-height: 300px;
        font-size: 0.9em;
    }
    
    .grid {
        gap: 1rem;
    }
}

/* 自定义滚动条 */
#cardPreview::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#cardPreview::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#cardPreview::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

#cardPreview::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 文本高亮效果 */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #FFFFFF;
}

/* 日期时间显示样式 */
#previewDateTime {
    font-family: 'Monaco', 'Consolas', monospace;
    opacity: 0.8;
    flex-shrink: 0;
    text-align: left;
}

.date-display {
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.time-display {
    font-family: 'Consolas', monospace;
    letter-spacing: 0.05em;
}

/* 链接样式 */
#previewContent a {
    word-break: break-all;
    word-wrap: break-word;
    white-space: pre-wrap;
} 