/* 公共样式 - 重置和基础变量 */

:root {
    /* 基础颜色 */
    --bg-app: #f4f5f7;
    --bg-panel: #ffffff;
    --border-soft: #e5e7eb;
    --border-strong: #d1d5db;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* 状态颜色 */
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* 阴影 */
    --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* 过渡 */
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
}

/* 通用按钮样式 */
.primary-button,
.ghost-button {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.primary-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.primary-button--compact {
    padding: 8px 14px;
    font-size: 13px;
}

.ghost-button {
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent-strong);
}

.ghost-button:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.12);
}

.text-button {
    border: none;
    background: transparent;
    color: #cbd5f5;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.text-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

/* Toast 通知 */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1200;
    max-width: calc(100vw - 48px);
    pointer-events: none;
    transform: translateX(-50%);
    align-items: center;
}

.toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    min-width: 260px;
    max-width: 340px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.toast__icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: inherit;
    background: rgba(148, 163, 184, 0.15);
    margin-top: 2px;
}

.toast__icon svg {
    width: 16px;
    height: 16px;
}

.toast__text {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.toast__close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
}

.toast__close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-secondary);
}

.toast--info {
    border-left: 4px solid rgba(37, 99, 235, 0.85);
}

.toast--info .toast__icon {
    background: rgba(37, 99, 235, 0.18);
    color: var(--accent-strong);
}

.toast--success {
    border-left: 4px solid rgba(34, 197, 94, 0.85);
}

.toast--success .toast__icon {
    background: rgba(22, 163, 74, 0.18);
    color: var(--success);
}

.toast--error {
    border-left: 4px solid rgba(239, 68, 68, 0.9);
}

.toast--error .toast__icon {
    background: rgba(239, 68, 68, 0.18);
    color: var(--danger);
}

@media (max-width: 600px) {
    .toast-container {
        top: 16px;
        max-width: calc(100vw - 32px);
    }

    .toast {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}
