/* =========================================================================
   GLOBAL CSS - MEASUREMENTS & INSTRUMENTATION FORMULA BOOK
   ========================================================================= */

:root {
    /* Colors */
    --bg-dark: #0a0e1a;
    --bg-card: #111827;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    /* Module Accents */
    --mod1-color: #00ff88;
    /* Neon Green */
    --mod2-color: #00f5ff;
    /* Cyan */
    --mod3-color: #facc15;
    /* Gold */
    --mod4-color: #a78bfa;
    /* Purple — High R & AC Bridges */
    --mod5-color: #fb7185;
    /* Rose — High Voltage / Insulation */
    --mod6-color: #60a5fa;
    /* Blue */
    --mod7-color: #facc15;
    /* Gold */
    --mod8-color: #00ff88;
    /* Green — Power Accuracy */
    --mod9-color: #f97316;
    /* Orange — Energy */
    --mod10-color: #00f5ff;
    /* Cyan — Oscilloscope */
    --mod11-color: #a78bfa;
    /* Purple — Sensors */
}

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

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

/* AOS Fallback & Forced Visibility for Active Sections */
html:not(.aos-init) [data-aos],
.aos-init [data-aos].active,
.aos-init [data-aos].aos-animate {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

.module-section.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

h1,
h2,
h3,
h4,
.orbitron {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}

/* Scroll Progress */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--mod1-color), var(--mod2-color), var(--mod3-color));
    z-index: 9999;
    box-shadow: 0 0 10px var(--mod2-color);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: rgba(17, 24, 39, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: fixed;
    height: 100vh;
    padding: 2rem 1rem;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    z-index: 100;
}

.sidebar h2 {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: transparent;
    transition: all 0.3s ease;
}

.nav-link[data-mod="1"]:hover::before,
.nav-link[data-mod="1"].active {
    background: var(--mod1-color);
    box-shadow: 0 0 10px var(--mod1-color);
}

.nav-link[data-mod="2"]:hover::before,
.nav-link[data-mod="2"].active {
    background: var(--mod2-color);
    box-shadow: 0 0 10px var(--mod2-color);
}

.nav-link[data-mod="3"]:hover::before,
.nav-link[data-mod="3"].active {
    background: var(--mod3-color);
    box-shadow: 0 0 10px var(--mod3-color);
}

.nav-link[data-mod="4"]:hover::before,
.nav-link[data-mod="4"].active {
    background: var(--mod4-color);
    box-shadow: 0 0 10px var(--mod4-color);
}

.nav-link[data-mod="5"]:hover::before,
.nav-link[data-mod="5"].active {
    background: var(--mod5-color);
    box-shadow: 0 0 10px var(--mod5-color);
}

.nav-link[data-mod="6"]:hover::before,
.nav-link[data-mod="6"].active {
    background: var(--mod6-color);
    box-shadow: 0 0 10px var(--mod6-color);
}

.nav-link[data-mod="7"]:hover::before,
.nav-link[data-mod="7"].active {
    background: var(--mod7-color);
    box-shadow: 0 0 10px var(--mod7-color);
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
    padding-left: 1.5rem;
}

.nav-mod-num {
    margin-right: 10px;
    font-size: 0.8rem;
    opacity: 0.7;
    font-family: 'Orbitron', sans-serif;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    padding: 3rem 4rem;
    width: calc(100% - 280px);
}

.hero-banner {
    text-align: center;
    margin-bottom: 4rem;
    padding: 4rem 2rem;
    background: radial-gradient(circle at center, rgba(0, 255, 136, 0.1) 0%, transparent 70%);
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 136, 0.1);
    position: relative;
}

.hero-title {
    font-size: 3rem;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Module Sections — Unit Switching (hidden by default, shown when active) */
.module-section {
    margin-bottom: 6rem;
    padding-top: 2rem;
    display: none;
    scroll-margin-top: 150px;
}

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

.module-header {
    margin-bottom: 2rem;
}

.module-title {
    font-size: 2rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.module-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
}

.module-line {
    height: 3px;
    width: 60px;
    margin-top: 10px;
    border-radius: 3px;
}

/* Grid Layout for Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
}

/* Machine Card Design */
.machine-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.machine-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

.card-strip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.2rem;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.formula-zone {
    background: #0d1117;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.formula {
    text-align: center;
    font-size: 1.1rem;
    margin: 10px 0;
    color: #e2e8f0;
}

.anim-zone {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    min-height: 250px;
    position: relative;
}

/* Utility Classes */
.text-muted {
    color: var(--text-secondary);
}

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

.text-sm {
    font-size: 0.9rem;
}

.text-xs {
    font-size: 0.8rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

/* Buttons & Inputs */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

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

.interactive-slider-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    width: 100%;
}

.interactive-slider-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 80px;
}

input[type=range] {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

/* Animations from specific cards */
@keyframes dashPulse {
    0% {
        stroke-dashoffset: 20;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* Toggle Buttons */
.toggle-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

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

.toggle-btn.active {
    color: #000;
    font-weight: bold;
}

/* Specific Mod 1 Styles */
.mod1-btn.active {
    background: var(--mod1-color);
    border-color: var(--mod1-color);
    box-shadow: 0 0 10px var(--mod1-color);
}

.dot-mark {
    transform-origin: center;
    opacity: 0;
    transform: scale(0);
}

/* --- Module 2: Analog Indicating Instruments --- */

@keyframes pmmcSwing {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(45deg);
    }
}

@keyframes miRepel {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(30deg);
    }
}

@keyframes dynaSpin {
    0% {
        transform: rotate(45deg);
    }

    50% {
        transform: rotate(80deg);
    }

    100% {
        transform: rotate(30deg);
    }
}

@keyframes spinClockwise {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Module 3: Measurement of Power & Energy --- */

.watt-active {
    stroke-width: 4 !important;
    filter: drop-shadow(0 0 10px currentColor);
}

.rev-increment {
    animation: flashRev 0.2s ease-out;
}

@keyframes flashRev {
    0% {
        color: var(--mod3-color);
        transform: scale(1.1);
    }

    100% {
        color: #fff;
        transform: scale(1);
    }
}

/* --- Module 4: High Resistance & AC Bridge Measurements --- */

.m4-badge {
    background: rgba(167,139,250,0.12);
    color: #a78bfa;
    border: 1px solid rgba(167,139,250,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    white-space: nowrap;
}

.m4-card-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid rgba(167,139,250,0.15);
    flex-wrap: wrap;
}

.m4-footer-btn {
    background: rgba(167,139,250,0.08);
    color: #a78bfa;
    border: 1px solid rgba(167,139,250,0.25);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m4-footer-btn:hover {
    background: rgba(167,139,250,0.18);
    box-shadow: 0 0 10px rgba(167,139,250,0.3);
}

.m4-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 15px;
    background: rgba(167,139,250,0.03);
    border-top: 1px solid rgba(167,139,250,0.08);
}

.m4-calc-zone.open {
    max-height: 300px;
    padding: 15px;
}

.m4-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.m4-calc-row label {
    font-size: 0.78rem;
    color: #94a3b8;
    min-width: 55px;
}

.m4-calc-row input[type="number"] {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(167,139,250,0.25);
    color: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    width: 85px;
    font-size: 0.8rem;
}

.m4-calc-result {
    color: #a78bfa;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px;
    background: rgba(167,139,250,0.06);
    border-radius: 8px;
    border: 1px solid rgba(167,139,250,0.15);
}

.m4-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.m4-comparison-table th {
    background: rgba(167,139,250,0.12);
    color: #a78bfa;
    padding: 6px 10px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
}

.m4-comparison-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #cbd5e1;
}

.m4-slider {
    accent-color: #a78bfa;
    width: 100%;
}

.m4-btn {
    background: rgba(167,139,250,0.08);
    color: #94a3b8;
    border: 1px solid rgba(167,139,250,0.2);
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m4-btn:hover {
    background: rgba(167,139,250,0.15);
    color: #a78bfa;
}

.m4-btn.active {
    background: rgba(167,139,250,0.2);
    color: #a78bfa;
    border-color: #a78bfa;
    box-shadow: 0 0 8px rgba(167,139,250,0.3);
}

@media (max-width: 768px) {
    .m4-calc-row { gap: 6px; }
    .m4-calc-row input[type="number"] { width: 70px; }
    .m4-comparison-table { font-size: 0.7rem; }
    .m4-btn { padding: 4px 10px; font-size: 0.7rem; }
}

/* --- Module 5: High Resistance & AC Bridge Theory --- */

.m5-badge {
    background: rgba(251,113,133,0.12);
    color: #fb7185;
    border: 1px solid rgba(251,113,133,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    white-space: nowrap;
}

.m5-card-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid rgba(251,113,133,0.15);
    flex-wrap: wrap;
}

.m5-footer-btn {
    background: rgba(251,113,133,0.08);
    color: #fb7185;
    border: 1px solid rgba(251,113,133,0.25);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m5-footer-btn:hover {
    background: rgba(251,113,133,0.18);
    box-shadow: 0 0 10px rgba(251,113,133,0.3);
}

.m5-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 15px;
    background: rgba(251,113,133,0.03);
    border-top: 1px solid rgba(251,113,133,0.08);
}

.m5-calc-zone.open {
    max-height: 350px;
    padding: 15px;
}

.m5-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.m5-calc-row label {
    font-size: 0.78rem;
    color: #94a3b8;
    min-width: 55px;
}

.m5-calc-row input[type="number"] {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(251,113,133,0.25);
    color: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    width: 85px;
    font-size: 0.8rem;
}

.m5-calc-result {
    color: #fb7185;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px;
    background: rgba(251,113,133,0.06);
    border-radius: 8px;
    border: 1px solid rgba(251,113,133,0.15);
}

.m5-app-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.12);
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

.m5-slider {
    accent-color: #fb7185;
    width: 100%;
}

.m5-btn {
    background: rgba(251,113,133,0.08);
    color: #94a3b8;
    border: 1px solid rgba(251,113,133,0.2);
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m5-btn:hover {
    background: rgba(251,113,133,0.15);
    color: #fb7185;
}

.m5-btn.active {
    background: rgba(251,113,133,0.2);
    color: #fb7185;
    border-color: #fb7185;
    box-shadow: 0 0 8px rgba(251,113,133,0.3);
}

.m5-select {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(251,113,133,0.25);
    color: #f8fafc;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 0.78rem;
    min-width: 80px;
}

.m5-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.m5-comparison-table th {
    background: rgba(251,113,133,0.12);
    color: #fb7185;
    padding: 6px 10px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
}

.m5-comparison-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #cbd5e1;
}

.m5-comparison-table tr:hover td {
    background: rgba(251,113,133,0.03);
}

.m5-card:hover {
    box-shadow: 0 10px 40px rgba(251,113,133,0.1),
                0 0 0 1px rgba(251,113,133,0.08);
}

@media (max-width: 768px) {
    .m5-calc-row { gap: 6px; }
    .m5-calc-row input[type="number"] { width: 70px; }
    .m5-comparison-table { font-size: 0.7rem; }
    .m5-btn { padding: 4px 10px; font-size: 0.7rem; }
    .m5-select { min-width: 65px; font-size: 0.72rem; }
}

/* ═══════════════════════════════════════════════════════════
   MODULE 6 — Frequency & Instrument Transformers  #60a5fa
   ═══════════════════════════════════════════════════════════ */

.m6-badge {
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    border: 1px solid rgba(96,165,250,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    white-space: nowrap;
}

.m6-card-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid rgba(96,165,250,0.15);
    flex-wrap: wrap;
}

.m6-footer-btn {
    background: rgba(96,165,250,0.08);
    color: #60a5fa;
    border: 1px solid rgba(96,165,250,0.25);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m6-footer-btn:hover {
    background: rgba(96,165,250,0.18);
    box-shadow: 0 0 10px rgba(96,165,250,0.3);
}

.m6-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 15px;
    background: rgba(96,165,250,0.03);
    border-top: 1px solid rgba(96,165,250,0.08);
}

.m6-calc-zone.open {
    max-height: 350px;
    padding: 15px;
}

.m6-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.m6-calc-row label {
    font-size: 0.78rem;
    color: #94a3b8;
    min-width: 55px;
}

.m6-calc-row input[type="number"] {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(96,165,250,0.25);
    color: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    width: 85px;
    font-size: 0.8rem;
}

.m6-calc-result {
    color: #60a5fa;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px;
    background: rgba(96,165,250,0.06);
    border-radius: 8px;
    border: 1px solid rgba(96,165,250,0.15);
}

.m6-app-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.12);
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

.m6-slider {
    accent-color: #60a5fa;
    width: 100%;
}

.m6-btn {
    background: rgba(96,165,250,0.08);
    color: #94a3b8;
    border: 1px solid rgba(96,165,250,0.2);
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m6-btn:hover {
    background: rgba(96,165,250,0.15);
    color: #60a5fa;
}

.m6-btn.active {
    background: rgba(96,165,250,0.2);
    color: #60a5fa;
    border-color: #60a5fa;
    box-shadow: 0 0 8px rgba(96,165,250,0.3);
}

.m6-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.m6-comparison-table th {
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    padding: 6px 10px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
}

.m6-comparison-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #cbd5e1;
}

.m6-comparison-table tr:hover td {
    background: rgba(96,165,250,0.03);
}

.m6-card:hover {
    box-shadow: 0 10px 40px rgba(96,165,250,0.1),
                0 0 0 1px rgba(96,165,250,0.08);
}

@media (max-width: 768px) {
    .m6-calc-row { gap: 6px; }
    .m6-calc-row input[type="number"] { width: 70px; }
    .m6-comparison-table { font-size: 0.7rem; }
    .m6-btn { padding: 4px 10px; font-size: 0.7rem; }
}

/* ════════════════════════════════════════════════════
   MODULE 7 · PT, CT vs PT & Power Measurement (#facc15)
   ════════════════════════════════════════════════════ */

.m7-badge {
    background: rgba(250,204,21,0.12);
    color: #facc15;
    border: 1px solid rgba(250,204,21,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    white-space: nowrap;
}

.m7-card-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid rgba(250,204,21,0.15);
    flex-wrap: wrap;
}

.m7-footer-btn {
    background: rgba(250,204,21,0.08);
    color: #facc15;
    border: 1px solid rgba(250,204,21,0.25);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m7-footer-btn:hover {
    background: rgba(250,204,21,0.18);
    box-shadow: 0 0 10px rgba(250,204,21,0.3);
}

.m7-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 15px;
    background: rgba(250,204,21,0.03);
    border-top: 1px solid rgba(250,204,21,0.08);
}

.m7-calc-zone.open {
    max-height: 350px;
    padding: 15px;
}

.m7-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.m7-calc-row label {
    font-size: 0.78rem;
    color: #94a3b8;
    min-width: 55px;
}

.m7-calc-row input[type="number"] {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(250,204,21,0.25);
    color: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    width: 85px;
    font-size: 0.8rem;
}

.m7-calc-result {
    color: #facc15;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px;
    background: rgba(250,204,21,0.06);
    border-radius: 8px;
    border: 1px solid rgba(250,204,21,0.15);
}

.m7-app-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.12);
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

.m7-slider {
    accent-color: #facc15;
    width: 100%;
}

.m7-btn {
    background: rgba(250,204,21,0.08);
    color: #94a3b8;
    border: 1px solid rgba(250,204,21,0.2);
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m7-btn:hover {
    background: rgba(250,204,21,0.15);
    color: #facc15;
}

.m7-btn.active {
    background: rgba(250,204,21,0.2);
    color: #facc15;
    border-color: #facc15;
    box-shadow: 0 0 8px rgba(250,204,21,0.3);
}

.m7-danger-btn {
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    border-color: rgba(239,68,68,0.25);
}

.m7-danger-btn:hover {
    background: rgba(239,68,68,0.18);
    box-shadow: 0 0 10px rgba(239,68,68,0.3);
}

.m7-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.m7-comparison-table th {
    background: rgba(250,204,21,0.12);
    color: #facc15;
    padding: 6px 10px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
}

.m7-comparison-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #cbd5e1;
}

.m7-comparison-table tr:hover td {
    background: rgba(250,204,21,0.03);
}

.m7-card:hover {
    box-shadow: 0 10px 40px rgba(250,204,21,0.1),
                0 0 0 1px rgba(250,204,21,0.08);
}

@media (max-width: 768px) {
    .m7-calc-row { gap: 6px; }
    .m7-calc-row input[type="number"] { width: 70px; }
    .m7-comparison-table { font-size: 0.7rem; }
    .m7-btn { padding: 4px 10px; font-size: 0.7rem; }
}

/* ════════════════════════════════════════════════════
   MODULE 8 · Wattmeter Errors & Polyphase (#00ff88)
   ════════════════════════════════════════════════════ */

.m8-badge {
    background: rgba(0,255,136,0.12);
    color: #00ff88;
    border: 1px solid rgba(0,255,136,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    white-space: nowrap;
}

.m8-card-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid rgba(0,255,136,0.15);
    flex-wrap: wrap;
}

.m8-footer-btn {
    background: rgba(0,255,136,0.08);
    color: #00ff88;
    border: 1px solid rgba(0,255,136,0.25);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m8-footer-btn:hover {
    background: rgba(0,255,136,0.18);
    box-shadow: 0 0 10px rgba(0,255,136,0.3);
}

.m8-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 15px;
    background: rgba(0,255,136,0.03);
    border-top: 1px solid rgba(0,255,136,0.08);
}

.m8-calc-zone.open {
    max-height: 350px;
    padding: 15px;
}

.m8-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.m8-calc-row label {
    font-size: 0.78rem;
    color: #94a3b8;
    min-width: 55px;
}

.m8-calc-row input[type="number"] {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(0,255,136,0.25);
    color: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    width: 85px;
    font-size: 0.8rem;
}

.m8-calc-result {
    color: #00ff88;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px;
    background: rgba(0,255,136,0.06);
    border-radius: 8px;
    border: 1px solid rgba(0,255,136,0.15);
}

.m8-app-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.12);
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

.m8-slider {
    accent-color: #00ff88;
    width: 100%;
}

.m8-btn {
    background: rgba(0,255,136,0.08);
    color: #94a3b8;
    border: 1px solid rgba(0,255,136,0.2);
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.m8-btn:hover {
    background: rgba(0,255,136,0.15);
    color: #00ff88;
}

.m8-btn.active {
    background: rgba(0,255,136,0.2);
    color: #00ff88;
    border-color: #00ff88;
    box-shadow: 0 0 8px rgba(0,255,136,0.3);
}

.m8-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.m8-comparison-table th {
    background: rgba(0,255,136,0.12);
    color: #00ff88;
    padding: 6px 10px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
}

.m8-comparison-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #cbd5e1;
}

.m8-comparison-table tr:hover td {
    background: rgba(0,255,136,0.03);
}

.m8-card:hover {
    box-shadow: 0 10px 40px rgba(0,255,136,0.1),
                0 0 0 1px rgba(0,255,136,0.08);
}

@media (max-width: 768px) {
    .m8-calc-row { gap: 6px; }
    .m8-calc-row input[type="number"] { width: 70px; }
    .m8-comparison-table { font-size: 0.7rem; }
    .m8-btn { padding: 4px 10px; font-size: 0.7rem; }
}

/* ═══════════════════════════════════════════════════════════
   MODULE 9 — 3-Phase Power, Reactive Power & Energy Meters
   Accent: #f97316 (Orange — Energy)
   ═══════════════════════════════════════════════════════════ */
.m9-badge {
    background: rgba(249,115,22,0.12);
    color: #f97316;
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 6px;
    border: 1px solid rgba(249,115,22,0.25);
}

.m9-card-footer {
    border-top: 1px solid rgba(249,115,22,0.1);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.m9-footer-btn {
    background: transparent;
    border: 1px solid rgba(249,115,22,0.25);
    color: #f97316;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.25s;
}
.m9-footer-btn:hover {
    background: rgba(249,115,22,0.1);
    border-color: #f97316;
}

.m9-calc-zone {
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    transition: max-height 0.4s ease, padding 0.3s ease;
    background: #0d1117;
    border-top: 1px solid rgba(249,115,22,0.08);
}
.m9-calc-zone.open {
    max-height: 500px;
    padding: 12px 16px;
}

.m9-calc-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.m9-calc-row label {
    color: #94a3b8;
    font-size: 0.78rem;
    min-width: fit-content;
}
.m9-calc-row input[type="number"] {
    width: 80px;
    background: #111827;
    border: 1px solid #334155;
    color: #f8fafc;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.78rem;
}

.m9-calc-result {
    background: rgba(249,115,22,0.06);
    border: 1px solid rgba(249,115,22,0.15);
    border-radius: 6px;
    padding: 6px 10px;
    color: #f97316;
    font-family: 'Orbitron', monospace;
    font-size: 0.78rem;
    margin-top: 6px;
    text-align: center;
    word-break: break-word;
}

.m9-app-tag {
    display: inline-block;
    border: 1px solid rgba(249,115,22,0.25);
    border-radius: 6px;
    padding: 2px 10px;
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
}

.m9-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: #1e293b;
    border-radius: 2px;
    outline: none;
}
.m9-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f97316;
    cursor: pointer;
}

.m9-btn {
    background: transparent;
    border: 1px solid rgba(249,115,22,0.3);
    color: #f97316;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.25s;
}
.m9-btn:hover {
    background: rgba(249,115,22,0.1);
    border-color: #f97316;
}
.m9-btn.active {
    background: rgba(249,115,22,0.15);
    border-color: #f97316;
    color: #fff;
}

.m9-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.m9-comparison-table th {
    background: rgba(249,115,22,0.08);
    color: #f97316;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(249,115,22,0.15);
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
}
.m9-comparison-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(249,115,22,0.06);
    color: #94a3b8;
}
.m9-comparison-table tr:hover td {
    background: rgba(249,115,22,0.04);
}
.m9-comparison-table tr.active-row td {
    background: rgba(249,115,22,0.12);
    color: #f97316;
    font-weight: 600;
}

.m9-comp-panel {
    transition: opacity 0.3s ease;
}

#m9-card1:hover, #m9-card2:hover, #m9-card3:hover, #m9-card4:hover, #m9-card5:hover {
    box-shadow: 0 10px 40px rgba(249,115,22,0.1),
                0 0 0 1px rgba(249,115,22,0.08);
}

@media (max-width: 768px) {
    .m9-calc-row { gap: 6px; }
    .m9-calc-row input[type="number"] { width: 70px; }
    .m9-comparison-table { font-size: 0.7rem; }
    .m9-btn { padding: 4px 10px; font-size: 0.7rem; }
    .m9-slider { width: 90px; }
}

/* ═══════════════════════════════════════
   MODULE 10 — CRO & Electronic Measurements
   Accent: #00f5ff (Cyan)
   ═══════════════════════════════════════ */
.m10-badge {
    background: linear-gradient(135deg, #00f5ff 0%, #0ea5e9 100%);
    color: #0a0a0f;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.m10-card-footer {
    border-top: 1px solid rgba(0,245,255,0.1);
    padding: 0.8rem 1.2rem;
}
.m10-footer-btn {
    background: rgba(0,245,255,0.08);
    border: 1px solid rgba(0,245,255,0.25);
    color: #00f5ff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s;
}
.m10-footer-btn:hover {
    background: rgba(0,245,255,0.18);
    box-shadow: 0 0 12px rgba(0,245,255,0.25);
}
.m10-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 1.2rem;
    background: rgba(0,245,255,0.02);
    border-top: 1px solid transparent;
}
.m10-calc-zone.open {
    max-height: 600px;
    padding: 0.8rem 1.2rem;
    border-top-color: rgba(0,245,255,0.1);
}
.m10-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 4px 0;
}
.m10-calc-row label {
    color: #94a3b8;
    font-size: 0.75rem;
    min-width: 40px;
}
.m10-calc-row input[type="number"] {
    background: #0f172a;
    border: 1px solid rgba(0,245,255,0.2);
    color: #f8fafc;
    width: 80px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}
.m10-calc-row input[type="number"]:focus {
    outline: none;
    border-color: #00f5ff;
    box-shadow: 0 0 8px rgba(0,245,255,0.3);
}
.m10-calc-result {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(0,245,255,0.06);
    border: 1px solid rgba(0,245,255,0.15);
    border-radius: 6px;
    color: #00f5ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    word-break: break-word;
}
.m10-app-tag {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid rgba(0,245,255,0.3);
    border-radius: 999px;
    font-size: 0.72rem;
    background: rgba(0,245,255,0.04);
}
.m10-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 6px;
    background: rgba(0,245,255,0.15);
    border-radius: 3px;
    outline: none;
}
.m10-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00f5ff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0,245,255,0.5);
}
.m10-btn {
    background: rgba(0,245,255,0.08);
    border: 1px solid rgba(0,245,255,0.25);
    color: #94a3b8;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.72rem;
    transition: all 0.2s;
}
.m10-btn:hover, .m10-btn.active {
    background: rgba(0,245,255,0.18);
    color: #00f5ff;
    border-color: #00f5ff;
}
.m10-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: #cbd5e1;
}
.m10-comparison-table th {
    background: rgba(0,245,255,0.08);
    color: #00f5ff;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    padding: 6px 10px;
    text-align: left;
    border-bottom: 2px solid rgba(0,245,255,0.2);
}
.m10-comparison-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(0,245,255,0.06);
}
.m10-comparison-table tr:hover td {
    background: rgba(0,245,255,0.03);
}

#m10-card1:hover, #m10-card2:hover, #m10-card3:hover,
#m10-card4:hover, #m10-card5:hover, #m10-card6:hover {
    box-shadow: 0 10px 40px rgba(0,245,255,0.1),
                0 0 0 1px rgba(0,245,255,0.08);
}

@media (max-width: 768px) {
    .m10-calc-row { gap: 6px; }
    .m10-calc-row input[type="number"] { width: 70px; }
    .m10-comparison-table { font-size: 0.7rem; }
    .m10-btn { padding: 4px 10px; font-size: 0.7rem; }
    .m10-slider { width: 90px; }
}

/* ═══════════════════════════════════════
   MODULE 11 — Lissajous Phase, DVM, Q-Meter, Transducers & Sensors
   Accent: #a78bfa (Purple — Sensors)
   ═══════════════════════════════════════ */
.m11-badge {
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    color: #0a0a0f;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.m11-card-footer {
    border-top: 1px solid rgba(167,139,250,0.1);
    padding: 0.8rem 1.2rem;
}
.m11-footer-btn {
    background: rgba(167,139,250,0.08);
    border: 1px solid rgba(167,139,250,0.25);
    color: #a78bfa;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s;
}
.m11-footer-btn:hover {
    background: rgba(167,139,250,0.18);
    box-shadow: 0 0 12px rgba(167,139,250,0.25);
}
.m11-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 1.2rem;
    background: rgba(167,139,250,0.02);
    border-top: 1px solid transparent;
}
.m11-calc-zone.open {
    max-height: 700px;
    padding: 0.8rem 1.2rem;
    border-top-color: rgba(167,139,250,0.1);
}
.m11-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 4px 0;
}
.m11-calc-row label {
    color: #94a3b8;
    font-size: 0.75rem;
    min-width: 40px;
}
.m11-calc-row input[type="number"] {
    background: #0f172a;
    border: 1px solid rgba(167,139,250,0.2);
    color: #f8fafc;
    width: 80px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}
.m11-calc-row input[type="number"]:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 8px rgba(167,139,250,0.3);
}
.m11-calc-result {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(167,139,250,0.06);
    border: 1px solid rgba(167,139,250,0.15);
    border-radius: 6px;
    color: #a78bfa;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    word-break: break-word;
}
.m11-app-tag {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid rgba(167,139,250,0.3);
    border-radius: 999px;
    font-size: 0.72rem;
    background: rgba(167,139,250,0.04);
}
.m11-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 6px;
    background: rgba(167,139,250,0.15);
    border-radius: 3px;
    outline: none;
}
.m11-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #a78bfa;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(167,139,250,0.5);
}
.m11-btn {
    background: rgba(167,139,250,0.08);
    border: 1px solid rgba(167,139,250,0.25);
    color: #94a3b8;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.72rem;
    transition: all 0.2s;
}
.m11-btn:hover, .m11-btn.active {
    background: rgba(167,139,250,0.18);
    color: #a78bfa;
    border-color: #a78bfa;
}
.m11-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: #cbd5e1;
}
.m11-comparison-table th {
    background: rgba(167,139,250,0.08);
    color: #a78bfa;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    padding: 6px 10px;
    text-align: left;
    border-bottom: 2px solid rgba(167,139,250,0.2);
}
.m11-comparison-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(167,139,250,0.06);
}
.m11-comparison-table tr:hover td {
    background: rgba(167,139,250,0.03);
}

#m11-card1:hover, #m11-card2:hover, #m11-card3:hover, #m11-card4:hover,
#m11-card5:hover, #m11-card6:hover, #m11-card7:hover, #m11-card8:hover {
    box-shadow: 0 10px 40px rgba(167,139,250,0.1),
                0 0 0 1px rgba(167,139,250,0.08);
}

@media (max-width: 768px) {
    .m11-calc-row { gap: 6px; }
    .m11-calc-row input[type="number"] { width: 70px; }
    .m11-comparison-table { font-size: 0.7rem; }
    .m11-btn { padding: 4px 10px; font-size: 0.7rem; }
    .m11-slider { width: 90px; }
}

/* --- Module 5: Instrument Transformers (legacy) --- */

.danger-spark {
    stroke: #ef4444 !important;
    animation: flashSpark 0.1s infinite alternate;
}

@keyframes flashSpark {
    0% {
        stroke-width: 2;
        opacity: 1;
        filter: drop-shadow(0 0 5px #ef4444);
    }

    100% {
        stroke-width: 4;
        opacity: 0.5;
        filter: drop-shadow(0 0 15px #ef4444);
    }
}

/* --- Module 7: Range Extension --- */

.active-res {
    stroke: var(--mod7-color) !important;
    stroke-width: 4 !important;
    filter: drop-shadow(0 0 5px var(--mod7-color));
}
/* --- Module 6: Electronic & Special Instruments --- */

@keyframes pulseHeat {
    0% {
        r: 10;
        opacity: 0.8;
    }

    100% {
        r: 25;
        opacity: 0.2;
    }
}

#strain-svg {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

/* ═══════════════════════════════════════════════════════════
   MODULE 2: MEASURING INSTRUMENTS — Orange Accent (#f97316)
   ═══════════════════════════════════════════════════════════ */

/* M2 badge */
.m2-badge {
    background: rgba(249,115,22,0.15);
    color: #f97316;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(249,115,22,0.3);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

/* Card footer */
.m2-card-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.15);
}
.m2-footer-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all .25s ease;
    font-family: 'Inter', sans-serif;
}
.m2-footer-btn:hover {
    background: rgba(249,115,22,0.12);
    color: #f97316;
    border-color: rgba(249,115,22,0.3);
}
.m2-footer-btn.bookmarked {
    color: #f97316;
    border-color: #f97316;
    background: rgba(249,115,22,0.15);
}

/* Calculator zones */
.m2-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s ease, padding .4s ease;
    background: rgba(13,17,23,0.95);
    padding: 0 1.5rem;
}
.m2-calc-zone.open {
    max-height: 250px;
    padding: 15px 1.5rem;
    border-top: 1px solid rgba(249,115,22,0.15);
}
.m2-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.m2-calc-row label {
    color: #94a3b8;
    font-size: 0.8rem;
    min-width: 50px;
}
.m2-calc-row input[type="number"] {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #f8fafc;
    padding: 5px 8px;
    border-radius: 6px;
    width: 80px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color .2s;
}
.m2-calc-row input[type="number"]:focus {
    border-color: #f97316;
    box-shadow: 0 0 6px rgba(249,115,22,0.3);
}
.m2-calc-result {
    background: rgba(249,115,22,0.08);
    color: #f97316;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    letter-spacing: 0.5px;
}

/* M2 toggle buttons (orange) */
.m2-btn.active {
    background: rgba(249,115,22,0.9);
    border-color: #f97316;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 12px rgba(249,115,22,0.4);
}

/* M2 slider accent */
.m2-slider::-webkit-slider-thumb {
    background: #f97316 !important;
    box-shadow: 0 0 6px rgba(249,115,22,0.5);
}

/* Error tags */
.m2-error-tag {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(239,68,68,0.2);
}

/* Comparison table */
.m2-comparison-table-wrap {
    overflow-x: auto;
    margin-top: 10px;
}
.m2-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}
.m2-comparison-table th {
    background: rgba(249,115,22,0.12);
    color: #f97316;
    padding: 10px 12px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    border-bottom: 2px solid rgba(249,115,22,0.3);
}
.m2-comparison-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #e2e8f0;
    vertical-align: top;
}
.m2-comparison-table tr:hover td {
    background: rgba(249,115,22,0.04);
}

/* M2 card glow on hover */
.m2-card:hover {
    box-shadow: 0 10px 40px rgba(249,115,22,0.12),
                0 0 0 1px rgba(249,115,22,0.1);
}

/* M2 pointer meter shared styles */
.m2-meter-svg {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    border: 1px solid #333;
}

/* Responsive for M2 */
@media (max-width: 768px) {
    .m2-calc-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .m2-calc-row input[type="number"] {
        width: 100%;
    }
    .m2-card-footer {
        flex-direction: column;
        gap: 8px;
    }
    .m2-comparison-table {
        font-size: 0.75rem;
    }
    .m2-comparison-table th,
    .m2-comparison-table td {
        padding: 6px 8px;
    }
}

/* ─── M2 Cards 2.8-2.11 extras ─── */
.m2-app-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.12);
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

/* Hot wire glow animation */
@keyframes hwGlow {
    0%   { opacity: 0.15; }

    50%  { opacity: 0.55; }
    100% { opacity: 0.15; }
}
.hw-glow-anim {
    animation: hwGlow 1.2s ease-in-out infinite;
}

/* Thermocouple glow pulse */
@keyframes tcPulse {
    0%   { r: 10; opacity: 0.3; }
    50%  { r: 18; opacity: 0.6; }
    100% { r: 10; opacity: 0.3; }
}
.tc-glow-anim {
    animation: tcPulse 1.5s ease-in-out infinite;
}

/* Electrostatic field shimmer */
@keyframes fieldShimmer {
    0%   { opacity: 0.15; }
    50%  { opacity: 0.5; }
    100% { opacity: 0.15; }
}
.estat-field-anim {
    animation: fieldShimmer 2s ease-in-out infinite;
}

/* R-divider heat glow */
@keyframes rHeat {
    0%   { opacity: 0; }
    50%  { opacity: 0.25; }
    100% { opacity: 0; }
}
.rdiv-heat-anim {
    animation: rHeat 2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════
   MODULE 3: RECTIFIER & RESISTANCE — Green Accent (#00ff88)
   ═══════════════════════════════════════════════════════════ */

.m3-badge {
    background: rgba(0,255,136,0.12);
    color: #00ff88;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(0,255,136,0.25);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.m3-card-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.15);
}
.m3-footer-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all .25s ease;
    font-family: 'Inter', sans-serif;
}
.m3-footer-btn:hover {
    background: rgba(0,255,136,0.1);
    color: #00ff88;
    border-color: rgba(0,255,136,0.3);
}
.m3-footer-btn.bookmarked {
    color: #00ff88;
    border-color: #00ff88;
    background: rgba(0,255,136,0.12);
}

.m3-calc-zone {
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s ease, padding .4s ease;
    background: rgba(13,17,23,0.95);
    padding: 0 1.5rem;
}
.m3-calc-zone.open {
    max-height: 280px;
    padding: 15px 1.5rem;
    border-top: 1px solid rgba(0,255,136,0.15);
}
.m3-calc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.m3-calc-row label {
    color: #94a3b8;
    font-size: 0.8rem;
    min-width: 50px;
}
.m3-calc-row input[type="number"] {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #f8fafc;
    padding: 5px 8px;
    border-radius: 6px;
    width: 90px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color .2s;
}
.m3-calc-row input[type="number"]:focus {
    border-color: #00ff88;
    box-shadow: 0 0 6px rgba(0,255,136,0.3);
}
.m3-calc-result {
    background: rgba(0,255,136,0.06);
    color: #00ff88;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    letter-spacing: 0.5px;
}

.m3-btn.active {
    background: rgba(0,255,136,0.85);
    border-color: #00ff88;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 12px rgba(0,255,136,0.4);
}

.m3-slider::-webkit-slider-thumb {
    background: #00ff88 !important;
    box-shadow: 0 0 6px rgba(0,255,136,0.5);
}

.m3-comparison-table-wrap {
    overflow-x: auto;
    margin-top: 10px;
}
.m3-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}
.m3-comparison-table th {
    background: rgba(0,255,136,0.08);
    color: #00ff88;
    padding: 10px 12px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    border-bottom: 2px solid rgba(0,255,136,0.25);
}
.m3-comparison-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #e2e8f0;
    vertical-align: top;
}
.m3-comparison-table tr:hover td {
    background: rgba(0,255,136,0.03);
}

.m3-app-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.12);
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

.m3-card:hover {
    box-shadow: 0 10px 40px rgba(0,255,136,0.1),
                0 0 0 1px rgba(0,255,136,0.08);
}

@media (max-width: 768px) {
    .m3-calc-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .m3-calc-row input[type="number"] {
        width: 100%;
    }
    .m3-card-footer {
        flex-direction: column;
        gap: 8px;
    }
    .m3-comparison-table {
        font-size: 0.75rem;
    }
    .m3-comparison-table th,
    .m3-comparison-table td {
        padding: 6px 8px;
    }
}

/* ── Cards 8-12 additions ── */
.m3-btn {
    padding: 6px 16px;
    border: 1px solid #333;
    background: rgba(255,255,255,0.04);
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}
.m3-btn:hover {
    border-color: #00ff88;
    color: #fff;
}
.m3-btn.active {
    background: rgba(0,255,136,0.12);
    border-color: #00ff88;
    color: #00ff88;
    font-weight: 600;
}

.interactive-slider-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.interactive-slider-group label {
    color: #94a3b8;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
}

/* =========================================================================
   GLASS SIDEBAR DESIGN
   ========================================================================= */

/* Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 80px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #f97316;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.4);
    transform: scale(1.05);
}

.sidebar-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-60px);
}

/* Glass Sidebar */
.glass-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 300;
    background: rgba(15, 10, 30, 0.75);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5), inset 0 0 80px rgba(249, 115, 22, 0.03);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.glass-sidebar.open {
    transform: translateX(0);
}

.glass-sidebar::-webkit-scrollbar {
    width: 4px;
}

.glass-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.glass-sidebar::-webkit-scrollbar-thumb {
    background: rgba(249, 115, 22, 0.25);
    border-radius: 4px;
}

/* Sidebar Header */
.glass-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-sidebar__profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.glass-sidebar__avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f97316, #fb923c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.glass-sidebar__info {
    display: flex;
    flex-direction: column;
}

.glass-sidebar__label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    color: rgba(249, 115, 22, 0.7);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.glass-sidebar__name {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #fff;
    font-weight: 600;
}

.glass-sidebar__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.glass-sidebar__close:hover {
    background: rgba(255, 70, 70, 0.15);
    color: #ff6b6b;
    border-color: rgba(255, 70, 70, 0.3);
}

/* Section Label */
.glass-sidebar__section-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2.5px;
    padding: 16px 20px 8px;
    text-transform: uppercase;
}

/* Nav Links */
.glass-sidebar__nav {
    list-style: none;
    padding: 0 10px 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.glass-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.glass-sidebar__link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    border-radius: 0 3px 3px 0;
    background: transparent;
    transition: all 0.3s ease;
}

.glass-sidebar__link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.glass-sidebar__link.active {
    color: #fff;
    background: rgba(249, 115, 22, 0.12);
}

.glass-sidebar__link.active::before {
    background: #f97316;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
}

/* Module-specific active colors */
.glass-sidebar__link[data-mod="1"].active { background: rgba(0,255,136,0.1); }
.glass-sidebar__link[data-mod="1"].active::before { background: var(--mod1-color); box-shadow: 0 0 12px var(--mod1-color); }

.glass-sidebar__link[data-mod="2"].active { background: rgba(0,245,255,0.1); }
.glass-sidebar__link[data-mod="2"].active::before { background: var(--mod2-color); box-shadow: 0 0 12px var(--mod2-color); }

.glass-sidebar__link[data-mod="3"].active { background: rgba(250,204,21,0.1); }
.glass-sidebar__link[data-mod="3"].active::before { background: var(--mod3-color); box-shadow: 0 0 12px var(--mod3-color); }

.glass-sidebar__link[data-mod="4"].active { background: rgba(167,139,250,0.1); }
.glass-sidebar__link[data-mod="4"].active::before { background: var(--mod4-color); box-shadow: 0 0 12px var(--mod4-color); }

.glass-sidebar__link[data-mod="5"].active { background: rgba(251,113,133,0.1); }
.glass-sidebar__link[data-mod="5"].active::before { background: var(--mod5-color); box-shadow: 0 0 12px var(--mod5-color); }

.glass-sidebar__link[data-mod="6"].active { background: rgba(96,165,250,0.1); }
.glass-sidebar__link[data-mod="6"].active::before { background: var(--mod6-color); box-shadow: 0 0 12px var(--mod6-color); }

.glass-sidebar__link[data-mod="7"].active { background: rgba(250,204,21,0.1); }
.glass-sidebar__link[data-mod="7"].active::before { background: var(--mod7-color); box-shadow: 0 0 12px var(--mod7-color); }

.glass-sidebar__link[data-mod="8"].active { background: rgba(0,255,136,0.1); }
.glass-sidebar__link[data-mod="8"].active::before { background: var(--mod8-color); box-shadow: 0 0 12px var(--mod8-color); }

.glass-sidebar__link[data-mod="9"].active { background: rgba(249,115,22,0.1); }
.glass-sidebar__link[data-mod="9"].active::before { background: var(--mod9-color); box-shadow: 0 0 12px var(--mod9-color); }

.glass-sidebar__link[data-mod="10"].active { background: rgba(0,245,255,0.1); }
.glass-sidebar__link[data-mod="10"].active::before { background: var(--mod10-color); box-shadow: 0 0 12px var(--mod10-color); }

.glass-sidebar__link[data-mod="11"].active { background: rgba(167,139,250,0.1); }
.glass-sidebar__link[data-mod="11"].active::before { background: var(--mod11-color); box-shadow: 0 0 12px var(--mod11-color); }

.glass-sidebar__icon {
    font-size: 1.1rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

/* Overlay */
.glass-sidebar__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.glass-sidebar__overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .glass-sidebar {
        width: 260px;
    }

    .sidebar-toggle {
        top: 75px;
        left: 10px;
        width: 40px;
        height: 40px;
    }

    .glass-sidebar__link {
        font-size: 0.78rem;
        padding: 9px 12px;
    }
}

/* ══════════ COMPREHENSIVE MOBILE OPTIMIZATION ══════════ */

/* --- Tablet & Small Laptop (≤900px) --- */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 2rem;
    }
}

/* --- Tablet Portrait / Large Phone (≤768px) --- */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem 1rem;
    }
    .hero-banner {
        padding: 2rem 1rem;
        margin-bottom: 2rem;
    }
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .module-title { font-size: 1.5rem; gap: 0.5rem; }
    .module-subtitle { font-size: 1rem; }
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .formula {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    .formula-zone {
        padding: 1rem;
        overflow-x: auto;
    }
    .anim-zone {
        min-height: 180px;
        padding: 1rem;
    }
    .machine-card .card-header { padding: 1rem; }
    .katex-display { overflow-x: auto; overflow-y: hidden; }
    svg[width] { max-width: 100%; height: auto; }
}

/* --- Phone (≤480px) --- */
@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0.75rem;
    }
    .hero-banner {
        padding: 1.5rem 0.75rem;
        margin-bottom: 1.5rem;
    }
    .hero-title { font-size: 1.6rem; }
    .module-title { font-size: 1.25rem; }
    .module-subtitle { font-size: 0.85rem; }
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .machine-card { border-radius: 8px; }
    .machine-card .card-header {
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .formula-zone { padding: 0.75rem; }
    .formula { font-size: 0.95rem; }
    .anim-zone {
        min-height: 150px;
        padding: 0.75rem;
    }
    .katex { font-size: 0.9em !important; }
    svg[width] { max-width: 100%; height: auto; }
}