:root {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --success: #10b981;
    --error: #dc2626;
    --warning: #f59e0b;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --pink: #ec4899;
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --bg-sidebar: #f8f7f4;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --border: #e5e5e5;
    --shadow: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #1a1a1a;
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

a {
    text-decoration: none;
}

button,
input,
textarea,
select {
    font-family: inherit;
}

/* Toast */
.toast {
    position: fixed;
    top: calc(20px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 90%;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: #1a1a1a;
    word-wrap: break-word;
}

.toast-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    word-wrap: break-word;
}

.toast.success {
    border-left: 4px solid #00b894;
}

.toast.error {
    border-left: 4px solid #e17055;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast.warning {
    border-left: 4px solid #f39c12;
}

/* Toast 移动端适配 */
@media (max-width: 768px) {
    .toast {
        min-width: 260px;
        max-width: calc(100% - 32px);
        padding: 14px 20px;
        border-radius: 10px;
    }
    
    .toast-icon {
        font-size: 22px;
    }
    
    .toast-title {
        font-size: 14px;
    }
    
    .toast-message {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .toast {
        min-width: auto;
        max-width: calc(100% - 24px);
        padding: 12px 16px;
        gap: 10px;
    }
    
    .toast-icon {
        font-size: 20px;
    }
    
    .toast-title {
        font-size: 13px;
    }
    
    .toast-message {
        font-size: 11px;
    }
}

/* ==================== 全局确认弹窗样式 ==================== */
.global-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 20px;
}

.global-confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.global-confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: all 0.2s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.global-confirm-overlay.show .global-confirm-dialog {
    transform: scale(1) translateY(0);
}

.global-confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}

.global-confirm-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    word-wrap: break-word;
}

.global-confirm-message {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 24px;
    word-break: break-word;
    overflow-y: auto;
    max-height: 100%;
    flex: 1;
    min-height: 0;
    text-align: left;
}

.global-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-shrink: 0;
}

.global-confirm-btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 100px;
    -webkit-tap-highlight-color: transparent;
}

.global-confirm-btn.cancel {
    background: #f1f5f9;
    color: #64748b;
}

.global-confirm-btn.cancel:hover {
    background: #e2e8f0;
    color: #475569;
}

.global-confirm-btn.cancel:active {
    transform: scale(0.98);
}

.global-confirm-btn.confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.global-confirm-btn.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.global-confirm-btn.confirm:active {
    transform: translateY(0);
}

.global-confirm-btn.confirm.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.global-confirm-btn.confirm.danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.global-confirm-btn.confirm.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.global-confirm-btn.confirm.warning:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.global-confirm-btn.confirm.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.global-confirm-btn.confirm.info:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Prompt 输入框样式 */
.global-prompt-input {
    width: 100%;
    padding: 12px 14px;
    margin: 10px 0;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.global-prompt-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #fff;
}

.global-prompt-input::placeholder {
    color: #94a3b8;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .global-confirm-overlay {
        padding: 16px;
    }
    
    .global-confirm-dialog {
        padding: 28px 24px;
    }
    
    .global-confirm-icon {
        font-size: 44px;
    }
    
    .global-confirm-title {
        font-size: 18px;
    }
    
    .global-confirm-message {
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .global-confirm-btn {
        padding: 12px 24px;
        min-width: 90px;
    }
}

@media (max-width: 480px) {
    .global-confirm-overlay {
        padding: 12px;
        align-items: flex-end;
    }
    
    .global-confirm-dialog {
        padding: 24px 20px;
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .global-confirm-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    
    .global-confirm-title {
        font-size: 17px;
        margin-bottom: 10px;
    }
    
    .global-confirm-message {
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .global-confirm-buttons {
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .global-confirm-btn {
        width: 100%;
        min-width: auto;
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .global-confirm-btn.confirm:hover,
    .global-confirm-btn.cancel:hover {
        transform: none;
        box-shadow: none;
    }
    
    .global-confirm-btn:active {
        transform: scale(0.96);
        transition: transform 0.1s;
    }
    
    .global-confirm-btn {
        min-height: 44px;
    }
    
    /* 消除点击延迟 */
    .global-confirm-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* iOS 安全区域增强 */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 480px) {
        .global-confirm-dialog {
            padding-bottom: calc(24px + env(safe-area-inset-bottom));
        }
    }
}
