/**
 * 公共样式文件
 * 包含错误消息、成功消息、加载状态等通用样式
 */

/* 统一错误消息样式 */
.error-message {
    display: none;
    padding: 15px 20px;
    margin: 20px 0;
    background-color: #fee;
    border-left: 4px solid #f44;
    border-radius: 5px;
    color: #c33;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(244, 68, 68, 0.1);
    animation: slideIn 0.3s ease;
}

.error-message.error-visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 成功消息样式 */
.success-message {
    display: none;
    padding: 15px 20px;
    margin: 20px 0;
    background-color: #efe;
    border-left: 4px solid #4c4;
    border-radius: 5px;
    color: #3c3;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(68, 204, 68, 0.1);
    animation: slideIn 0.3s ease;
}

.success-message.success-visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 加载状态样式 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 淡入动画 */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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

/* 滑入动画 */
.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 通用按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #5568d3;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #d0d0d0;
}

/* 通用卡片样式 */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 通用表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

