/* 
 * Lupin Trade - Stylesheet
 * Modern Vanilla CSS with Custom Properties, Dark Mode, and Glassmorphism
 */

 :root[data-theme="dark"] {
    --bg-base: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    
    --color-up: #10b981;
    --color-down: #ef4444;
    --color-up-bg: rgba(16, 185, 129, 0.15);
    --color-down-bg: rgba(239, 68, 68, 0.15);
    
    --glow: 0 0 20px rgba(59, 130, 246, 0.3);
}

:root[data-theme="light"] {
    --bg-base: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    
    --color-up: #059669;
    --color-down: #dc2626;
    --color-up-bg: rgba(5, 150, 105, 0.15);
    --color-down-bg: rgba(220, 38, 38, 0.15);
    
    --glow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background Animated Shapes */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 20s infinite alternate;
}

.bg-shape-1 {
    width: 400px;
    height: 400px;
    background: rgba(59, 130, 246, 0.2);
    top: -100px;
    left: -100px;
}

.bg-shape-2 {
    width: 500px;
    height: 500px;
    background: rgba(16, 185, 129, 0.15);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 50px); }
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glow);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Navigation */
#navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 0 16px 16px;
    border-top: none;
    border-left: none;
    border-right: none;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: white;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.nav-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-success {
    background: var(--color-up);
    color: white;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-buy {
    background: var(--color-up);
    color: white;
    font-size: 1.1rem;
    padding: 0.8rem;
}

.btn-sell {
    background: var(--color-down);
    color: white;
    font-size: 1.1rem;
    padding: 0.8rem;
}

.btn-full {
    width: 100%;
    margin-top: 1rem;
}

/* Ticker */
.market-ticker {
    margin: 1.5rem auto;
    max-width: 1400px;
    border-radius: 8px;
    padding: 0.8rem;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-content {
    display: inline-block;
    animation: ticker 30s linear infinite;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 2rem;
    font-weight: 500;
}

.up { color: var(--color-up); }
.down { color: var(--color-down); }

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Dashboard Layout */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.portfolio-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
}

.summary-info h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.summary-info .balance {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
:root[data-theme="light"] .summary-info .balance {
    background: linear-gradient(135deg, #0f172a, #64748b);
    -webkit-background-clip: text;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 300px 350px;
    gap: 1.5rem;
    align-items: start;
}

/* Common Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
    border-bottom: 1px solid var(--glass-border);
}

.panel-header h3 {
    font-size: 1.1rem;
}

/* Chart Section */
.chart-section {
    height: 600px;
    display: flex;
    flex-direction: column;
}

.timeframes {
    display: flex;
    gap: 0.5rem;
}

.time-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.time-btn:hover {
    background: var(--glass-border);
}

.time-btn.active {
    background: var(--accent-primary);
    color: white;
}

.chart-container {
    flex: 1;
    padding: 1rem;
    position: relative;
}

.mock-chart {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.mock-chart svg {
    width: 100%;
    height: 100%;
}

.chart-line {
    animation: drawArea 3s ease-out forwards;
}

.chart-stroke {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 3s ease-out forwards;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}
@keyframes drawArea {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.candles {
    position: absolute;
    bottom: 10%;
    left: 0;
    width: 100%;
    height: 80%;
    pointer-events: none;
}

.candle {
    position: absolute;
    width: 8px;
    border-radius: 4px;
    opacity: 0.8;
}

.candle::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 140%;
    top: -20%;
    z-index: -1;
}

.candle.up {
    background: var(--color-up);
}
.candle.up::before { background: var(--color-up); }

.candle.down {
    background: var(--color-down);
}
.candle.down::before { background: var(--color-down); }

.candle.active {
    animation: pulseCandle 2s infinite;
}

@keyframes pulseCandle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; box-shadow: 0 0 10px var(--color-up); }
}

/* Order Book */
.order-book {
    height: 600px;
    display: flex;
    flex-direction: column;
}

.order-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.order-table-container::-webkit-scrollbar {
    width: 4px;
}
.order-table-container::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.order-table th, .order-table td {
    padding: 0.5rem;
    text-align: right;
}

.order-table th:first-child, .order-table td:first-child {
    text-align: left;
}

.order-table th {
    color: var(--text-secondary);
    font-weight: 500;
    position: sticky;
    top: 0;
    background: var(--bg-surface);
}

.order-table tr {
    position: relative;
    cursor: pointer;
}

.order-table tr:hover {
    background: var(--glass-border);
}

/* Visual Depth Bar for Order Book */
.asks tr::after, .bids tr::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    z-index: -1;
    opacity: 0.2;
}

.asks tr::after { background: var(--color-down); }
.bids tr::after { background: var(--color-up); }

.asks td:first-child { color: var(--color-down); }
.bids td:first-child { color: var(--color-up); }

.current-price-row td {
    text-align: center !important;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 1rem 0;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

/* Quick Trade Section */
.quick-trade {
    height: fit-content;
}

.trade-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
}

.trade-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
}

.trade-tab.active[data-type="buy"] {
    color: var(--color-up);
    border-bottom: 2px solid var(--color-up);
}

.trade-tab.active[data-type="sell"] {
    color: var(--color-down);
    border-bottom: 2px solid var(--color-down);
}

.trade-form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.glass-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
:root[data-theme="light"] .glass-input {
    background: rgba(255, 255, 255, 0.5);
}

.glass-input:focus {
    border-color: var(--accent-primary);
}

.form-summary {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px dashed var(--glass-border);
    font-weight: 600;
    font-size: 1.1rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr 300px;
    }
    .quick-trade {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .quick-trade {
        grid-column: span 1;
    }
    .nav-links {
        display: none;
    }
}
