/* 消息系统样式 - 修复版 */

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* 消息状态容器 */
.message-system-status {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
}

/* 消息通知 */
.message-notification {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #3b82f6;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.message-notification.success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.message-notification.error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
}

.message-notification.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.message-notification.info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.message-notification-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-notification.success .message-notification-icon {
    color: #10b981;
}

.message-notification.error .message-notification-icon {
    color: #ef4444;
}

.message-notification.warning .message-notification-icon {
    color: #f59e0b;
}

.message-notification.info .message-notification-icon {
    color: #3b82f6;
}

.message-notification-content {
    flex: 1;
}

.message-notification-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #1e293b;
}

.message-notification-message {
    font-size: 14px;
    color: #475569;
    line-height: 1.4;
}

.message-notification-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.message-notification-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #64748b;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.message-notification.hiding {
    animation: slideOut 0.3s ease-in forwards;
}

/* 表单状态指示器 */
.form-status {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    transition: all 0.3s;
}

.form-status.show {
    display: block;
    animation: fadeIn 0.3s;
}

.form-status.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.form-status.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.form-status.warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.form-status.info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

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

/* 按钮状态 */
button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 表单验证样式 */
.form-field.error input,
.form-field.error textarea,
.form-field.error select {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

.form-field.error .field-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.form-field.success input,
.form-field.success textarea,
.form-field.success select {
    border-color: #10b981 !important;
    background-color: #f0fdf4;
}

/* 数据库状态指示器 */
.db-status-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 9998;
}

.db-status-indicator.online {
    border-left: 3px solid #10b981;
    color: #065f46;
}

.db-status-indicator.offline {
    border-left: 3px solid #ef4444;
    color: #991b1b;
}

.db-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.db-status-dot.online {
    background-color: #10b981;
    animation: pulse 2s infinite;
}

.db-status-dot.offline {
    background-color: #ef4444;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .message-system-status {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .message-notification {
        margin-bottom: 8px;
        padding: 12px;
    }
    
    .db-status-indicator {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
    }
}