/* public/index.css */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #07080e;
    --surface-dark: #0e111a;
    --surface-card: #151926;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: rgba(0, 242, 254, 0.4);
    
    --quantum-cyan: #00f2fe;
    --quantum-blue: #4facfe;
    --quantum-purple: #7f00ff;
    --quantum-pink: #e100ff;
    --quantum-green: #00f260;
    
    --text-primary: #f5f7fa;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --sidebar-width: 280px;
    --navbar-height: 70px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #22293f;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #2d3756;
}

/* Helper Utilities */
.neon-text {
    background: linear-gradient(135deg, var(--quantum-cyan), var(--quantum-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-btn {
    background: linear-gradient(135deg, var(--quantum-cyan), var(--quantum-blue));
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gradient-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.gradient-btn:active {
    transform: translateY(0);
}

/* Header / Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    background: rgba(7, 8, 14, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
    text-decoration: none;
}

.nav-brand span {
    font-size: 0.75rem;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid var(--border-active);
    color: var(--quantum-cyan);
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-search {
    position: relative;
    width: 250px;
}

.nav-search input {
    width: 100%;
    padding: 8px 16px 8px 36px;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.nav-search input:focus {
    border-color: var(--quantum-cyan);
    outline: none;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.nav-search::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    opacity: 0.5;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-item:hover, .nav-item.active {
    color: var(--quantum-cyan);
}

/* Page Container Layout */
.app-container {
    display: flex;
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    background: var(--surface-dark);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    overflow-y: auto;
    z-index: 90;
    transition: transform 0.3s ease;
}

.sidebar-group {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 0.8rem;
}

.sidebar-list {
    list-style: none;
}

.sidebar-link {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border-left: 2px solid transparent;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
    padding-left: 16px;
}

.sidebar-link.active {
    color: var(--quantum-cyan);
    border-left-color: var(--quantum-cyan);
    background: rgba(0, 242, 254, 0.04);
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    max-width: calc(100% - var(--sidebar-width));
    padding: 3rem 4rem;
}

.doc-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.doc-section.active {
    display: block;
}

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

/* Content Elements Styling */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1.2rem;
    color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #fff;
}

p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

li {
    margin-bottom: 0.5rem;
}

strong {
    color: #fff;
}

/* Inline Code */
code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255, 255, 255, 0.08);
    color: #ff79c6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Fenced Code Blocks */
pre {
    background: #0b0d16;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    position: relative;
}

pre code {
    background: none;
    padding: 0;
    color: #f8f8f2;
    font-size: 0.9rem;
    display: block;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Alerts / Callouts */
.alert {
    padding: 1.25rem 1.5rem;
    border-left: 4px solid #ccc;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
}

.alert-note {
    border-left-color: var(--quantum-blue);
    background: rgba(79, 172, 254, 0.03);
}

.alert-tip {
    border-left-color: var(--quantum-green);
    background: rgba(0, 242, 96, 0.03);
}

.alert-important {
    border-left-color: #ff9f43;
    background: rgba(255, 159, 67, 0.03);
}

.alert-warning {
    border-left-color: #ff4d4d;
    background: rgba(255, 77, 77, 0.03);
}

.alert-title {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-note .alert-title { color: var(--quantum-blue); }
.alert-tip .alert-title { color: var(--quantum-green); }
.alert-important .alert-title { color: #ff9f43; }
.alert-warning .alert-title { color: #ff4d4d; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--surface-dark);
    font-weight: 600;
    color: #fff;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Feature Cards Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.8rem;
    transition: all 0.3s;
}

.card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Next/Prev Navigation Buttons */
.doc-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.footer-btn {
    text-decoration: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 45%;
}

.footer-btn span:first-child {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.footer-btn span:last-child {
    font-size: 1.15rem;
    color: #fff;
    font-weight: 600;
    transition: color 0.3s;
}

.footer-btn:hover span:last-child {
    color: var(--quantum-cyan);
}

.footer-btn.prev {
    text-align: left;
}

.footer-btn.next {
    text-align: right;
}

/* Interactive Playground Layout */
.playground-view {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    height: 600px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.playground-editor-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    height: 100%;
}

.playground-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.example-selector {
    background: #0b0d16;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.example-selector:focus {
    border-color: var(--quantum-cyan);
}

.editor-container {
    flex: 1;
    position: relative;
    display: flex;
    background: #0b0d16;
    overflow: hidden;
}

.line-numbers {
    width: 45px;
    background: rgba(0, 0, 0, 0.15);
    padding-top: 1rem;
    text-align: right;
    padding-right: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
user-select: none;
    line-height: 1.5;
}

.code-textarea {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    color: #f8f8f2;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 1rem;
    height: 100%;
    white-space: pre;
    overflow-x: auto;
    tab-size: 4;
}

.playground-controls {
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-color);
    padding: 12px 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.noise-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
}

.noise-slider {
    flex: 1;
    -webkit-appearance: none;
    background: #22293f;
    height: 6px;
    border-radius: 3px;
    outline: none;
}

.noise-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--quantum-cyan);
    cursor: pointer;
    box-shadow: 0 0 5px var(--quantum-cyan);
}

.playground-results-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #06070a;
}

.results-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.playground-terminal {
    flex: 1;
    padding: 1rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--quantum-green);
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
}

.playground-chart {
    height: 200px;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.chart-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.chart-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.chart-label {
    width: 80px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

.chart-bar-outer {
    flex: 1;
    height: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.chart-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--quantum-cyan), var(--quantum-blue));
    width: 0%;
    border-radius: 8px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-value {
    width: 50px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    color: var(--quantum-cyan);
    font-weight: 600;
}

/* OpenQASM Export Dialog */
.qasm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 600px;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

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

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-body pre {
    margin-bottom: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
}

/* Loading Overlay for WASM */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 242, 254, 0.1);
    border-radius: 50%;
    border-top-color: var(--quantum-cyan);
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

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

/* Mobile responsive fixes */
@media (max-width: 1024px) {
    .playground-view {
        grid-template-columns: 1fr;
        height: auto;
    }
    .playground-editor-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: 400px;
    }
    .playground-results-pane {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }
    .nav-search {
        display: none;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 240px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 2rem 1.5rem;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
}
