/* 全局样式 */
:root {
    --primary-color: #4e73df;
    --secondary-color: #1cc88a;
    --dark-color: #5a5c69;
    --light-color: #f8f9fc;
    --border-radius: 0.35rem;
    --box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --transition: all 0.2s ease-in-out;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.25rem;
}

.card-header h5 {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--primary-color);
}

.card-body {
    padding: 1.25rem;
}

/* 按钮样式 */
.btn {
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2e59d9;
}

.btn-success {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-success:hover {
    background-color: #17a673;
    border-color: #17a673;
}

.btn-outline-secondary:hover {
    background-color: #eaecf4;
    color: #6e707e;
}

/* 表单元素样式 */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #d1d3e2;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.25);
}

.form-control-color {
    height: 38px;
}

.form-range::-webkit-slider-thumb {
    background: var(--primary-color);
}

.form-range::-moz-range-thumb {
    background: var(--primary-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 导航标签样式 */
.nav-tabs {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-tabs .nav-link {
    color: var(--dark-color);
    border: none;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 0;
    margin-right: 0.5rem;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: transparent;
    border-bottom: 3px solid var(--primary-color);
}

/* 模板卡片样式 */
.template-card {
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.template-card:hover {
    transform: translateY(-5px);
    border-color: rgba(78, 115, 223, 0.3);
}

.template-card.active {
    border-color: var(--primary-color);
    background-color: rgba(78, 115, 223, 0.05);
}

.template-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.template-card .card-text {
    font-size: 0.85rem;
    color: #858796;
}

/* 预览容器样式 */
#previewContainer {
    position: relative;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fc;
    border-radius: var(--border-radius);
    overflow: hidden;
}

#imagePreview {
    max-width: 100%;
    cursor: pointer;
    transition: var(--transition);
}

#imagePreview img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* 自定义位置模式样式 */
.custom-position-mode #imagePreview {
    position: relative;
}

.custom-position-mode #imagePreview:before {
    content: "点击并拖动水印调整位置";
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-position-mode #imagePreview:hover:before {
    opacity: 1;
}

/* 加载动画样式 */
.loading {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(78, 115, 223, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* 模态框样式 */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.4);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: white;
}

.modal-header .modal-title {
    font-weight: 600;
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background-color: #f8f9fc;
}

#modalImageContainer {
    max-height: 70vh;
    overflow: auto;
    text-align: center;
}

#modalImageContainer img {
    max-width: 100%;
    height: auto;
}

/* 响应式调整 */
@media (max-width: 767.98px) {
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    #previewContainer {
        min-height: 150px;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 工具提示和徽章 */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
}

.form-text {
    font-size: 0.8rem;
    color: #858796;
}

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

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* 边框样式预览 */
.border-style-preview {
    display: inline-block;
    width: 100%;
    height: 30px;
    margin-top: 5px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
}

.border-style-solid {
    border-style: solid;
}

.border-style-dashed {
    border-style: dashed;
}

.border-style-dotted {
    border-style: dotted;
}

.border-style-double {
    border-style: double;
}

/* 缩放控制样式 */
.zoom-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.zoom-controls .btn-group {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: var(--border-radius);
}

.zoom-controls .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.zoom-controls #zoomLevel {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    cursor: default;
}

/* 缩放提示 */
#previewContainer::after {
    content: "按住Ctrl+滚轮可缩放图片";
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

#previewContainer:hover::after {
    opacity: 1;
}
