/* ======================================================
   SFL FUTURES - STYLE.CSS
   ====================================================== */

/* ===== RESET & VARIABLES ===== */
:root {
    --bg-primary: #0B0E12;
    --bg-secondary: #1E2329;
    --bg-tertiary: #2B3139;
    --bg-hover: #3A4149;
    --text-primary: #FFFFFF;
    --text-secondary: #8E9AA8;
    --accent-gold: #F0B90B;
    --accent-green: #0ECB81;
    --accent-red: #F6465D;
    --border-color: #2B3139;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    padding-bottom: 70px;
}

/* ===== LOADING SCREEN ===== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-secondary);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-gold);
}

.balance {
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.balance span {
    color: var(--accent-gold);
    font-weight: bold;
    margin-left: 4px;
}

/* ===== SEARCH BOX ===== */
.search-box {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

/* ===== CONTENT ===== */
.content {
    padding: 16px;
}

.section-title {
    margin: 20px 0 10px;
    color: var(--accent-gold);
    font-size: 16px;
}

/* ===== PRICE INFO ===== */
.price-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.price-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.item-name {
    font-size: 24px;
    font-weight: bold;
}

.item-price {
    font-size: 20px;
    color: var(--accent-gold);
}

.price-change {
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
}

.price-change.positive {
    background: rgba(14, 203, 129, 0.1);
    color: var(--accent-green);
}

.price-change.negative {
    background: rgba(246, 70, 93, 0.1);
    color: var(--accent-red);
}

/* ===== CHART ===== */
.chart-container {
    height: 250px;
    margin: 20px 0;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 8px;
}

/* ===== TIMEFRAMES ===== */
.timeframes {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    justify-content: center;
}

.timeframe {
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.timeframe:hover {
    background: var(--bg-hover);
}

.timeframe.active {
    background: var(--accent-gold);
    color: var(--bg-primary);
    border-color: var(--accent-gold);
}

/* ===== TRADING PANEL ===== */
.trading-panel {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
}

/* Side Buttons */
.side-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.side-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.side-btn.long {
    background: rgba(14, 203, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.side-btn.long.active {
    background: var(--accent-green);
    color: white;
}

.side-btn.short {
    background: rgba(246, 70, 93, 0.1);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.side-btn.short.active {
    background: var(--accent-red);
    color: white;
}

/* Input Group */
.input-group {
    margin: 16px 0;
}

.input-label {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 14px;
}

.input-label span:last-child {
    color: var(--accent-gold);
}

.input-field {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.input-field.range {
    padding: 0;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.input-field.range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Quick Buttons */
.quick-buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.quick-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.quick-btn:hover {
    background: var(--accent-gold);
    color: var(--bg-primary);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.info-item {
    text-align: center;
}

.info-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    font-weight: bold;
}

.info-value.positive {
    color: var(--accent-green);
}

.info-value.negative {
    color: var(--accent-red);
}

/* Open Position Button */
.open-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent-gold);
    border: none;
    border-radius: 12px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.1s;
}

.open-btn:active {
    transform: scale(0.98);
}

/* ===== MARKET GRID ===== */
.market-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.market-item {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.market-item:hover {
    background: var(--bg-hover);
}

.market-item.selected {
    border: 2px solid var(--accent-gold);
}

.market-item-name {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 14px;
}

.market-item-price {
    color: var(--accent-gold);
    font-size: 14px;
}

/* ===== POSITIONS ===== */
.position-item {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    border-left: 4px solid;
    transition: transform 0.2s;
}

.position-item:hover {
    transform: translateX(4px);
}

.position-item.long {
    border-left-color: var(--accent-green);
}

.position-item.short {
    border-left-color: var(--accent-red);
}

.position-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.position-symbol {
    font-weight: bold;
}

.position-pnl {
    font-weight: bold;
}

.position-pnl.positive {
    color: var(--accent-green);
}

.position-pnl.negative {
    color: var(--accent-red);
}

.position-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 8px 0;
}

.close-position-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent-red);
    border: none;
    border-radius: 6px;
    color: white;
    margin-top: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
}

.close-position-btn:hover {
    opacity: 0.9;
}

/* ===== LEADERBOARD ===== */
.leaderboard-list {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.rank-1 { 
    color: gold; 
    font-weight: bold;
}

.rank-2 { 
    color: silver; 
    font-weight: bold;
}

.rank-3 { 
    color: #cd7f32; 
    font-weight: bold;
}

/* ===== PROFILE ===== */
.profile-header {
    text-align: center;
    margin: 20px 0;
}

.avatar {
    width: 60px;
    height: 60px;
    background: var(--accent-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 10px;
}

.username {
    font-size: 18px;
    font-weight: bold;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
}

.reset-btn {
    width: 100%;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--accent-red);
    margin-top: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: var(--accent-red);
    color: white;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--accent-gold);
}

.nav-icon {
    font-size: 20px;
}

/* ===== NOTIFICATION PANEL ===== */
.notification-panel {
    position: fixed;
    top: 80px;
    left: 16px;
    right: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-gold);
    border-radius: 12px;
    padding: 16px;
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 16px;
    right: 16px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    z-index: 1001;
    display: none;
    font-weight: bold;
    background: var(--bg-secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.toast.success {
    background: var(--accent-green);
}

.toast.error {
    background: var(--accent-red);
}

/* ===== PAGES ===== */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.text-positive {
    color: var(--accent-green);
}

.text-negative {
    color: var(--accent-red);
}

.text-gold {
    color: var(--accent-gold);
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    body {
        max-width: 400px;
        margin: 0 auto;
        background: var(--bg-primary);
    }
}

@media (max-width: 360px) {
    .info-grid {
        gap: 8px;
        padding: 12px;
    }
    
    .info-value {
        font-size: 12px;
    }
    
    .item-name {
        font-size: 20px;
    }
    
    .item-price {
        font-size: 18px;
    }
}