/**
 * Toast 消息提醒组件样式 - iOS风格
 */

/* ==================== Toast容器 ==================== */
.toast-container {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
}

/* ==================== Toast基础样式 ==================== */
.toast {
    position: fixed;
    display: flex;
    align-items: center;
    padding: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    min-width: 280px;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .toast {
        background: rgba(44, 44, 46, 0.95);
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* ==================== Toast内容 ==================== */
.toast-content {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    width: 100%;
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 600;
}

.toast-message {
    flex: 1;
    font-size: 15px;
    line-height: 1.4;
    color: #000;
    font-weight: 400;
    word-break: break-word;
}

@media (prefers-color-scheme: dark) {
    .toast-message {
        color: #fff;
    }
}

/* ==================== Toast位置 ==================== */
.toast-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
}

.toast-top-right {
    top: 20px;
    right: 20px;
    transform: translateX(400px);
}

.toast-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
}

.toast-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
}

/* ==================== Toast动画状态 ==================== */
.toast-enter {
    opacity: 0;
}

.toast-visible.toast-top-center {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-visible.toast-top-right {
    transform: translateX(0);
    opacity: 1;
}

.toast-visible.toast-bottom-center {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-visible.toast-center {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.toast-exit {
    opacity: 0;
    transform: scale(0.9);
}

/* ==================== 移动端适配 ==================== */
@media (max-width: 768px) {
    .toast {
        max-width: calc(100vw - 40px);
        min-width: calc(100vw - 40px);
    }

    .toast-top-center,
    .toast-bottom-center {
        left: 20px;
        right: 20px;
        transform: translateY(-100px);
    }

    .toast-visible.toast-top-center,
    .toast-visible.toast-bottom-center {
        transform: translateY(0);
    }

    .toast-top-right {
        left: 20px;
        right: 20px;
        top: 20px;
        transform: translateY(-100px);
    }

    .toast-visible.toast-top-right {
        transform: translateY(0);
    }
}

/* ==================== 对话框遮罩 ==================== */
.toast-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0);
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 !important;
    padding: 0 !important;
}

.toast-overlay-visible {
    background: rgba(0, 0, 0, 0.4);
}

/* ==================== 对话框 ==================== */
.toast-dialog {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: 14px;
    width: 90%;
    max-width: 320px;
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-dialog-visible {
    opacity: 1;
    transform: scale(1);
}

@media (prefers-color-scheme: dark) {
    .toast-dialog {
        background: rgba(44, 44, 46, 0.95);
    }
}

/* ==================== 对话框内容 ==================== */
.toast-dialog-content {
    padding: 20px;
    text-align: center;
}

.toast-dialog-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
    margin-bottom: 8px;
    line-height: 1.3;
}

.toast-dialog-message {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
}

@media (prefers-color-scheme: dark) {
    .toast-dialog-title {
        color: #fff;
    }
    
    .toast-dialog-message {
        color: #999;
    }
}

/* ==================== 对话框按钮 ==================== */
.toast-dialog-buttons {
    display: flex;
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    margin: 0 -20px -20px;
}

@media (prefers-color-scheme: dark) {
    .toast-dialog-buttons {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

.toast-dialog-button {
    flex: 1;
    height: 44px;
    border: none;
    background: transparent;
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.2s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.toast-dialog-button:active {
    background: rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    .toast-dialog-button:active {
        background: rgba(255, 255, 255, 0.05);
    }
}

.toast-dialog-button + .toast-dialog-button {
    border-left: 0.5px solid rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    .toast-dialog-button + .toast-dialog-button {
        border-left-color: rgba(255, 255, 255, 0.1);
    }
}

.toast-dialog-confirm {
    font-weight: 600;
}

/* 单按钮对话框样式 */
.toast-dialog-single-button {
    justify-content: center;
}

.toast-dialog-single-button .toast-dialog-button {
    flex: none;
    width: 100%;
}

/* ==================== 输入框样式 ==================== */
.toast-prompt-dialog {
    max-width: 340px;
}

.toast-input-wrapper {
    padding: 0 20px 16px;
}

.toast-input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 15px;
    color: #000;
    background: rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
    outline: none;
    box-sizing: border-box;
}

.toast-input:focus {
    border-color: #007AFF;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.toast-input::placeholder {
    color: #999;
}

@media (prefers-color-scheme: dark) {
    .toast-input {
        color: #fff;
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .toast-input:focus {
        background: rgba(255, 255, 255, 0.08);
        border-color: #007AFF;
    }
    
    .toast-input::placeholder {
        color: #666;
    }
}

/* ==================== 动画优化 ==================== */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast-overlay,
    .toast-dialog,
    .toast-dialog-button {
        transition: none !important;
        animation: none !important;
    }
}

/* ==================== 辅助功能 ==================== */
.toast-dialog-button:focus-visible {
    outline: 2px solid #007AFF;
    outline-offset: -2px;
}

/* ==================== 打印时隐藏 ==================== */
@media print {
    .toast-container,
    .toast-overlay {
        display: none !important;
    }
}
