/**
 * ============================================================================
 * QENEX UNIFIED DESIGN SYSTEM - BASE STYLES
 * Version: 2.0.0
 * ============================================================================
 *
 * This file contains reset styles and base element styling.
 * Import AFTER tokens.css
 */

/* ============================================================================
   CSS RESET
   ============================================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--surface-base);
    color: var(--text-secondary);
    line-height: var(--leading-normal);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================================
   TYPOGRAPHY BASE
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: var(--text-5xl);
    font-weight: var(--font-extrabold);
    letter-spacing: var(--tracking-tight);
}

h2 {
    font-size: var(--text-4xl);
    letter-spacing: var(--tracking-tight);
}

h3 {
    font-size: var(--text-2xl);
}

h4 {
    font-size: var(--text-xl);
}

h5 {
    font-size: var(--text-lg);
}

h6 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

a {
    color: var(--brand-accent);
    text-decoration: none;
    transition: var(--transition-colors);
}

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

a:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

strong, b {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

em, i {
    font-style: italic;
}

small {
    font-size: var(--text-sm);
}

code, kbd, samp, pre {
    font-family: var(--font-mono);
}

code {
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: var(--surface-raised);
    border-radius: var(--radius-sm);
    color: var(--brand-accent);
}

pre {
    padding: var(--space-4);
    background: var(--surface-dark);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

pre code {
    padding: 0;
    background: none;
}

blockquote {
    padding-left: var(--space-4);
    border-left: 3px solid var(--brand-accent);
    color: var(--text-muted);
    font-style: italic;
    margin: var(--space-4) 0;
}

/* ============================================================================
   LISTS
   ============================================================================ */

ul, ol {
    padding-left: var(--space-6);
    margin-bottom: var(--space-4);
}

li {
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
}

li::marker {
    color: var(--brand-accent);
}

/* ============================================================================
   IMAGES & MEDIA
   ============================================================================ */

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ============================================================================
   TABLES
   ============================================================================ */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-elevated);
    color: var(--brand-accent);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    border-bottom: 1px solid var(--border-default);
}

td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

tr:hover td {
    background: var(--surface-raised);
}

/* ============================================================================
   FORMS BASE
   ============================================================================ */

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

input:disabled,
textarea:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Remove default form styling */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

/* Focus styles */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

/* ============================================================================
   SELECTION
   ============================================================================ */

::selection {
    background: var(--brand-accent);
    color: var(--surface-base);
}

::-moz-selection {
    background: var(--brand-accent);
    color: var(--surface-base);
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--brand-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-tertiary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--brand-secondary) var(--surface-dark);
}

/* ============================================================================
   UTILITY CLASSES - DISPLAY
   ============================================================================ */

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* ============================================================================
   UTILITY CLASSES - FLEXBOX
   ============================================================================ */

.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }

/* ============================================================================
   UTILITY CLASSES - GRID
   ============================================================================ */

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================================
   UTILITY CLASSES - SPACING
   ============================================================================ */

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============================================================================
   UTILITY CLASSES - TEXT
   ============================================================================ */

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

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--brand-accent) !important; }

.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

.tracking-wide { letter-spacing: var(--tracking-wide); }
.tracking-wider { letter-spacing: var(--tracking-wider); }

/* ============================================================================
   UTILITY CLASSES - SIZING
   ============================================================================ */

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ============================================================================
   UTILITY CLASSES - POSITION
   ============================================================================ */

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* ============================================================================
   UTILITY CLASSES - OVERFLOW
   ============================================================================ */

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* ============================================================================
   UTILITY CLASSES - BORDERS
   ============================================================================ */

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ============================================================================
   UTILITY CLASSES - EFFECTS
   ============================================================================ */

.glow { box-shadow: var(--glow-cyan); }
.glow-intense { box-shadow: var(--glow-cyan-intense); }
.glow-magenta { box-shadow: var(--glow-magenta); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ============================================================================
   ANIMATED BACKGROUND - NEBULA EFFECT
   ============================================================================ */

.nebula-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-below);
    background: var(--gradient-nebula);
    overflow: hidden;
}

.nebula-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0, 240, 255, 0.05) 0%, transparent 25%),
        radial-gradient(circle at 80% 70%, rgba(216, 59, 210, 0.05) 0%, transparent 25%);
    animation: nebulaPulse 8s ease-in-out infinite alternate;
}

.nebula-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 240, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridFloat 20s linear infinite;
}

/* ============================================================================
   CONTAINER
   ============================================================================ */

.container {
    width: 100%;
    max-width: var(--container-2xl);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-xl { max-width: var(--container-xl); }

/* ============================================================================
   SECTION SPACING
   ============================================================================ */

.section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
}

.section-sm {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
}

.section-lg {
    padding-top: var(--space-32);
    padding-bottom: var(--space-32);
}

/* ============================================================================
   SR-ONLY (Screen Reader Only)
   ============================================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


/* ============================================================================
   CRITICAL READABILITY OVERRIDE - FORCING LIGHT TEXT COLOR
   ============================================================================
   This targets the most fundamental HTML elements to win the CSS cascade.
   Added: 2025-12-06 - Emergency fix for dark theme contrast issues.
   ============================================================================ */

html body,
html body *,
body, html, *, 
h1, h2, h3, h4, h5, h6, 
p, span, a, li, td, th,
div, section, article, aside, nav, header, footer,
label, input, textarea, select, button,
.card, .nav, .hero, .pricing-card, .feature-card {
    color: var(--text-primary, #F0F0F0) !important;
}

/* Preserve accent colors for specific elements */
a:hover {
    color: var(--brand-accent, #00F0FF) !important;
}

/* Ensure muted text stays visible but dimmer */
.text-muted, .text-secondary, small, .caption, .subtitle {
    color: var(--text-secondary, #E0E0E8) !important;
}

/* Preserve semantic colors */
.text-success, .signal-bullish, .positive { color: var(--color-success, #10b981) !important; }
.text-error, .signal-bearish, .negative { color: var(--color-error, #ef4444) !important; }
.text-warning { color: var(--color-warning, #f59e0b) !important; }
.text-accent { color: var(--brand-accent, #00F0FF) !important; }

