/**
 * Binary Options Trading Platform - Main Stylesheet
 * Dark Theme Trading Interface
 */

/* =====================
   CSS Variables
===================== */
:root {
    /* Primary Colors */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2332;
    --bg-card: #151c28;
    --bg-hover: #1e2738;
    
    /* Accent Colors */
    --accent-green: #00d09c;
    --accent-green-dark: #00a87a;
    --accent-green-light: #00ffbb;
    --accent-red: #ff5252;
    --accent-red-dark: #d43f3f;
    --accent-red-light: #ff6b6b;
    --accent-blue: #3b82f6;
    --accent-yellow: #fbbf24;
    --accent-purple: #8b5cf6;
    --accent-orange: #f97316;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-dark: #374151;
    
    /* Border Colors */
    --border-color: #1f2937;
    --border-light: #374151;
    
    /* Gradients */
    --gradient-green: linear-gradient(135deg, #00d09c 0%, #00a87a 100%);
    --gradient-red: linear-gradient(135deg, #ff5252 0%, #d43f3f 100%);
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-dark: linear-gradient(135deg, #1a2332 0%, #111827 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow-green: 0 0 20px rgba(0, 208, 156, 0.3);
    --shadow-glow-red: 0 0 20px rgba(255, 82, 82, 0.3);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* =====================
   Reset & Base
===================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-green);
}

img {
    max-width: 100%;
    height: auto;
}

/* =====================
   Typography
===================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }
.text-blue { color: var(--accent-blue) !important; }
.text-yellow { color: var(--accent-yellow) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

/* =====================
   Layout
===================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-normal);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.content {
    flex: 1;
    padding: 1.5rem;
}

/* =====================
   Sidebar Styles
===================== */
.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--gradient-green);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-hover);
    color: var(--accent-green);
    border-left-color: var(--accent-green);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* =====================
   Cards
===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* Stats Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--accent-green);
    box-shadow: var(--shadow-glow-green);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stat-card .stat-icon.green { background: rgba(0, 208, 156, 0.15); color: var(--accent-green); }
.stat-card .stat-icon.red { background: rgba(255, 82, 82, 0.15); color: var(--accent-red); }
.stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.stat-card .stat-icon.yellow { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }
.stat-card .stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stat-card .stat-change {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.stat-card .stat-change.positive { color: var(--accent-green); }
.stat-card .stat-change.negative { color: var(--accent-red); }

/* =====================
   Buttons
===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow-green);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--gradient-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    box-shadow: var(--shadow-glow-red);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* Trade Buttons */
.btn-up {
    background: var(--gradient-green);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
}

.btn-up:hover {
    box-shadow: var(--shadow-glow-green);
    transform: scale(1.02);
}

.btn-down {
    background: var(--gradient-red);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
}

.btn-down:hover {
    box-shadow: var(--shadow-glow-red);
    transform: scale(1.02);
}

/* =====================
   Forms
===================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(0, 208, 156, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-error {
    color: var(--accent-red);
    font-size: 0.8rem;
    margin-top: 0.375rem;
}

/* =====================
   Tables
===================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-tertiary);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table td {
    font-size: 0.875rem;
}

/* =====================
   Badges
===================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success { background: rgba(0, 208, 156, 0.15); color: var(--accent-green); }
.badge-danger { background: rgba(255, 82, 82, 0.15); color: var(--accent-red); }
.badge-warning { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-secondary { background: var(--bg-tertiary); color: var(--text-secondary); }

/* =====================
   Alerts
===================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(0, 208, 156, 0.1);
    border: 1px solid rgba(0, 208, 156, 0.3);
    color: var(--accent-green);
}

.alert-danger {
    background: rgba(255, 82, 82, 0.1);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--accent-yellow);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-blue);
}

/* =====================
   Trading Interface
===================== */
.trading-container {
    display: grid;
    grid-template-columns: 250px 1fr 320px;
    gap: 1rem;
    height: calc(100vh - 60px);
    padding: 1rem;
}

.asset-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.asset-list-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.asset-list-body {
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.asset-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.asset-item:hover {
    background: var(--bg-hover);
}

.asset-item.active {
    background: var(--bg-hover);
    border-left: 3px solid var(--accent-green);
}

.asset-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.asset-info {
    flex: 1;
}

.asset-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.asset-pair {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.asset-price {
    text-align: right;
}

.asset-current-price {
    font-family: var(--font-mono);
    font-weight: 600;
}

.asset-change {
    font-size: 0.75rem;
}

.asset-change.positive { color: var(--accent-green); }
.asset-change.negative { color: var(--accent-red); }

/* Chart Container */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chart-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-symbol {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-symbol-name {
    font-size: 1.125rem;
    font-weight: 600;
}

.chart-symbol-price {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
}

.chart-timeframes {
    display: flex;
    gap: 0.25rem;
}

.timeframe-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.timeframe-btn:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.timeframe-btn.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.chart-body {
    flex: 1;
    min-height: 400px;
}

/* Trade Panel */
.trade-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}

.trade-panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.trade-panel-body {
    padding: 1rem;
    flex: 1;
}

.trade-amount-input {
    position: relative;
    margin-bottom: 1rem;
}

.trade-amount-input .currency-symbol {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
}

.trade-amount-input input {
    padding-left: 2rem;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.trade-amount-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.preset-btn {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.trade-duration-select {
    margin-bottom: 1.25rem;
}

.trade-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.trade-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
}

.trade-info-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.trade-info-value {
    font-weight: 600;
}

.trade-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Active Trades */
.active-trades {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.active-trade-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    margin-bottom: 0.75rem;
}

.active-trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.active-trade-symbol {
    font-weight: 600;
}

.active-trade-direction {
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.active-trade-direction.up {
    background: rgba(0, 208, 156, 0.15);
    color: var(--accent-green);
}

.active-trade-direction.down {
    background: rgba(255, 82, 82, 0.15);
    color: var(--accent-red);
}

.active-trade-timer {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin: 0.5rem 0;
}

.active-trade-progress {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.active-trade-progress-bar {
    height: 100%;
    background: var(--accent-green);
    transition: width 1s linear;
}

/* =====================
   Balance Display
===================== */
.balance-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.balance-item {
    text-align: right;
}

.balance-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.balance-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
}

.balance-value.real { color: var(--accent-green); }
.balance-value.demo { color: var(--accent-blue); }

.balance-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    padding: 0.25rem;
}

.balance-toggle-btn {
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: var(--text-secondary);
}

.balance-toggle-btn.active {
    background: var(--accent-green);
    color: white;
}

.balance-toggle-btn.demo.active {
    background: var(--accent-blue);
}

/* =====================
   User Dropdown
===================== */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-dropdown-toggle:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.user-dropdown.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item i {
    width: 16px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* =====================
   Modals
===================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-fast);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--accent-red);
    color: white;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* =====================
   Loader
===================== */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.page-loader .loader {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

/* =====================
   Responsive
===================== */
@media (max-width: 1200px) {
    .trading-container {
        grid-template-columns: 200px 1fr 280px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .trading-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .asset-list {
        display: none;
    }
    
    .chart-body {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 0 1rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .stat-cards {
        grid-template-columns: 1fr;
    }
    
    .balance-display {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* =====================
   Utilities
===================== */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }

.flex-1 { flex: 1 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }

.font-mono { font-family: var(--font-mono) !important; }
.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

.cursor-pointer { cursor: pointer !important; }
.user-select-none { user-select: none !important; }

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* CFD Button States */
.bbtn.sel-up { background: linear-gradient(135deg,#26a69a,#00897b) !important; color: #fff !important; border-color: transparent !important; }
.bbtn.sel-dn { background: linear-gradient(135deg,#ef5350,#e53935) !important; color: #fff !important; border-color: transparent !important; }
.abtn.sel-up { background: linear-gradient(135deg,#26a69a,#00897b) !important; color: #fff !important; }
.abtn.sel-dn { background: linear-gradient(135deg,#ef5350,#e53935) !important; color: #fff !important; }

/* =====================
   Modals (Admin & Generic)
===================== */
.modal, .modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal.active, .modal.show, .modal-overlay.active, .modal-overlay.show {
    display: flex;
}

/* Fix for users.php structure: .modal-overlay > .modal */
.modal-overlay .modal {
    display: block; /* Reset display for nested modal */
    position: relative;
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 2001;
    animation: modalSlideIn 0.3s ease;
}

/* Fix for assets.php structure: .modal > .modal-dialog */
.modal-dialog {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
    margin: 1.5rem;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--bg-tertiary);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
