/**
 * 玉米报价接货系统 - 公共样式（iOS 设计规范版）
 * iOS Human Interface Guidelines · sf Symbols · iOS 15+
 */

/* ========== 基础重置 ========== */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
                 "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", sans-serif;
    font-size: 15px;
    color: #000;
    background: #f2f2f7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.47;
    letter-spacing: -0.01em;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

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

/* ========== iOS 设计 Token（颜色、圆角、间距） ========== */
:root {
    /* 品牌 */
    --primary:       #34c759;
    --primary-dark:  #30d158;
    --primary-bg:    linear-gradient(180deg, #34c759 0%, #30d158 100%);

    /* 语义色（iOS System Colors） */
    --blue:          #007aff;
    --orange:        #ff9500;
    --red:           #ff3b30;
    --purple:        #af52de;
    --teal:          #5ac8fa;

    /* 涨跌（A 股配色：红涨绿跌） */
    --up-color:      #ff3b30;
    --down-color:    #34c759;

    /* 文字（iOS Label Colors） */
    --text:          #000000;
    --text-secondary:#8e8e93;
    --text-light:    #aeaeb2;
    --text-tertiary: #c7c7cc;

    /* 背景（iOS Background Colors） */
    --bg:            #f2f2f7;    /* iOS systemGroupedBackground */
    --grouped-bg:    #f2f2f7;
    --card:          #ffffff;    /* iOS secondarySystemGroupedBackground */
    --card-inset:    #f2f2f7;

    /* 分隔线（iOS Separator Colors） */
    --border:        #e5e5ea;
    --separator:     #c6c6c8;
    --separator-opaque: #c6c6c8;

    /* 控件背景 */
    --control-bg:    rgba(118, 118, 128, 0.12);
    --control-bg-hover: rgba(118, 118, 128, 0.24);

    /* 阴影 */
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.04);
    --shadow:        0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg:     0 12px 32px rgba(0,0,0,0.12);

    /* 圆角（iOS Corner Radius） */
    --radius:        16px;       /* large */
    --radius-lg:     20px;
    --radius-sm:     10px;       /* small */
    --radius-xs:     6px;
    --radius-pill:   22px;       /* 胶囊 */

    /* 间距 */
    --space-xs:      4px;
    --space-sm:      8px;
    --space-md:      12px;
    --space-lg:      16px;
    --space-xl:      24px;
}

/* ========== 页面容器 ========== */
.page {
    max-width: 750px;
    margin: 0 auto;
    padding-bottom: 80px; /* 底部 TabBar 占位 */
    min-height: 100vh;
    position: relative;
    background: var(--bg);
}

/* ========== 顶部导航栏（iOS Navigation Bar） ========== */
/* 注意：首页 header 在 index.php 有内联绿色渐变样式，会覆盖这里 */
.header {
    background: rgba(242, 242, 247, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
    color: #000;
    padding: 12px 16px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
    letter-spacing: -0.02em;
}

.header-back {
    color: #007aff;              /* iOS Blue */
    font-size: 17px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
}

.header-back:hover {
    background: rgba(0, 122, 255, 0.1);
}

.header-back:active {
    background: rgba(0, 122, 255, 0.18);
    transform: scale(0.95);
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.header-actions button,
.header-actions a {
    color: #007aff;
    font-size: 15px;
    font-weight: 400;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s;
}

.header-actions button:active,
.header-actions a:active {
    background: rgba(0, 122, 255, 0.12);
}

/* ========== 底部 TabBar（iOS Tab Bar） ========== */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 750px;
    height: 60px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(60, 60, 67, 0.12);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 200;
}

.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    color: #8e8e93;             /* iOS Gray 2 — 未选中 */
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    transition: color 0.15s ease, transform 0.1s ease;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.tabbar-item.active {
    color: #34c759;             /* iOS Green — 选中 */
}

.tabbar-item:active {
    transform: scale(0.92);
}

.tabbar-item .icon {
    font-size: 22px;
    margin-bottom: 2px;
    line-height: 1;
}

/* ========== 卡片（iOS Grouped List Card） ========== */
.card {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    margin: 12px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
    margin-bottom: 12px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.card-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: -6px;
    margin-bottom: 12px;
}

/* Grouped Inset（iOS 内嵌列表风格） */
.card-inset {
    background: var(--bg);
    border-radius: 16px;
    padding: 0;
    margin: 12px 16px;
    overflow: hidden;
}

/* ========== 按钮（iOS System Button · 胶囊） ========== */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 22px;        /* 胶囊 */
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    text-align: center;
    letter-spacing: -0.01em;
    -webkit-user-select: none;
    user-select: none;
    line-height: 1.2;
}

.btn:active {
    transform: scale(0.96);
    opacity: 0.8;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #34c759;
    color: #fff;
}

.btn-primary:active {
    background: #30d158;
}

.btn-secondary {
    background: rgba(118, 118, 128, 0.12);
    color: #34c759;
    border: none;
}

.btn-secondary:active {
    background: rgba(118, 118, 128, 0.24);
}

.btn-danger {
    background: #ff3b30;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.4);
}

.btn-block {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 14px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 18px;
}

/* ========== 表格（iOS Inset Grouped Table） ========== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    background: #fff;
    margin: 12px 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.29);
    white-space: nowrap;
}

th {
    background: #f2f2f7;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: -0.01em;
    padding-top: 10px;
    padding-bottom: 10px;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* ========== 涨跌色（A 股配色） ========== */
.price-up   { color: var(--up-color); }
.price-down { color: var(--down-color); }
.price-same { color: var(--text-secondary); }

.diff-pos  { color: var(--up-color); font-weight: 600; }
.diff-neg  { color: var(--down-color); font-weight: 600; }
.diff-zero { color: var(--text-secondary); }

/* ========== 表单（iOS Grouped List Row） ========== */
.form-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.29);
    transition: background 0.15s;
}

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

.form-item:active {
    background: rgba(0, 0, 0, 0.03);
}

.form-label {
    flex: 0 0 100px;
    color: #000;
    font-size: 15px;
    font-weight: 400;
}

.form-input,
.form-select {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #000;
    text-align: right;
    padding: 0;
    -webkit-appearance: none;
}

.form-input::placeholder {
    color: #aeaeb2;
}

.form-select {
    text-align: right;
    padding-right: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238e8e93' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    padding-right: 18px;
}

.form-required::before {
    content: '*';
    color: var(--red);
    margin-right: 2px;
}

/* 表单分组容器 */
.form-group {
    margin: 16px 16px;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.form-group-title {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 8px 16px 0;
}

/* ========== 涨跌指示器（iOS Badge） ========== */
.change-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0;
}

.change-up {
    background: rgba(255, 59, 48, 0.1);
    color: var(--up-color);
}

.change-down {
    background: rgba(52, 199, 89, 0.1);
    color: var(--down-color);
}

.change-same {
    background: rgba(118, 118, 128, 0.12);
    color: var(--text-secondary);
}

/* ========== 空状态（iOS Empty） ========== */
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

/* ========== 分页（iOS Style） ========== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 13px;
}

.pagination-nav {
    display: flex;
    gap: 8px;
}

.pagination-nav button {
    padding: 8px 16px;
    border: none;
    background: rgba(118, 118, 128, 0.12);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #007aff;
    font-weight: 500;
    transition: background 0.15s, transform 0.1s;
}

.pagination-nav button:hover:not(:disabled) {
    background: rgba(118, 118, 128, 0.2);
}

.pagination-nav button:active:not(:disabled) {
    transform: scale(0.95);
}

.pagination-nav button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    color: var(--text-secondary);
}

.pagination-nav button.active {
    background: #34c759;
    color: #fff;
}

/* ========== 标签 / Tag ========== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(118, 118, 128, 0.12);
    color: var(--text-secondary);
}

.tag-primary { background: rgba(52,199,89,0.12); color: var(--primary); }
.tag-warning { background: rgba(255,149,0,0.12); color: var(--orange); }
.tag-danger  { background: rgba(255,59,48,0.12);  color: var(--red); }
.tag-info    { background: rgba(0,122,255,0.12);  color: var(--blue); }

/* ========== 分隔 ========== */
.separator {
    height: 0.5px;
    background: rgba(60, 60, 67, 0.29);
    margin: 0 16px;
}

/* ========== 安全区 ========== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tabbar { padding-bottom: calc(0px + env(safe-area-inset-bottom)); }
    .page   { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* ========== 响应式：平板 (751-1024px) ========== */
@media (min-width: 751px) {
    body {
        background: linear-gradient(135deg, #e8e8ed 0%, #d1d1d6 100%);
    }

    .page {
        max-width: 420px;
        min-width: 375px;
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
        min-height: 100vh;
        background: var(--bg);
        position: relative;
    }

    .tabbar {
        max-width: 420px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ========== PC 高端布局（macOS Big Sur 风格）========== */
@media (min-width: 1025px) {
    :root {
        --pc-bg: #0d0d1a;
        --pc-nav-bg: rgba(20, 20, 40, 0.85);
        --pc-aside-bg: rgba(22, 22, 42, 0.92);
        --pc-content-bg: #ffffff;
        --pc-gold: #d4af37;
        --pc-gold-light: #fce38a;
        --pc-gold-dark: #b8960c;
        --pc-green: #00c853;
        --pc-text: #ffffff;
        --pc-text-dim: rgba(255,255,255,0.6);
        --pc-text-muted: rgba(255,255,255,0.35);
        --pc-border: rgba(255,255,255,0.08);
        --pc-border-hover: rgba(255,255,255,0.16);
    }

    body {
        background: var(--pc-bg);
        margin: 0;
        padding: 0;
        /* macOS 桌面壁纸质感渐变 */
        background-image:
            radial-gradient(ellipse at 20% 10%, rgba(212,175,55,0.08) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 80%, rgba(0,200,83,0.06) 0%, transparent 50%);
    }

    body::before {
        display: none;
    }

    .tabbar { display: none !important; }

    /* ===== 左侧导航 — 深蓝黑毛玻璃 + 金色高亮 ===== */
    .desktop-nav {
        position: fixed;
        top: 0; left: 0;
        width: 260px;
        height: 100vh;
        z-index: 50;
        display: flex;
        flex-direction: column;
        padding: 24px 0;
        background: linear-gradient(180deg, rgba(15,15,35,0.92) 0%, rgba(10,10,25,0.95) 100%);
        backdrop-filter: blur(40px) saturate(200%);
        -webkit-backdrop-filter: blur(40px) saturate(200%);
        border-right: 1px solid rgba(255,255,255,0.06);
    }

    .desktop-nav-logo {
        color: var(--pc-gold);
        font-size: 20px;
        font-weight: 700;
        padding: 0 28px 24px;
        margin-bottom: 16px;
        border-bottom: 1px solid var(--pc-border);
        letter-spacing: 0.5px;
        text-shadow: 0 0 20px rgba(212,175,55,0.3);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .desktop-nav-item {
        color: var(--pc-text-dim);
        padding: 14px 28px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 12px;
        transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
        border-left: 3px solid transparent;
        margin: 2px 8px;
        border-radius: 8px;
        text-decoration: none;
    }

    .desktop-nav-item:hover {
        background: rgba(212,175,55,0.08);
        color: var(--pc-text);
        border-left-color: var(--pc-gold);
        transform: translateX(4px);
    }

    .desktop-nav-item.active {
        background: linear-gradient(90deg, rgba(212,175,55,0.15) 0%, rgba(212,175,55,0.02) 100%);
        color: var(--pc-gold);
        border-left-color: var(--pc-gold);
    }

    .desktop-nav-item span:first-child {
        font-size: 18px;
        width: 24px;
        text-align: center;
    }

    .desktop-nav-bottom {
        margin-top: auto;
        padding: 20px 28px;
        font-size: 12px;
        color: var(--pc-text-muted);
        border-top: 1px solid var(--pc-border);
        line-height: 1.8;
    }

    /* ===== 右侧面板 — 深色毛玻璃 ===== */
    .desktop-aside {
        position: fixed;
        top: 0; right: 0;
        width: 300px;
        height: 100vh;
        background: linear-gradient(180deg, rgba(18,18,38,0.92) 0%, rgba(12,12,28,0.95) 100%);
        backdrop-filter: blur(40px) saturate(200%);
        -webkit-backdrop-filter: blur(40px) saturate(200%);
        z-index: 50;
        padding: 24px 20px;
        overflow-y: auto;
        border-left: 1px solid rgba(255,255,255,0.06);
        box-sizing: border-box;
    }

    .desktop-aside::-webkit-scrollbar { width: 4px; }
    .desktop-aside::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

    .desktop-aside > div { margin-bottom: 0; }

    body.has-desktop-layout .page {
        max-width: none;
        width: auto;
        box-shadow: none;
        background: var(--pc-content-bg);
        margin-left: 260px;
        margin-right: 300px;
        min-height: 100vh;
        padding-bottom: 0;
    }

    body.has-desktop-layout .page .header {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* ===== 右侧面板内组件样式 ===== */
    .desktop-aside .aside-section {
        margin-bottom: 24px;
        background: rgba(255,255,255,0.04);
        border-radius: 14px;
        padding: 16px;
        border: 1px solid rgba(255,255,255,0.06);
    }

    .desktop-aside .aside-title {
        font-size: 13px;
        font-weight: 600;
        color: var(--pc-gold);
        margin-bottom: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .desktop-aside .aside-quote-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        font-size: 13px;
        color: var(--pc-text-dim);
        transition: color 0.2s;
    }

    .desktop-aside .aside-quote-item:last-child { border-bottom: none; }
    .desktop-aside .aside-quote-item:hover { color: var(--pc-text); }

    .desktop-aside .aside-quote-name {
        color: var(--pc-text);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 150px;
        font-weight: 500;
    }

    .desktop-aside .aside-quote-price {
        color: var(--pc-gold);
        font-weight: 700;
        font-size: 14px;
    }

    .desktop-aside .aside-notice-item {
        font-size: 13px;
        color: var(--pc-text-dim);
        padding: 8px 0;
        line-height: 1.5;
        border-bottom: 1px solid rgba(255,255,255,0.04);
    }

    .desktop-aside .aside-notice-item:last-child { border-bottom: none; }

    .desktop-aside .aside-vip-card {
        background: linear-gradient(135deg, #1a1a3a 0%, #0d0d1a 100%);
        border-radius: 16px;
        padding: 20px;
        border: 1px solid rgba(212,175,55,0.3);
        text-align: center;
    }

    .desktop-aside .aside-vip-title {
        color: var(--pc-gold);
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 6px;
    }

    .desktop-aside .aside-vip-desc {
        color: var(--pc-text-dim);
        font-size: 12px;
    }

    .desktop-aside .aside-vip-price {
        color: var(--pc-gold);
        font-size: 28px;
        font-weight: 800;
        margin: 12px 0;
    }

    .desktop-aside .aside-vip-btn {
        background: linear-gradient(135deg, var(--pc-gold) 0%, var(--pc-gold-dark) 100%);
        color: #0d0d1a;
        border: none;
        padding: 10px 28px;
        border-radius: 20px;
        font-weight: 600;
        font-size: 13px;
        cursor: pointer;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .desktop-aside .aside-vip-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 20px rgba(212,175,55,0.4);
    }
}

/* ========== 小屏安全 ========== */
@media (max-width: 750px) {
    .card {
        margin-left: 12px;
        margin-right: 12px;
    }

    .form-group {
        margin-left: 12px;
        margin-right: 12px;
    }
}

/* ========== 移动端+平板通用增强（≤1024px） ========== */
@media (max-width: 1024px) {
    /* 安全区适配（全面屏 iPhone） */
    body {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* Header 顶部安全区 */
    .header {
        padding-top: calc(12px + env(safe-area-inset-top, 0));
        height: auto;
        min-height: 48px;
    }

    /* 按钮点击区域放大（iOS HIG 44pt 最小） */
    .btn {
        min-height: 44px;
        font-size: 16px;
    }
    .btn-block {
        min-height: 50px;
        font-size: 17px;
    }

    /* TabBar 图标对齐优化 */
    .tabbar-item .icon {
        font-size: 24px;
        margin-bottom: 3px;
        line-height: 1;
        display: block;
    }
    .tabbar-item span:last-child {
        font-size: 10px;
        line-height: 1;
    }

    /* 表单行点击区域放大 */
    .form-item {
        min-height: 50px;
        padding: 14px 16px;
    }

    /* 卡片内边距微调 */
    .card {
        padding: 14px 16px;
        border-radius: 14px;
    }

    /* 分组列表容器圆角优化 */
    .card-inset,
    .form-group {
        border-radius: 14px;
    }
}
