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

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #f1f5f9;
    --bg-widget: #ffffff;
    --bg-hover: rgba(15, 23, 42, 0.05);
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-glow: rgba(30, 58, 138, 0.15);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --primary: #1e3a8a; /* Deep Sapphire Blue */
    --primary-hover: #1d4ed8;
    --accent: #064e3b; /* Swiss Forest Green */
    --color-buy: #059669; /* Emerald Forest Green */
    --color-sell: #dc2626; /* Crimson Red */
    --color-pending: #d97706; /* Amber Dark */
    --card-shadow: 0 4px 20px 0 rgba(15, 23, 42, 0.06);
    --transition-fast: all 0.2s ease;
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

/* Glassmorphism Card Style */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: var(--transition-fast);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.45);
    transform: translateY(-2px);
}

/* Grid System for Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Stats Widget Style */
.stats-widget {
    background: var(--bg-widget);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition-fast);
}

.stats-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stats-widget.stats-buy::before { background: var(--color-buy); }
.stats-widget.stats-sell::before { background: var(--color-sell); }
.stats-widget.stats-pending::before { background: var(--color-pending); }

.stats-widget:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 36px 0 rgba(0, 0, 0, 0.5);
}

.stats-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.stats-value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stats-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Custom Table Design */
.custom-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.custom-table th {
    background: var(--bg-sidebar);
    color: var(--text-muted);
    padding: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    transition: var(--transition-fast);
}

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

/* Badge System */
.badge-trading {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-buy {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-buy);
    border: 1px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.badge-sell {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-sell);
    border: 1px solid rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

.badge-pending {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-pending);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-win {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-buy);
    border: 1px solid var(--color-buy);
}

.badge-loss {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-sell);
    border: 1px solid var(--color-sell);
}

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

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.sidebar-brand {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand span {
    color: var(--primary);
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition-fast);
}

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

.nav-item-link.active {
    border-left: 3px solid var(--primary);
    background: var(--border-glow);
    color: var(--primary);
}

.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
}

/* Inputs and Forms */
.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--border-glow);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Primary Button Styling */
.btn-premium {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.3);
}

.btn-premium:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.4);
    filter: brightness(1.1);
}

.btn-secondary-premium {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary-premium:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Custom Alert Component */
.premium-alert {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--text-primary);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.premium-alert.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}
.premium-alert.alert-danger, .premium-alert.alert-danger * {
    color: #dc2626 !important;
}

.premium-alert.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}
.premium-alert.alert-success, .premium-alert.alert-success * {
    color: #10b981 !important;
}

/* Pre-market Timeline Card */
.timeline-item {
    position: relative;
    padding-left: 32px;
    border-left: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-main);
    box-shadow: 0 0 8px var(--primary);
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

/* Layout adjustments for mobile devices */
@media (max-width: 768px) {
    .page-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
    }
    .sidebar-brand {
        margin-bottom: 16px;
    }
    .main-content {
        padding: 20px;
    }
}

/* Readability Overrides for Bootstrap utilities on Dark Theme */
.text-muted {
    color: var(--text-muted) !important;
}
.text-white-50 {
    color: var(--text-secondary) !important;
}
.text-primary {
    color: var(--primary) !important;
}
.text-success {
    color: var(--color-buy) !important;
}
.text-danger {
    color: var(--color-sell) !important;
}
.text-warning {
    color: var(--color-pending) !important;
}
.small.text-muted {
    color: var(--text-muted) !important;
}
.text-end .text-muted {
    color: var(--text-muted) !important;
}
.form-label {
    color: var(--text-muted) !important;
}

/* Dynamic overrides for text-white utility classes */
.text-white {
    color: var(--text-primary) !important;
}
.text-white-50 {
    color: var(--text-secondary) !important;
}

/* Forced light text for buttons and alerts that have colored backgrounds */
.btn-premium, .btn-premium *, 
.premium-alert, .premium-alert *,
.btn-premium:hover {
    color: #ffffff !important;
}

/* Specific button-link override to use primary text color instead of white */
.btn-link.text-white {
    color: var(--text-primary) !important;
}
.btn-link.text-white.opacity-50 {
    color: var(--text-muted) !important;
    opacity: 0.6 !important;
}

/* Responsive Trade Card Layout (Manage Trades & Lists) */
.trade-row-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: var(--transition-fast);
}
.trade-row-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px 0 rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .width-full-mobile {
        width: 100% !important;
    }
    .trade-prices-grid {
        max-width: 100% !important;
        margin: 12px 0 !important;
        gap: 12px !important;
    }
}