/**
 * v2.1 UI优化 - 自然设计系统
 * 去除AI风格的蓝紫渐变，采用纯色设计
 */

/* ========== 颜色变量 ========== */
:root {
    /* 主色调 - 沉稳蓝 */
    --primary: #4E6CF7;
    --primary-hover: #3D5DE0;
    --primary-light: #EFF6FF;
    --primary-dark: #2563EB;

    /* 功能色 */
    --success: #10B981;
    --success-hover: #059669;
    --warning: #F59E0B;
    --warning-hover: #D97706;
    --danger: #EF4444;
    --danger-hover: #DC2626;

    /* 中性色 */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-tertiary: #9CA3AF;
    --border-color: #E5E7EB;
}

/* ========== 按钮系统 - 纯色设计 ========== */

/* 主按钮 */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(78, 108, 247, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 16px rgba(78, 108, 247, 0.25);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: scale(0.97) translateY(0);
    box-shadow: 0 2px 8px rgba(78, 108, 247, 0.15);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 成功按钮 */
.btn-success {
    background-color: var(--success);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}
.btn-success:hover {
    background-color: var(--success-hover);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
    transform: translateY(-1px);
}

/* 警告按钮 */
.btn-warning {
    background-color: var(--warning);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.btn-warning:hover {
    background-color: var(--warning-hover);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}

/* 危险按钮 */
.btn-danger {
    background-color: var(--danger);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}
.btn-danger:hover {
    background-color: var(--danger-hover);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

/* 幽灵按钮（描边） */
.btn-ghost {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
.btn-ghost:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
}

/* 文字按钮 */
.btn-text {
    background: none;
    color: var(--primary);
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
}
.btn-text:hover {
    background-color: var(--primary-light);
}

/* 小尺寸按钮 */
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 10px;
}

/* 大尺寸按钮 */
.btn-lg {
    padding: 16px 32px;
    font-size: 17px;
    border-radius: 14px;
}

/* 圆形按钮 */
.btn-round {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
}

/* 全宽按钮 */
.btn-block {
    width: 100%;
    display: block;
}


/* ========== 弹窗/模态框系统 ========== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalOverlayIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    width: 92%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    background: white;
    border-radius: 20px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.2),
        0 10px 20px rgba(0, 0, 0, 0.1);
    animation: modalContentIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

@keyframes modalContentIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 28px 28px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, #FAFBFC, white);
    border-radius: 20px 20px 0 0;
}

.modal-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
}
.modal-close:hover {
    background: #E5E7EB;
    color: var(--text-secondary);
    transform: rotate(90deg) scale(1.05);
}
.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.modal-body {
    padding: 28px;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 15px;
}

.modal-footer {
    padding: 20px 28px 28px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #FAFBFC;
    border-radius: 0 0 20px 20px;
}


/* ========== 卡片组件 ========== */

.card {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    transform: translateY(-3px);
}
.card:active {
    transform: translateY(-1px);
}

.card-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}


/* ========== 输入框系统 ========== */

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.input-field {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    line-height: 1.5;
}
.input-field:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(78, 108, 247, 0.08);
}
.input-field::placeholder {
    color: var(--text-tertiary);
}
.input-field:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

textarea.input-field {
    resize: vertical;
    min-height: 100px;
    max-height: 300px;
}

select.input-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 18px;
    padding-right: 40px;
}


/* ========== 徽章/标签 ========== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: #ECFDF5;
    color: var(--success);
}

.badge-warning {
    background: #FFFBEB;
    color: var(--warning);
}

.badge-danger {
    background: #FEF2F2;
    color: var(--danger);
}

.badge-info {
    background: #EFF6FF;
    color: #3B82F6;
}


/* ========== 进度条 ========== */

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 不同颜色的进度条 */
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }


/* ========== 分割线 ========== */

.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 24px 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 500;
}
.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}


/* ========== 空状态 ========== */

.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-tertiary);
}

.empty-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--text-tertiary);
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-description {
    font-size: 14px;
    color: var(--text-tertiary);
    max-width: 280px;
    margin: 0 auto 24px;
    line-height: 1.5;
}


/* ========== 提示/通知 ========== */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    background-color: var(--text-primary);
    color: white;
    text-align: center;
    padding: 8px 14px;
    border-radius: 8px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    bottom: calc(100% + 8px);
}


/* ========== 加载动画 ========== */

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

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

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        #E5E7EB 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ========== 响应式工具类 ========== */

@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }

    .modal-header {
        padding: 24px 20px 16px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 16px 20px 20px;
    }

    .btn-lg {
        padding: 14px 28px;
        font-size: 16px;
    }

    .card-body {
        padding: 20px;
    }
}


/* ========== 工具函数 ========== */

/* 文本截断 */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 多行截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ========== 特殊效果 ========== */

/* 玻璃拟态 */
.glass {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 浮动阴影 */
.floating-shadow {
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.04);
}

/* 内凹效果 */
.inset-shadow {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}


/* ========== 打印样式 ========== */

@media print {
    .modal-overlay,
    .btn-primary,
    .btn-success,
    .btn-warning,
    .btn-danger {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}
