/* ============================================================
   QUBIBYTE QUANTUM COMPUTING TUTORIAL — Professional Styles
   ============================================================ */
@import url('/newindex.css');

/* ======================== BASE ======================== */
body {
    font-family: var(--font-body, 'Inter', 'Segoe UI', sans-serif);
    margin: 0;
    display: flex;
    height: 100vh;
    background-color: var(--bg-primary, #0a0a1a);
    color: var(--text-primary, #f1f5f9);
    line-height: 1.6;
}

/* ======================== SIDEBAR ======================== */
.sidebar {
    width: 300px;
    background-color: var(--bg-card, #141428);
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

.sidebar-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-default, rgba(255,255,255,0.10));
    text-align: center;
}

.sidebar-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mobile-menu-toggle {
    display: none;
}

.sidebar-logo-link {
    display: inline-block;
    margin-bottom: 5px;
    border-bottom: none !important;
    transition: transform 0.2s;
    padding: 0 !important;
}

.sidebar-logo-link:hover {
    transform: scale(1.05);
    background: transparent !important;
}

.sidebar-logo {
    max-width: 160px;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.sidebar h2,
.sidebar h4 {
    margin: 0;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.2rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
    font-weight: 500;
}

.sidebar-menu {
    display: block;
}

.sidebar-group-title {
    padding: 14px 25px;
    color: var(--color-accent, #AB6FAF);
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 4px;
    font-weight: 600;
}

.sidebar a {
    display: block;
    padding: 10px 25px 10px 35px;
    color: var(--text-muted, #64748b);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.92rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-family: var(--font-body, 'Inter', sans-serif);
}

.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary, #f1f5f9);
    padding-left: 40px;
}

.sidebar a.active {
    background-color: rgba(85, 74, 158, 0.2);
    color: white;
    border-left: 3px solid var(--color-secondary, #0687C9);
    font-weight: 500;
}

.sidebar a.home-link {
    padding: 14px 25px;
    background: var(--gradient-primary, linear-gradient(135deg, #554A9E 0%, #0687C9 100%));
    color: white;
    text-align: center;
    margin-top: auto;
    font-weight: 600;
    font-family: var(--font-display, 'Khand', sans-serif);
    letter-spacing: 0.5px;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.sidebar a.home-link:hover {
    opacity: 0.9;
    padding-left: 25px;
}

/* ======================== MAIN CONTENT ======================== */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 50px 80px;
    background-color: var(--bg-primary, #0a0a1a);
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    scroll-behavior: smooth;
}

.main-content h1 {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 3rem;
    margin-bottom: 32px;
    color: var(--text-primary, #f1f5f9);
    border-bottom: 2px solid var(--color-secondary, #0687C9);
    padding-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.main-content h2 {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2rem;
    margin-top: 48px;
    margin-bottom: 20px;
    color: var(--color-accent, #AB6FAF);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.main-content h3 {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.4rem;
    margin-top: 36px;
    margin-bottom: 14px;
    color: var(--color-secondary, #0687C9);
    font-weight: 600;
}

.main-content p,
.main-content li {
    font-size: 1.05rem;
    line-height: 1.85;
    margin-bottom: 18px;
    color: var(--text-secondary, #94a3b8);
    font-family: var(--font-body, 'Inter', sans-serif);
}

.main-content strong {
    color: var(--text-primary, #f1f5f9);
    font-weight: 600;
}

.main-content ul,
.main-content ol {
    padding-left: 24px;
    margin-bottom: 20px;
}

.main-content li {
    margin-bottom: 8px;
}

.main-content a {
    color: var(--color-secondary, #0687C9);
    text-decoration: none;
    transition: color 0.2s;
}

.main-content a:hover {
    color: var(--color-secondary-light, #1A9FE0);
    text-decoration: underline;
}

/* ======================== TABLE ======================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 0.95rem;
    font-family: var(--font-body, 'Inter', sans-serif);
    min-width: 400px;
    box-shadow: var(--shadow-md, 0 8px 30px rgba(0,0,0,0.35));
    border-radius: var(--radius-md, 16px);
    overflow: hidden;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

table thead tr {
    background: var(--gradient-primary, linear-gradient(135deg, #554A9E 0%, #0687C9 100%));
    color: #ffffff;
    text-align: left;
    font-weight: 600;
    font-family: var(--font-display, 'Khand', sans-serif);
    text-transform: uppercase;
    letter-spacing: 1px;
}

table th,
table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

table tbody tr {
    transition: background-color 0.2s;
}

table tbody tr:nth-of-type(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

table tbody tr:nth-of-type(odd) {
    background-color: transparent;
}

table tbody tr:last-of-type {
    border-bottom: none;
}

table tbody tr:hover {
    background-color: rgba(85, 74, 158, 0.08);
}

/* ======================== CODE BLOCKS ======================== */
.code-block {
    background-color: rgba(0, 0, 0, 0.3);
    color: #a6accd;
    padding: 24px;
    border-radius: var(--radius-md, 16px);
    font-family: var(--font-mono, 'Consolas', monospace);
    margin: 28px 0;
    overflow-x: auto;
    border-left: 3px solid var(--color-primary, #554A9E);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ======================== NOTE BOX ======================== */
.note-box {
    background-color: rgba(6, 135, 201, 0.06);
    border-left: 3px solid var(--color-secondary, #0687C9);
    padding: 20px 24px;
    margin: 28px 0;
    border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
    border: 1px solid rgba(6, 135, 201, 0.15);
    border-left: 3px solid var(--color-secondary, #0687C9);
}

.note-box strong {
    color: var(--color-secondary, #0687C9);
}

/* ======================== SIMULATOR VISUALS ======================== */

/* Matrix Styles */
.matrix-container {
    display: inline-block;
    margin: 10px 20px 10px 0;
    vertical-align: top;
}

.matrix-box {
    background: var(--bg-card, #141428);
    border: 1px solid var(--border-default, rgba(255,255,255,0.10));
    border-radius: var(--radius-md, 16px);
    overflow: hidden;
    min-width: 150px;
}

.matrix-label {
    background: var(--gradient-primary, linear-gradient(135deg, #554A9E 0%, #0687C9 100%));
    color: white;
    padding: 6px 12px;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 0.95rem;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.matrix-wrapper {
    padding: 16px;
    display: flex;
    justify-content: center;
}

.matrix-table {
    border-collapse: collapse;
    margin: 0 auto;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 1rem;
    color: var(--text-primary, #f1f5f9);
    border: none;
}

.matrix-table td {
    padding: 10px 14px;
    text-align: center;
    min-width: 40px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    background: rgba(255, 255, 255, 0.02);
}

/* Bloch Sphere Container */
.vis-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card, #141428);
    border-radius: var(--radius-md, 16px);
    padding: 0;
    margin: 30px auto;
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-default, rgba(255,255,255,0.10));
    position: relative;
    box-shadow: var(--shadow-md, 0 8px 30px rgba(0,0,0,0.35));
    overflow: hidden;
}

.viz-tabs-scrollable-wrapper {
    display: none !important;
}

.viz-panel {
    width: 100%;
    padding: 10px !important;
}

.bloch-sphere-3d-container {
    width: 100%;
    height: 350px;
    position: relative;
    border-radius: 0.5rem;
    cursor: grab;
}

.bloch-sphere-3d-container:active {
    cursor: grabbing;
}

/* Bloch Labels */
.bloch-labels {
    width: 100%;
    text-align: center;
    margin-top: 10px;
}

.bloch-label-info {
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: 4px;
    color: var(--text-muted, #64748b);
    font-size: 0.8rem;
}

/* State Probabilities */
.state-probabilities {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    width: 90%;
    margin: 10px auto;
}

.probability-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.probability-label {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    text-align: center;
}

.probability-value {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.probability-fill {
    height: 100%;
    background: var(--gradient-accent, linear-gradient(90deg, #0687C9, #AB6FAF));
    border-radius: 3px;
}

.probability-text {
    font-size: 0.8rem;
    color: var(--text-primary, #f1f5f9);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.state-summary {
    text-align: center;
    margin: 10px 0;
    color: var(--color-accent, #AB6FAF);
    font-weight: 600;
    font-family: var(--font-body, 'Inter', sans-serif);
}

/* ======================== QUIZ ======================== */
.quiz-container {
    background: var(--bg-card, #141428);
    padding: 32px;
    border-radius: var(--radius-lg, 24px);
    margin-top: 60px;
    border: 1px solid var(--border-default, rgba(255,255,255,0.10));
}

.quiz-header {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.6rem;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    padding-bottom: 12px;
    font-weight: 700;
}

.quiz-question {
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: var(--radius-sm, 8px);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

.quiz-question p {
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
}

.quiz-option {
    display: block;
    padding: 10px 14px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.95rem;
}

.quiz-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-default, rgba(255,255,255,0.10));
}

.quiz-option input {
    margin-right: 10px;
}

.quiz-option.correct {
    background: rgba(34, 197, 94, 0.12);
    border-color: #22c55e;
    color: #fff;
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #fff;
}

.btn-check-answer {
    background: var(--gradient-primary, linear-gradient(135deg, #554A9E 0%, #0687C9 100%));
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-full, 9999px);
    cursor: pointer;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.05rem;
    margin-top: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.btn-check-answer:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(85, 74, 158, 0.3);
}

.quiz-feedback {
    margin-top: 10px;
    font-weight: 600;
    padding: 12px;
    border-radius: var(--radius-sm, 8px);
    display: none;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.95rem;
}

.exam-summary {
    text-align: center;
    padding: 40px;
}

.score-display {
    font-size: 4rem;
    font-family: var(--font-display, 'Khand', sans-serif);
    background: var(--gradient-accent, linear-gradient(135deg, #0687C9 0%, #AB6FAF 100%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* ======================== CERTIFICATE ======================== */
.certificate-preview {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    height: 700px;
    max-width: 95vw;
    max-height: 95vh;
    border: 12px solid var(--color-primary, #554A9E);
    background: white;
    color: #000;
    z-index: 9999;
    box-shadow: 0 0 500px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 4px;
}

.certificate-inner {
    width: 100%;
    height: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.cert-header {
    text-align: center;
    margin-top: 10px;
}

.cert-title {
    font-family: 'Old English Text MT', 'Georgia', serif;
    font-size: 3.5rem;
    margin: 0;
    color: #000;
    line-height: 1;
}

.cert-subtitle {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.1rem;
    color: var(--color-primary, #554A9E);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 5px;
}

.cert-body {
    text-align: center;
    width: 80%;
}

.cert-body p {
    font-family: 'Georgia', serif;
    font-size: 1.15rem;
    color: #333;
    margin: 5px 0;
}

.cert-name {
    font-size: 3.5rem;
    font-family: 'Brush Script MT', cursive;
    border-bottom: 2px solid #000;
    display: block;
    min-width: 400px;
    margin: 10px auto 20px auto;
    color: var(--color-secondary, #0687C9);
    padding-bottom: 5px;
}

.cert-course-name {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2.2rem;
    color: var(--color-primary, #554A9E);
    margin: 10px 0;
    text-transform: uppercase;
    line-height: 1.1;
}

.cert-desc {
    font-style: italic;
    color: #555;
    margin-top: 10px;
}

.cert-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 90%;
    margin-bottom: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.cert-col {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cert-logo-img {
    width: 100px;
    filter: invert(0);
}

.cert-signature {
    font-family: 'Brush Script MT', cursive;
    font-size: 1.8rem;
    border-bottom: 1px solid #000;
    padding-bottom: 5px;
    min-width: 200px;
    margin-bottom: 5px;
    color: #000;
}

.cert-date {
    font-size: 1.3rem;
    border-bottom: 1px solid #000;
    padding-bottom: 5px;
    min-width: 150px;
    font-family: 'Georgia', serif;
    margin-bottom: 5px;
    color: #000;
}

.cert-role {
    font-size: 0.75rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-print {
    margin-top: 20px;
    padding: 14px 28px;
    background: #22c55e;
    color: white;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: var(--radius-full, 9999px);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    font-family: var(--font-display, 'Khand', sans-serif);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-print:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.4);
}

.btn-close-cert {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-close-cert:hover {
    background: #dc2626;
}

/* ======================== PRINT ======================== */
@media print {
    @page {
        size: landscape;
        margin: 0;
    }

    body * {
        visibility: hidden;
    }

    .certificate-preview,
    .certificate-preview * {
        visibility: visible;
    }

    .certificate-preview {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border: 16px solid var(--color-primary, #554A9E);
        transform: none;
        box-shadow: none;
        padding: 40px;
        margin: 0;
        max-width: none;
        max-height: none;
        overflow: visible;
        display: block !important;
    }

    .btn-print,
    .btn-close-cert {
        display: none !important;
    }
}

/* ======================== PAGINATION ======================== */
.pagination {
    margin-top: 60px;
    display: flex;
    justify-content: space-between;
    padding-top: 28px;
    border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

.btn-nav {
    background: var(--gradient-primary, linear-gradient(135deg, #554A9E 0%, #0687C9 100%));
    border: none;
    color: white;
    padding: 12px 28px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1.1rem;
    font-family: var(--font-display, 'Khand', sans-serif);
    border-radius: var(--radius-full, 9999px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(85, 74, 158, 0.4);
    color: white;
}

.btn-nav.disabled {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
    pointer-events: none;
    opacity: 0.4;
}

/* ======================== RESPONSIVE ======================== */
@media screen and (max-width: 900px) {
    body {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-bottom: 1px solid var(--border-default, rgba(255,255,255,0.10));
        border-right: none;
        padding-bottom: 0;
    }

    .sidebar-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .mobile-menu-toggle {
        display: block;
        background: transparent;
        border: 2px solid var(--color-secondary, #0687C9);
        color: #fff;
        padding: 4px 12px;
        border-radius: var(--radius-sm, 8px);
        cursor: pointer;
        font-size: 1.4rem;
        margin-left: 15px;
        transition: all 0.2s ease;
    }

    .mobile-menu-toggle:hover {
        background: rgba(6, 135, 201, 0.15);
    }

    .sidebar-menu {
        display: none;
        width: 100%;
        border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    }

    .sidebar-menu.show {
        display: block;
    }

    .sidebar-header {
        padding: 10px 20px;
    }

    .sidebar-logo {
        max-width: 110px;
    }

    .sidebar h4 {
        display: none;
    }

    .main-content {
        padding: 24px 16px;
        height: auto;
        overflow: visible;
    }

    .main-content h1 {
        font-size: 2rem;
    }

    .matrix-container {
        display: block;
        width: 100%;
        overflow-x: auto;
        margin: 10px 0;
    }

    .bloch-sphere-3d-container {
        height: 250px;
    }

    .quiz-container {
        padding: 20px 16px;
    }
}
