/* 
   RV Trading - Premium Gold & Black CSS Design System
   Compatible with Responsive Desktop dashboards & Native Mobile PWA Views
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #070708;
    --bg-surface: rgba(18, 18, 20, 0.75);
    --bg-surface-opaque: #121214;
    --gold: #d4af37;
    --gold-light: #f3cd5f;
    --gold-dark: #aa7c11;
    --gold-glow: rgba(212, 175, 55, 0.35);
    --gold-gradient: linear-gradient(135deg, #f3cd5f 0%, #aa7c11 100%);
    --green: #26a69a;
    --green-glow: rgba(38, 166, 154, 0.15);
    --red: #ef5350;
    --red-glow: rgba(239, 83, 80, 0.15);
    --text-white: #ffffff;
    --text-silver: #c0c0c2;
    --text-gray: #7d7d82;
    --border-glass: rgba(212, 175, 55, 0.15);
    --border-glass-focused: rgba(212, 175, 55, 0.4);
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --font-primary: 'Outfit', sans-serif;
    --notch-padding: env(safe-area-inset-top, 0px);
}

/* =========================================================================
   RESET & BASE STYLES
   ========================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-primary);
    overflow-x: hidden;
    line-height: 1.5;
    padding-top: var(--notch-padding);
}

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

button, input, select, textarea {
    font-family: inherit;
    background: none;
    border: none;
    outline: none;
    color: inherit;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #08080a;
}
::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* =========================================================================
   GLASSMORPHISM & GLOW UTILITIES
   ========================================================================= */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: var(--shadow-main);
}

.gold-glow-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.gold-glow-hover:hover {
    border-color: var(--gold);
    box-shadow: 0 0 15px var(--gold-glow);
}

.gold-btn {
    background: var(--gold-gradient);
    color: #000000;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}
.gold-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
    filter: brightness(1.1);
}
.gold-btn:active {
    transform: translateY(0);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-white);
    font-weight: 600;
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.glass-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
}

/* =========================================================================
   LAYOUTS & RESPONSIVE GRID
   ========================================================================= */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Desktop Header Navigation */
.main-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(7, 7, 8, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 1px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo img {
    height: 35px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
    list-style: none;
}
.nav-link {
    font-weight: 500;
    color: var(--text-silver);
    transition: color 0.3s ease;
}
.nav-link:hover, .nav-link.active {
    color: var(--gold);
}

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

/* Mobile Bottom Navigation (Hidden on Desktop) */
.mobile-nav {
    display: none;
}

/* =========================================================================
   PUBLIC PAGES STYLING (Landing, Markets, About)
   ========================================================================= */
.hero-section {
    padding: 100px 0 80px;
    text-align: center;
    position: relative;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.08) 0%, rgba(7, 7, 8, 1) 70%);
}
.hero-title {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 24px;
}
.hero-title span {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-subtitle {
    color: var(--text-silver);
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto 40px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin: 60px 0;
}
.feature-card {
    padding: 30px;
    text-align: left;
}
.feature-icon {
    font-size: 36px;
    margin-bottom: 20px;
    color: var(--gold);
}
.feature-card h3 {
    margin-bottom: 12px;
    font-size: 20px;
}
.feature-card p {
    color: var(--text-silver);
    font-size: 14px;
}

/* =========================================================================
   TRADING VIEW & CONTROLS
   ========================================================================= */
.trading-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.coin-list-panel {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}
.search-box {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
}
.coin-rows {
    flex: 1;
    overflow-y: auto;
}
.coin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: background 0.2s ease;
}
.coin-row:hover, .coin-row.active {
    background: rgba(212, 175, 55, 0.05);
}
.coin-symbol {
    font-weight: 700;
}
.coin-name {
    font-size: 12px;
    color: var(--text-gray);
}
.price-up {
    color: var(--green);
}
.price-down {
    color: var(--red);
}

/* Order Book */
.orderbook {
    display: flex;
    flex-direction: column;
    height: 50%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.orderbook-title {
    padding: 10px 15px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
}
.orderbook-list {
    flex: 1;
    overflow-y: hidden;
    padding: 0 15px;
    font-family: monospace;
    font-size: 12px;
}

/* Trade Order Panel */
.order-panel {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    background: #0d0d0f;
}
.order-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.order-tab {
    flex: 1;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
}
.order-tab.buy {
    color: var(--text-gray);
}
.order-tab.buy.active {
    border-bottom: 3px solid var(--green);
    color: var(--green);
    background: rgba(38, 166, 154, 0.03);
}
.order-tab.sell {
    color: var(--text-gray);
}
.order-tab.sell.active {
    border-bottom: 3px solid var(--red);
    color: var(--red);
    background: rgba(239, 83, 80, 0.03);
}

.order-form {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
}
.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 12px;
}
.input-wrapper input {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}
.input-suffix {
    color: var(--text-gray);
    font-weight: 700;
    font-size: 14px;
}

/* =========================================================================
   FORMS & INPUTS (General Views)
   ========================================================================= */
.auth-container {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}
.auth-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
}
.auth-subtitle {
    color: var(--text-gray);
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

/* =========================================================================
   PWA DYNAMIC POPUPS
   ========================================================================= */
.install-popup {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    padding: 24px;
    z-index: 1000;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(18, 18, 20, 0.85);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
}
.install-popup.show {
    bottom: 24px;
}
.popup-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
}
.popup-icon {
    width: 50px;
    height: 50px;
    background: var(--gold-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #000;
}
.popup-meta h4 {
    font-size: 18px;
    font-weight: 700;
}
.popup-meta p {
    font-size: 12px;
    color: var(--text-gray);
}
.popup-actions {
    display: flex;
    gap: 12px;
}
.popup-actions button {
    flex: 1;
}

/* Layout Resizer Splitters */
.resize-handle {
    width: 6px;
    cursor: col-resize;
    background: rgba(255, 255, 255, 0.02);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
    height: 100%;
    z-index: 10;
}
.resize-handle:hover, .resize-handle.active {
    background: var(--gold);
    border-left: none;
    border-right: none;
}

/* =========================================================================
   MEDIA QUERIES - MOBILE STYLE CONVERSIONS
   ========================================================================= */
@media (max-width: 992px) {
    .resize-handle {
        display: none !important;
    }
    #panelCoins, #panelOrder {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }
    .trading-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }
    .coin-list-panel {
        display: none; /* Mobile switches coin via top drawer */
    }
    .order-panel {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
}

@media (max-width: 768px) {
    /* Hide Desktop Nav Header */
    .main-header {
        height: 60px;
        padding: 0 20px;
    }
    .nav-links, .header-actions {
        display: none;
    }

    body {
        padding-bottom: 70px; /* Space for Mobile Bottom Nav */
    }

    /* Mobile bottom navigation */
    .mobile-nav {
        display: flex !important; /* Forces it to show layout instead of default display:none */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: rgba(10, 10, 12, 0.92);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-top: 1px solid rgba(212, 175, 55, 0.15);
        z-index: 900;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-gray);
        font-size: 11px;
        font-weight: 500;
        gap: 4px;
        cursor: pointer;
        flex: 1;
        padding: 8px 0;
    }
    .mobile-nav-item i {
        font-size: 20px;
    }
    .mobile-nav-item.active {
        color: var(--gold);
    }
    .mobile-nav-item.active i {
        filter: drop-shadow(0 0 5px var(--gold-glow));
    }

    /* Mobile trading viewport switcher */
    .mobile-trade-tabs {
        display: none;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        background: #0c0c0e;
        position: sticky;
        top: 65px;
        z-index: 90;
    }
    .mobile-trade-tab {
        flex: 1;
        padding: 12px 5px;
        text-align: center;
        font-size: 13px;
        font-weight: 700;
        color: var(--text-gray);
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .mobile-trade-tab.active {
        color: var(--gold);
        border-bottom: 2px solid var(--gold);
        background: rgba(212, 175, 55, 0.05);
    }

    /* Responsive viewport switches override on smaller screens */
    @media (max-width: 992px) {
        .trading-container {
            flex-direction: column !important;
            height: calc(100vh - 65px - 65px) !important;
        }
        .mobile-trade-tabs {
            display: flex !important;
        }
        
        .trading-container.tab-chart #panelChart {
            display: flex !important;
            flex: 1 !important;
            width: 100% !important;
        }
        .trading-container.tab-chart #panelCoins {
            display: none !important;
        }
        .trading-container.tab-chart #panelOrder {
            display: none !important;
        }

        .trading-container.tab-markets #panelChart {
            display: none !important;
        }
        .trading-container.tab-markets #panelCoins {
            display: flex !important;
            flex: 1 !important;
            width: 100% !important;
            max-width: none !important;
        }
        .trading-container.tab-markets #panelOrder {
            display: none !important;
        }

        .trading-container.tab-trade #panelChart {
            display: none !important;
        }
        .trading-container.tab-trade #panelCoins {
            display: none !important;
        }
        .trading-container.tab-trade #panelOrder {
            display: flex !important;
            flex: 1 !important;
            width: 100% !important;
            max-width: none !important;
        }
    }

    /* Mobile drawer variables */
    aside {
        position: fixed;
        top: 0;
        left: -280px; /* Hide off-screen by default */
        width: 280px;
        height: 100vh;
        z-index: 1001; /* Layer it above standard layouts */
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: #0c0c0e !important;
        border-right: 1px solid rgba(212, 175, 55, 0.15);
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.85);
        display: flex !important; /* Force sidebar structure */
    }
    aside.open {
        left: 0; /* Slide in drawer */
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1000;
    }
    .sidebar-overlay.open {
        display: block;
    }

    .mobile-only-header {
        display: flex !important;
    }
    .mobile-only-drawer-profile {
        display: block !important;
        background: rgba(0, 0, 0, 0.2);
    }
    .mobile-header-detail-group {
        display: none !important; /* Hide standard layout header info on mobile */
    }
    .hamburger-btn {
        display: flex !important; /* Show hamburger button on mobile header */
    }
}

/* Desktop defaults (Hide drawer configurations) */
.hamburger-btn {
    display: none;
}
.sidebar-overlay {
    display: none;
}
.mobile-only-header {
    display: none;
}
.mobile-only-drawer-profile {
    display: none;
}

@media (min-width: 769px) {
    aside {
        position: static !important;
        width: 240px !important;
        height: auto !important;
        box-shadow: none !important;
        border-right: 1px solid rgba(255,255,255,0.05) !important;
    }
    .mobile-header-detail-group {
        display: flex !important;
    }
}

