/**
 * WittIoT 全局UI组件样式
 * 包含：Toast、Confirm弹框、字段错误、按钮状态
 * 所有前端页面（app.html布局 / 独立页面）共用
 */

/* ===== Toast 提示 ===== */
.witt-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-width: 90vw;
    text-align: center;
}
.witt-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.witt-toast-success { background: #22c55e; color: #fff; }
.witt-toast-error { background: #ef4444; color: #fff; }
.witt-toast-info { background: #6366f1; color: #fff; }

/* ===== Confirm 确认弹框 ===== */
.witt-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}
.witt-overlay.open { display: flex; }

.witt-dialog {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: wittModalIn 0.2s ease;
}
@keyframes wittModalIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.witt-dialog .dialog-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.witt-dialog .dialog-icon svg { width: 24px; height: 24px; }
/* 图标颜色变体 */
.witt-dialog .dialog-icon-danger { background: #fef2f2; }
.witt-dialog .dialog-icon-danger svg { fill: #ef4444; }
.witt-dialog .dialog-icon-success { background: #f0fdf4; }
.witt-dialog .dialog-icon-success svg { fill: #22c55e; }
.witt-dialog .dialog-icon-info { background: #eef2ff; }
.witt-dialog .dialog-icon-info svg { fill: #6366f1; }

.witt-dialog h3 { font-size: 18px; color: #1f2937; margin-bottom: 8px; }
.witt-dialog p { font-size: 14px; color: #6b7280; margin-bottom: 24px; line-height: 1.5; }

.witt-dialog .dialog-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.witt-dialog .btn-cancel {
    padding: 10px 24px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.witt-dialog .btn-cancel:hover { background: #f3f4f6; }

.witt-dialog .btn-ok {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    display: inline-block;
    color: #fff;
}
.witt-dialog .btn-ok-danger { background: #ef4444; }
.witt-dialog .btn-ok-danger:hover { background: #dc2626; color: #fff; }
.witt-dialog .btn-ok-primary { background: #6366f1; }
.witt-dialog .btn-ok-primary:hover { background: #4338ca; color: #fff; }
.witt-dialog .btn-ok-success { background: #22c55e; }
.witt-dialog .btn-ok-success:hover { background: #16a34a; color: #fff; }

/* ===== 表单字段错误 ===== */
.field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.15) !important;
}
.error-msg {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

/* ===== 按钮Loading状态 ===== */
.btn-loading {
    opacity: 0.7;
    pointer-events: none;
}
