/* ========================================
   ENHANCED MODERN DARK THEME - FxMath Momentum EA
   ======================================== */

/* CSS Variables */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h2 {
    font-size: 2rem;
    margin-top: 3rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
    position: relative;
}

h2::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
}

h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    color: var(--primary);
}

p {
    margin-bottom: 1.2rem;
    color: var(--text-muted);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

a:hover {
    color: var(--primary-light);
}

a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: var(--primary);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* ========================================
   CODE BLOCKS
   ======================================== */

code {
    font-family: 'Fira Code', 'Consolas', monospace;
    background: #0f1115;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e2e8f0;
}

pre {
    background: #0f1115;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    position: relative;
}

pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
}

/* Copy button for code blocks */
.code-block-wrapper {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    opacity: 0;
}

.code-block-wrapper:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--secondary);
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: 1rem 0;
    transition: var(--transition);
}

header.scrolled {
    box-shadow: var(--shadow-lg);
    background: rgba(15, 23, 42, 0.95);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #3b82f6, #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.version-badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Search Bar */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.8);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-shortcut {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
    width: 280px;
    height: calc(100vh - 73px);
    position: fixed;
    top: 73px;
    left: 0;
    background: var(--bg-dark);
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 2rem;
    transition: transform 0.3s ease;
    z-index: 900;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 0.5rem;
}

.sidebar a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.sidebar a::after {
    display: none;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.sidebar a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar h5 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 1.5rem 0 0.8rem 1rem;
    letter-spacing: 0.05em;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    margin-left: 280px;
    padding: 8rem 4rem 4rem;
    max-width: 1000px;
    min-height: 100vh;
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 73px;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    z-index: 1001;
    transition: width 0.1s ease;
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.95)),
        url('../assets/fxmath_hero_bg.svg');
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    padding: 4rem;
    margin-bottom: 4rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.1), transparent 70%);
    pointer-events: none;
}

.hero p {
    font-size: 1.25rem;
    max-width: 600px;
    margin: 1rem auto 2rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    text-decoration: none;
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    margin-left: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   FEATURE CARDS
   ======================================== */

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 12px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: inline-block;
}

/* ========================================
   ALERT BOXES
   ======================================== */

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border-left: 4px solid;
    background: rgba(30, 41, 59, 0.5);
    position: relative;
    padding-left: 3rem;
}

.alert::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
}

.alert-warning {
    border-color: var(--accent);
    background: rgba(245, 158, 11, 0.1);
}

.alert-warning strong {
    color: var(--accent);
}

.alert-danger {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.alert-danger strong {
    color: var(--danger);
}

.alert-info {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.alert-info strong {
    color: var(--primary);
}

.alert-success {
    border-color: var(--secondary);
    background: rgba(16, 185, 129, 0.1);
}

.alert-success strong {
    color: var(--secondary);
}

/* ========================================
   TABLES
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(15, 23, 42, 0.5);
    font-weight: 600;
    color: var(--primary);
}

tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* ========================================
   ACCORDION / COLLAPSIBLE
   ======================================== */

.accordion-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.accordion-header {
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    user-select: none;
}

.accordion-header:hover {
    background: var(--bg-card-hover);
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 1000px;
}

.accordion-body {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        background: var(--bg-dark);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 6rem 1.5rem 2rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .search-container {
        display: none;
    }

    h1 {
        font-size: 2rem;
    }

    .hero {
        padding: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SCROLL TO TOP BUTTON
   ======================================== */

.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--primary-dark);
    transform: translateY(-5px);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}