/* ============================================================
   base.css — Global Foundation (Dark Theme)
   Path: Public/Static/css/base.css
   Note: legacy utility classes are KEPT with same names but
         re-tinted to match the new dark palette. Any Mobile view
         that references .fch / .fcc / .fcy / .allbtn will
         automatically inherit the new dark theme.
   ============================================================ */

/* ---------- CSS Design Tokens (Global) ---------- */
:root {
    --bg-main:        #030712;
    --bg-card:        #121826;
    --bg-input:       #070a13;
    --bg-elev:        #1b2233;
    --bg-hover:       rgba(37, 99, 235, 0.12);

    --btn-primary:    #2563eb;
    --btn-hover:      #1d4ed8;
    --btn-active:     #1e40af;
    --btn-disabled:   #374151;

    --text-main:      #e5e7eb;
    --text-title:     #ffffff;
    --text-muted:     #94a3b8;
    --text-hint:      #64748b;

    --border-line:    #1f2937;
    --border-soft:    rgba(255, 255, 255, 0.06);

    --up-color:       #0ecb81;
    --down-color:     #f5465c;

    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      16px;
    --shadow-card:    0 12px 30px -14px rgba(0, 0, 0, 0.55);
    --trans-base:     all .25s ease;
}

/* ---------- Global Reset ---------- */
html, body {
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    font-family: BinancePlex, 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- Placeholders ---------- */
::-webkit-input-placeholder { color: var(--text-muted); font-size: 14px; }
::-moz-placeholder          { color: var(--text-muted); font-size: 14px; opacity: 1; }
:-ms-input-placeholder      { color: var(--text-muted); font-size: 14px; }
::placeholder               { color: var(--text-muted); font-size: 14px; opacity: 1; }

/* ---------- Focus (Dark Inputs) ---------- */
input:focus,
select:focus,
textarea:focus {
    background: var(--bg-input);
    outline: 1px solid var(--btn-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ---------- Autofill fix ---------- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-main);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: var(--text-main);
}

/* ---------- Legacy Utility Classes (re-tinted) ---------- */
.fe6im { color: #ffffff !important; }
.fl    { float: left; }
.fr    { float: right; }
.bhalf { width: 50%; }
.allhg { height: 100%; }
.txtl  { text-align: left; }
.txtr  { text-align: right; }

.fcy   { color: var(--btn-primary); }
.fcc   { color: var(--text-muted); }
.fch   { color: var(--text-title); }

.fzm   { font-size: 12px; }
.fzmm  { font-size: 14px; }
.fzmmm { font-size: 16px; }
.fw    { font-weight: 600; }

.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
}

/* legacy buttons — re-styled */
.alltn {
    width: 100%;
    height: 44px;
    line-height: 44px;
    text-align: center;
    border-radius: var(--radius-sm);
    background: var(--btn-primary);
    color: #fff;
    transition: var(--trans-base);
}
.alltn:hover  { background: var(--btn-hover); }
.alltn:active { background: var(--btn-active); }

.allbtn {
    width: 100%;
    height: 50px;
    line-height: 50px;
    text-align: center;
    border-radius: var(--radius-sm);
    background: var(--btn-primary);
    color: #fff;
    margin-top: 20px;
    transition: var(--trans-base);
}
.allbtn:hover  { background: var(--btn-hover); transform: translateY(-1px); box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.5); }
.allbtn:active { background: var(--btn-active); transform: translateY(0); box-shadow: none; }

/* ---------- Reusable Semantic Classes (new) ---------- */
.bg-main   { background-color: var(--bg-main) !important; }
.bg-card   { background-color: var(--bg-card) !important; }
.bg-input  { background-color: var(--bg-input) !important; }

.card-box {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
}

.input-dark {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: var(--trans-base);
    box-sizing: border-box;
    -webkit-appearance: none;
}
.input-dark:focus {
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-primary {
    display: inline-block;
    height: 44px;
    line-height: 44px;
    padding: 0 24px;
    background: var(--btn-primary);
    color: #fff !important;
    border: none;
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    transition: var(--trans-base);
    -webkit-appearance: none;
}
.btn-primary:hover  { background: var(--btn-hover); transform: translateY(-1px); box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.5); }
.btn-primary:active { background: var(--btn-active); transform: translateY(0); box-shadow: none; }
.btn-primary:disabled,
.btn-primary.is-disabled {
    background: var(--btn-disabled);
    color: #9ca3af !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Anchor reset for dark theme */
a { color: var(--text-main); text-decoration: none; }
a:hover, a:link, a:visited, a:active {
    color: var(--text-main);
    text-decoration: none;
}

/* ============================================================
   Center-Aligned App Layout (Mobile Card on Desktop)
   Used by pages under Application/Mobile/View/User/
   ============================================================ */

body.app-body {
    background: var(--bg-main);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.app-layout-center {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--bg-main);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
@media (min-width: 481px) {
    .app-layout-center {
        box-shadow:
            0 0 0 1px var(--border-line),
            0 20px 60px -10px rgba(0, 0, 0, 0.55);
    }
}

/* --- Top Header --- */
.app-header {
    position: sticky;
    top: 0;
    height: 50px;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 100;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}
.app-header-back,
.app-header-action {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-title);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: background .2s;
    font-size: 20px;
}
.app-header-back:hover,
.app-header-action:hover { background: var(--bg-elev); }
.app-header-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-title);
    line-height: 50px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
}
.app-header .placeholder { width: 34px; height: 34px; flex-shrink: 0; }

/* --- Content wrapper --- */
.app-content {
    flex: 1;
    padding: 16px;
    box-sizing: border-box;
}
.app-content.has-bottom-bar { padding-bottom: 96px; }
.app-content.has-footer     { padding-bottom: 88px; }

/* --- Sticky bottom action bar (inside centered container) --- */
.app-bottom-bar {
    position: sticky;
    bottom: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(3, 7, 18, 0) 0%, var(--bg-main) 32%);
    z-index: 50;
}
.app-bottom-bar .btn-primary {
    display: block;
    width: 100%;
    height: 48px;
    line-height: 48px;
    border-radius: 12px;
    font-size: 15px;
}

/* --- Constrain fixed tabbar footer to the same 480px width --- */
body.app-body .footer {
    max-width: 480px !important;
}

/* --- Card, list, chip, form primitives for these pages --- */
.app-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-soft);
    margin-bottom: 12px;
}

.app-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-line);
    margin-bottom: 10px;
    color: var(--text-main);
    transition: var(--trans-base);
}
.app-list-item:hover { border-color: var(--btn-primary); }
.app-list-item .li-icon {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.app-list-item .li-icon img { width: 100%; height: 100%; object-fit: contain; }
.app-list-item .li-main  { flex: 1; min-width: 0; }
.app-list-item .li-title { color: var(--text-title); font-weight: 500; font-size: 14px; }
.app-list-item .li-sub   { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.app-list-item .li-right { color: var(--text-muted); font-size: 13px; text-align: right; }
.app-list-item .li-right .chevron { color: var(--text-hint); margin-left: 4px; }

.app-search {
    flex: 1;
    height: 36px;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-line);
    border-radius: 18px;
    padding: 0 12px;
    gap: 8px;
    color: var(--text-muted);
    margin: 0 6px;
}
.app-search input {
    flex: 1;
    background: transparent !important;
    border: none;
    outline: none !important;
    box-shadow: none !important;
    color: var(--text-main);
    font-size: 14px;
    padding: 0;
    height: 100%;
}
.app-search input:focus {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.app-section-title {
    font-size: 13px;
    color: var(--text-muted);
    margin: 6px 2px 10px;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.app-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    min-width: 68px;
    padding: 0 14px;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-line);
    color: var(--text-main) !important;
    font-size: 13px;
    font-weight: 600;
    margin: 0 8px 8px 0;
    transition: var(--trans-base);
    cursor: pointer;
    text-decoration: none;
}
.app-chip:hover  { border-color: var(--btn-primary); color: var(--text-title) !important; }
.app-chip.active { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff !important; }

.app-field { margin-bottom: 16px; }
.app-field-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}
.app-field-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: var(--trans-base);
    -webkit-appearance: none;
}
.app-field-input:focus {
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: var(--bg-input);
}
.app-field-input:disabled { color: var(--text-hint); background: #0b1120; cursor: not-allowed; }
.app-field-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}
.app-field-select option { background: var(--bg-card); color: var(--text-main); }

.app-upload {
    width: 100%;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px dashed var(--border-line);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 10px;
    transition: var(--trans-base);
    box-sizing: border-box;
}
.app-upload:hover { border-color: var(--btn-primary); }
.app-upload img { max-height: 100px; max-width: 100%; object-fit: contain; border-radius: 6px; }

.app-divider { height: 1px; background: var(--border-soft); margin: 12px 0; }

.app-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
}
.app-status.pending { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.app-status.success { background: rgba(14, 203, 129, 0.12); color: var(--up-color); }
.app-status.error   { background: rgba(245, 70, 92, 0.12);  color: var(--down-color); }

/* Hero surface (used by user index "总收益" panel) */
.app-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #121826 60%);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 12px;
    color: #fff;
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
}
.app-hero-label { font-size: 12px; color: rgba(255, 255, 255, 0.7); }
.app-hero-value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: 0.02em; }
.app-hero-grid  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.app-hero-grid  .cell-label { font-size: 11px; color: rgba(255, 255, 255, 0.6); }
.app-hero-grid  .cell-value { font-size: 15px; font-weight: 600; color: #fff; margin-top: 2px; }

/* Two-column quick action button row */
.app-actions-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.app-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    color: var(--text-title) !important;
    font-size: 14px;
    font-weight: 500;
    transition: var(--trans-base);
    text-decoration: none;
}
.app-action-btn:hover   { border-color: var(--btn-primary); color: var(--text-title) !important; }
.app-action-btn.primary { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff !important; }
.app-action-btn.primary:hover { background: var(--btn-hover); }
