/* ========================================================================
   iOS 26 / MacOS 26 Future Theme
   Author: Angel Trading System
   Version: 1.0.0
   ======================================================================== */

:root {
    /* Color Palette - Future OS (Restore V1 Radiance) */
    --ios-bg-primary: #f5f5f7;
    --ios-glass-bg: rgba(255, 255, 255, 0.65);
    /* 恢复到 V1 的亮色 */
    --ios-glass-border: rgba(255, 255, 255, 0.4);
    --ios-glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

    --ios-primary: #007AFF;
    --ios-primary-gradient: linear-gradient(135deg, #007AFF 0%, #00C6FF 100%);
    --ios-success-gradient: linear-gradient(135deg, #34C759 0%, #30D158 100%);

    --ios-text-primary: #1d1d1f;
    --ios-text-secondary: #86868b;

    --ios-radius-lg: 24px;
    --ios-radius-md: 16px;
    --ios-radius-sm: 12px;

    --ios-font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 1. Global Reboot - 简化背景提升性能 */
body {
    font-family: var(--ios-font-stack) !important;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%) !important;
    color: var(--ios-text-primary) !important;
    letter-spacing: -0.01em;
}

/* 2. Login Panel Transformation */
.wrapper {
    background: transparent !important;
}

.block-center {
    margin-top: 10vh !important;
}

.wd-xl {
    width: 380px !important;
    margin: 0 auto;
}

/* Glassmorphism Card (V1 Style with V2 Heading Fix) */
.panel {
    background: var(--ios-glass-bg) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-radius: var(--ios-radius-lg) !important;
    border: 1px solid var(--ios-glass-border) !important;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 20px 50px -12px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
}

/* 关键修复：消除顶部色块，通过彻底统一背景 */
.panel-heading,
.panel-body,
.panel-footer {
    background: transparent !important;
    border: none !important;
}


.panel-heading {
    padding: 10px 20px 0 !important;
    /* 减少顶部留白 */
    text-align: center;
}

/* 强制取消所有旧主题的背景/边框类 */
.panel-dark,
.panel-flat,
.panel-default {
    background: transparent !important;
}

.panel-body {
    padding: 30px !important;
}

/* Logo 优化 - 针对白色 Logo 增加柔和外发光，模拟 iOS 图标质感 */
.panel-heading img {
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    max-height: 40px;
}

/* 提示文字 - 使用更优雅的 SF-like 风格 */
.pv {
    font-weight: 500;
    color: var(--ios-text-secondary);
    margin-bottom: 35px !important;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.8;
}

/* Inputs (Restore V1 Glassy Input) */
.form-group {
    margin-bottom: 22px !important;
    position: relative;
}

.form-control {
    background-color: rgba(255, 255, 255, 0.7) !important;
    border: none !important;
    border-radius: var(--ios-radius-sm) !important;
    height: 48px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06) !important;
    transition: all 0.3s ease !important;
}

.form-control::placeholder {
    color: rgba(0, 0, 0, 0.3) !important;
}

.form-control:focus {
    background-color: #fff !important;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15), inset 0 1px 3px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-1px);
}

/* 修正图标位置 */
.form-control-feedback {
    line-height: 48px !important;
    height: 48px !important;
    color: var(--ios-text-secondary) !important;
    right: 16px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons (Restore V1 Gradient) */
.btn {
    border: none !important;
    border-radius: var(--ios-radius-md) !important;
    font-weight: 600 !important;
    height: 50px !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

.btn-primary {
    background: var(--ios-primary-gradient) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2) !important;
}

.btn-success {
    background: var(--ios-success-gradient) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.2) !important;
}

.btn:active {
    transform: scale(0.96);
}

/* Footer 版权信息 */
.mt-lg.text-center {
    margin-top: 30px !important;
    color: rgba(0, 0, 0, 0.4) !important;
    font-size: 13px;
    font-weight: 500;
}

/* ========================================================================
   Part 3. Dashboard Components (Universal Glass UI)
   ======================================================================== */

/* Dashboard Layout Helpers */
.dashboard-wrapper {
    background: transparent !important;
    min-height: calc(100vh - 60px) !important;
    padding: 16px 20px;
    /* Condensed from 24px 32px */
    margin: -15px !important;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    /* Reduced from 32px */
    padding: 0 4px;
}

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--ios-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.dashboard-header h1 svg {
    color: var(--ios-primary);
    filter: drop-shadow(0 2px 4px rgba(0, 122, 255, 0.3));
}

/* Universal Glass Container (Stat Cards, Panels, Magnets) */
.glass-panel,
.stat-card,
.content-panel,
.ticker-card {
    background: rgba(255, 255, 255, 0.92) !important;
    /* 高不透明度，无模糊 */
    border-radius: var(--ios-radius-lg) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
    transition: box-shadow 0.3s ease;
    overflow: hidden;
}

/* Hover Effect for Interactive Cards - 只变阴影，不移动 */
.stat-card:hover,
.ticker-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

/* ========================================================================
   Part 4. Shared Tables (Modern Glass Table)
   ======================================================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--ios-radius-lg);
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* 增强表格边框可见度 */
.modern-table td,
.modern-table th {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    /* 加深边框 */
    border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
    /* 加深竖线 */
}

.modern-table th:last-child,
.modern-table td:last-child {
    border-right: none !important;
}

.modern-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.modern-table th {
    padding: 6px 8px;
    background: #f8fafc !important;
    /* 不透明背景，性能最佳 */
    color: var(--ios-text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    box-shadow: none !important;
    /* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 移除此行提升性能 */
}

.modern-table td {
    padding: 2px 4px;
    /* 紧凑布局 */
    color: var(--ios-text-primary);
    font-size: 12px;
    vertical-align: middle;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    background-color: transparent;
}

.modern-table tbody tr {
    transition: background-color 0.2s ease;
}

.modern-table tbody tr:hover {
    background-color: rgba(0, 122, 255, 0.08) !important;
    /* 悬停高亮 */
}

/* Dashboard Main Layout */
.sections-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.main-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    /* Auto grid for config panels */
    gap: 20px;
}

.side-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Stat Grid System */
.stats-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 16px;
    /* Reduced from 24px */
    margin-bottom: 24px;
    /* Reduced from 40px */
}

.stat-card {
    padding: 16px 20px;
    /* Reduced from 24px 28px */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card.featured {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4)) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 26px;
    /* Reduced from 32px */
    font-weight: 700;
    color: var(--ios-text-primary);
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-card.featured .stat-value {
    font-size: 32px;
    /* Reduced from 40px */
    background: linear-gradient(135deg, #1d1d1f 0%, #434344 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-subtext {
    font-size: 13px;
    font-weight: 500;
    color: var(--ios-text-secondary);
    opacity: 0.8;
}

/* Modern Input Fields (iOS Search Style) */
.modern-input {
    background: rgba(255, 255, 255, 0.8);
    /* 提高不透明度 */
    border: none;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--ios-text-primary);
    width: 120px;
    transition: all 0.3s ease;
    /* backdrop-filter: blur(5px);  <-- 移除此行，性能杀手 */
}

.modern-input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15), inset 0 1px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

select.modern-input {
    width: auto;
    min-width: 140px;
    cursor: pointer;
}

/* Inline Input - 表格内嵌输入框 */
.modern-input-inline {
    background: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ios-text-primary);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
    outline: none;
    transition: all 0.2s ease;
}

.modern-input-inline:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15), inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* 隐藏数字输入框的上下箭头 */
.modern-input-inline::-webkit-outer-spin-button,
.modern-input-inline::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.modern-input-inline[type=number] {
    -moz-appearance: textfield;
}

/* Small Button - 表格内小按钮（扁平化风格） */
.btn-xs {
    padding: 2px 10px !important;
    height: 24px !important;
    line-height: 20px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    border: none !important;
    border-radius: 12px !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    /* 强制移除默认阴影 */
    margin: 0 !important;
}

.btn-xs.btn-primary {
    background: #007AFF !important;
    /* 纯色背景，更扁平 */
    color: #fff !important;
}

.btn-xs.btn-primary:hover {
    background: #0066d6 !important;
    opacity: 1 !important;
}

.btn-xs.btn-primary:active {
    transform: scale(0.96);
    opacity: 0.9;
}

/* Modern Actions Buttons */
.btn-modern {
    background: var(--ios-primary);
    background-image: var(--ios-primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.4);
}

.btn-secondary {
    background: rgba(0, 122, 255, 0.1) !important;
    background-image: none !important;
    color: var(--ios-primary) !important;
    box-shadow: none !important;
}

.btn-secondary:hover {
    background: rgba(0, 122, 255, 0.15) !important;
    transform: translateY(-2px);
    box-shadow: none !important;
}

/* Content Panels Headers & Bodies */
.content-panel {
    padding: 0;
    overflow: visible !important;
}

.panel-header {
    padding: 16px 24px 12px;
    /* Condensed header */
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--ios-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-panel .panel-body {
    padding: 4px 24px 20px !important;
    /* Tighter body */
}

/* Ticker Bar (Live Prices) */
.ticker-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    /* Reduced gap */
    margin-bottom: 24px;
}

.ticker-card {
    padding: 12px 16px;
    /* Smaller cards */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ticker-info {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ticker-pair {
    font-size: 14px;
    font-weight: 700;
    color: var(--ios-text-primary);
    margin-bottom: 4px;
}

.ticker-price {
    font-size: 16px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--ios-primary);
}

/* Chart Container */
.chart-container {
    height: 200px;
    margin-top: 16px;
    position: relative;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--ios-radius-md);
    border: 1px dashed rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ios-text-secondary);
    font-size: 13px;
}

.chart-container::after {
    content: 'Chart Visualization Area';
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.activity-icon.sell {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger);
}

.activity-icon.buy {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
}

/* Renamed to avoid affecting Login panel-body */

/* Data Rows */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    /* Reduced from 20px */
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.data-row:last-child {
    border-bottom: none;
}

.data-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.data-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ios-text-primary);
}

.data-desc {
    font-size: 13px;
    color: var(--ios-text-secondary);
}

.data-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Health Pills */
.health-pill {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.2s;
}

.health-pill:hover {
    background: rgba(255, 255, 255, 0.6);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.status-indicator.online {
    background-color: #34C759;
    box-shadow: 0 0 10px #34C759;
}

.status-indicator.offline {
    background-color: #FF3B30;
}

/* Special Utilities */
.val-success {
    color: #34C759 !important;
    font-weight: 600;
}

.val-danger {
    color: #FF3B30 !important;
    font-weight: 600;
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sections-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card.featured {
        grid-column: span 1;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* ========================================================================
   Part 5. Mobile Sidebar Overlay Fix (Drawer Mode)
   ======================================================================== */
@media (max-width: 991px) {

    /* 1. Stop content from pushing out (High specificity) */
    body.aside-toggled .wrapper>section,
    body.aside-toggled .wrapper>footer {
        transform: none !important;
        margin-left: 0 !important;
    }

    /* 2. Style Sidebar as a High-Quality Overlay Drawer (High specificity) */
    body.aside-toggled .wrapper>.aside {
        transform: translate3d(0, 0, 0) !important;
        left: 0 !important;
        margin-left: 0 !important;
        width: 280px !important;
        /* 强制锁定宽度，解决截断 */

        background: rgba(255, 255, 255, 0.9) !important;
        backdrop-filter: blur(25px) saturate(180%);
        -webkit-backdrop-filter: blur(25px) saturate(180%);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.1);
        /* 减弱阴影，使其更平滑细腻 */
        z-index: 9999 !important;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        border: none !important;
        /* 彻底移除右侧边框线 */
        display: block !important;
    }

    body.aside-toggled .wrapper>.aside .aside-inner {
        width: 280px !important;
        padding-top: 55px !important;
        background: transparent !important;
        border: none !important;
    }

    /* 3. Force Accordion Appearance & Text Visibility */
    body.aside-toggled .sidebar .nav>li>a {
        justify-content: flex-start !important;
        padding: 14px 20px !important;
        border-radius: 12px;
        margin: 2px 10px;
        width: auto !important;
    }

    body.aside-toggled .sidebar .nav>li>a>span {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        font-size: 14px !important;
        font-weight: 600 !important;
    }

    body.aside-toggled .sidebar .nav>li>a>svg {
        margin-right: 12px !important;
        color: #007AFF !important;
        display: block !important;
    }

    /* 4. Kill Floating Submenus & Popups */
    .nav-floating,
    .dropdown-backdrop,
    .sidebar-subnav.nav-floating {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Ensure subnav expands internally (Accordion) */
    body.aside-toggled .sidebar .nav .sidebar-subnav {
        position: static !important;
        display: none;
        background: rgba(0, 0, 0, 0.03) !important;
        padding: 4px 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        width: 100% !important;
        float: none !important;
    }

    body.aside-toggled .sidebar .nav .sidebar-subnav.in,
    body.aside-toggled .sidebar .nav .sidebar-subnav.show {
        display: block !important;
    }

    body.aside-toggled .sidebar .nav .sidebar-subnav>li>a {
        padding-left: 52px !important;
        font-size: 13px !important;
        color: #48484a !important;
    }

    /* 5. Modern Background Dimming */
    body.aside-toggled .wrapper::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 9990;
        animation: fadeIn 0.4s ease-out;
        pointer-events: auto;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}