/* ============================================
   Zen-iOS Hybrid Design System
   极致毛玻璃 + 物理触感 + 冷灰调设计
   ============================================ */

/* CSS Variables */
:root {
    /* 核心色彩 - 冷灰调 */
    --bg-system: #F2F2F7;
    --bg-secondary: #F9F9FB;
    --bg-elevated: rgba(255, 255, 255, 0.72);
    --bg-glass: rgba(255, 255, 255, 0.55);
    --bg-glass-hover: rgba(255, 255, 255, 0.68);

    /* 深空黑系列 */
    --deep-space: #1C1C1E;
    --graphite: #2C2C2E;
    --graphite-light: #3A3A3C;

    /* 边框与阴影 */
    --border-inner: rgba(255, 255, 255, 0.6);
    --border-outer: rgba(209, 213, 219, 0.4);
    --border-subtle: rgba(0, 0, 0, 0.04);

    /* 阴影系统 */
    --shadow-elevated: 0 24px 48px -12px rgba(0, 0, 0, 0.08);
    --shadow-float: 0 16px 32px -8px rgba(0, 0, 0, 0.06);
    --shadow-soft: 0 8px 24px -4px rgba(0, 0, 0, 0.04);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-inner-deep: inset 0 2px 6px rgba(0, 0, 0, 0.08);

    /* 文字色彩 */
    --text-primary: #1C1C1E;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-muted: #D1D5DB;

    /* 功能色 */
    --accent-success: #34C759;
    --accent-success-bg: rgba(52, 199, 89, 0.08);
    --accent-success-border: rgba(52, 199, 89, 0.2);

    /* 圆角系统 - iOS 连续曲率 */
    --radius-container: 44px;
    --radius-card: 32px;
    --radius-block: 24px;
    --radius-component: 16px;
    --radius-small: 12px;

    /* 间距系统 */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 40px;

    /* 毛玻璃模糊 */
    --blur-glass: 50px;
    --blur-hover: 60px;

    /* 过渡 */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-system);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
    line-height: 1.5;
    color: var(--text-primary);
}

/* ============================================
   Container - 最外层容器
   ============================================ */
.container {
    width: 100%;
    max-width: 440px;
}

/* ============================================
   Card - 主卡片（毛玻璃层）
   ============================================ */
.card {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border-radius: var(--radius-container);
    padding: var(--space-xl) var(--space-lg);

    /* 双层物理描边 */
    border: 1px solid var(--border-inner);
    box-shadow:
        var(--shadow-elevated),
        inset 0 0 0 1px var(--border-outer),
        0 0 0 1px var(--border-subtle);

    /* 层级感 */
    position: relative;
    overflow: hidden;
}

/* 卡片内部光泽效果 */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.8) 50%,
        transparent 100%);
    pointer-events: none;
}

/* ============================================
   Logo - 品牌标识
   ============================================ */
.logo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(145deg, #E5E5EA 0%, #D1D1D6 100%);
    border-radius: var(--radius-block);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;

    /* 物理质感 */
    box-shadow:
        var(--shadow-float),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-inner);
}

/* ============================================
   Typography - 排版系统
   ============================================ */
.title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}

.subtitle {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    text-align: center;
    margin-bottom: var(--space-xl);
}

/* ============================================
   Tabs - 标签页切换器
   ============================================ */
.tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    padding: 6px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-component);
    box-shadow: var(--shadow-inner);
}

.tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-small);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

.tab:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.4);
}

.tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow:
        var(--shadow-soft),
        0 0 0 1px var(--border-outer);
}

.tab:active {
    transform: scale(0.98);
}

.tab-icon {
    font-size: 14px;
    opacity: 0.7;
}

.tab.active .tab-icon {
    opacity: 1;
}

/* ============================================
   Panel - 内容面板
   ============================================ */
.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

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

/* ============================================
   Form - 表单系统
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    padding-left: 4px;
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input-icon {
    position: absolute;
    left: var(--space-md);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
    transition: var(--transition-fast);
    z-index: 1;
}

/* Input - 凹陷组件 */
.input-wrapper input {
    width: 100%;
    padding: var(--space-md) var(--space-md) var(--space-md) 48px;
    background: rgba(142, 142, 147, 0.08);
    border: 1px solid transparent;
    border-radius: var(--radius-component);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition-normal);
    outline: none;

    /* 凹陷效果 */
    box-shadow: var(--shadow-inner);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.input-wrapper input:hover {
    background: rgba(142, 142, 147, 0.1);
}

.input-wrapper input:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border-outer);
    box-shadow:
        0 0 0 4px rgba(28, 28, 30, 0.06),
        var(--shadow-soft);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--text-primary);
}

/* Input Row */
.input-row {
    display: flex;
    gap: var(--space-sm);
}

.flex-1 {
    flex: 1;
}

/* Hint Text */
.hint {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
    padding-left: 4px;
}

/* ============================================
   Buttons - 按钮系统
   ============================================ */
.btn {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-component);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    position: relative;
    overflow: hidden;
}

/* Primary Button - 深空黑 */
.btn.primary {
    background: var(--deep-space);
    color: white;
    box-shadow:
        var(--shadow-float),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn.primary:hover {
    background: var(--graphite);
    transform: translateY(-1px);
    box-shadow:
        var(--shadow-elevated),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn.primary:active {
    transform: scale(0.98) translateY(0);
    box-shadow: var(--shadow-soft);
}

/* Secondary Button - 白色块 */
.btn.secondary {
    background: white;
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    width: auto;
    min-width: 80px;

    /* 双层描边 */
    border: 1px solid var(--border-inner);
    box-shadow:
        var(--shadow-soft),
        inset 0 0 0 1px var(--border-outer);
}

.btn.secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow:
        var(--shadow-float),
        inset 0 0 0 1px var(--border-outer);
}

.btn.secondary:active {
    transform: scale(0.98);
    background: rgba(0, 0, 0, 0.02);
}

/* Dark Button - 石墨色 */
.btn.dark {
    background: linear-gradient(180deg, var(--graphite) 0%, var(--deep-space) 100%);
    color: white;
    box-shadow:
        var(--shadow-float),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn.dark:hover {
    background: linear-gradient(180deg, var(--graphite-light) 0%, var(--graphite) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-elevated);
}

.btn.dark:active {
    transform: scale(0.98) translateY(0);
}

/* Disabled State */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-icon {
    font-size: 14px;
    opacity: 0.8;
}

/* ============================================
   Status Box - 状态信息框
   ============================================ */
.status-box {
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-component);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);

    /* 凹陷效果 */
    box-shadow: var(--shadow-inner);
    border: 1px solid var(--border-subtle);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Info Box - 信息提示框
   ============================================ */
.info-box {
    background: var(--accent-success-bg);
    border: 1px solid var(--accent-success-border);
    border-radius: var(--radius-component);
    padding: var(--space-md);
    margin-top: var(--space-lg);
}

.info-box h4 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #166534;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-icon {
    font-size: 14px;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    font-size: 12px;
    font-weight: 500;
    color: #15803d;
    padding: 4px 0;
    padding-left: var(--space-md);
    position: relative;
    line-height: 1.5;
}

.info-box li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-success);
    border-radius: 50%;
}

/* ============================================
   Toast - 消息提示
   ============================================ */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--deep-space);
    color: white;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-component);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: var(--transition-spring);
    z-index: 1000;
    max-width: 90%;
    text-align: center;

    /* 毛玻璃效果 */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-elevated);
}

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

.toast.success {
    background: rgba(52, 199, 89, 0.95);
}

.toast.error {
    background: rgba(255, 59, 48, 0.95);
}

.toast.warning {
    background: rgba(255, 149, 0, 0.95);
}

/* ============================================
   Loading Animation
   ============================================ */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.7s linear infinite;
}

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

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 480px) {
    body {
        padding: var(--space-md);
        align-items: flex-start;
        padding-top: var(--space-xl);
    }

    .card {
        padding: var(--space-lg) var(--space-md);
        border-radius: var(--radius-card);
    }

    .title {
        font-size: 18px;
    }

    .tabs {
        padding: 4px;
    }

    .tab {
        font-size: 12px;
        padding: var(--space-sm);
    }

    .input-row {
        flex-direction: column;
    }

    .btn.secondary {
        width: 100%;
    }

    .logo-icon {
        width: 64px;
        height: 64px;
        font-size: 32px;
        border-radius: 20px;
    }
}

/* ============================================
   Accessibility & Focus States
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.btn:focus-visible,
.tab:focus-visible,
input:focus-visible {
    outline: 2px solid var(--deep-space);
    outline-offset: 2px;
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-system: #1C1C1E;
        --bg-secondary: #2C2C2E;
        --bg-glass: rgba(44, 44, 46, 0.72);
        --bg-glass-hover: rgba(58, 58, 60, 0.72);

        --border-inner: rgba(255, 255, 255, 0.1);
        --border-outer: rgba(255, 255, 255, 0.05);
        --border-subtle: rgba(255, 255, 255, 0.02);

        --text-primary: #F5F5F7;
        --text-secondary: #A1A1A6;
        --text-tertiary: #6E6E73;
        --text-muted: #48484A;

        --shadow-elevated: 0 24px 48px -12px rgba(0, 0, 0, 0.4);
        --shadow-float: 0 16px 32px -8px rgba(0, 0, 0, 0.3);
        --shadow-soft: 0 8px 24px -4px rgba(0, 0, 0, 0.2);
        --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .card::before {
        background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    }

    .logo-icon {
        background: linear-gradient(145deg, #3A3A3C 0%, #2C2C2E 100%);
    }

    .tab.active {
        background: var(--graphite);
    }

    .input-wrapper input {
        background: rgba(255, 255, 255, 0.05);
    }

    .input-wrapper input:focus {
        background: rgba(255, 255, 255, 0.08);
    }

    .btn.secondary {
        background: var(--graphite);
        color: var(--text-primary);
    }

    .btn.secondary:hover {
        background: var(--graphite-light);
    }

    .status-box {
        background: rgba(255, 255, 255, 0.03);
    }

    .info-box {
        background: rgba(52, 199, 89, 0.1);
        border-color: rgba(52, 199, 89, 0.2);
    }

    .info-box h4,
    .info-box li {
        color: #4ADE80;
    }
}
