body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f8fafc;
    margin: 0;
    padding: 0;
    color: #222831;
}

header {
    background: linear-gradient(90deg, #4b9988 0%, #6c5b7b 100%);
    color: #fff;
    padding: 32px 0 24px 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    position: relative;
}

.menu-icon {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 30px;
    cursor: pointer;
}

nav {
    margin-top: 20px;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav ul li {
    margin: 10px 0;
}

nav ul li a {
    color: #ffffff;
    text-decoration: none;
}

.hidden {
    display: none;
}

h1, h2, h3, h4 {
    margin: 0 0 16px 0;
    font-weight: 600;
}

h2 {
    color: #4b9988;
    border-left: 4px solid #6c5b7b;
    padding-left: 12px;
    margin-top: 32px;
}

main {
    max-width: 900px;
    margin: 32px auto;
    padding: 0 20px;
}

section {
    background: #fff;
    margin-bottom: 32px;
    padding: 28px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(44, 62, 80, 0.07);
    transition: box-shadow 0.2s;
}

section:hover {
    box-shadow: 0 4px 20px rgba(44, 62, 80, 0.13);
}

ul, ol {
    padding-left: 24px;
}

a {
    color: #6c5b7b;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #4b9988;
    text-decoration: underline;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.image-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.reduced-size-1 {
    width: 50%;
    height: auto;
}

.reduced-size-2 {
    width: 70%;
    height: auto;
}

figure {
    margin: 0 0 32px 0;
    text-align: center;
}

figcaption {
    font-size: 0.95em;
    color: #888;
    margin-top: 8px;
}

/* Floating figure for text wrap */
.figure-wrap {
    float: right;
    width: 33%;
    margin: 10px 0 16px 20px;
    text-align: center;
    clear: right;
}

.figure-wrap img {
    width: 100%;
    height: auto;
    display: block;
}

/* Larger floating figure for text wrap */
.figure-right-large {
    float: right;
    width: 45%;
    margin: 10px 0 20px 24px;
    text-align: center;
    clear: right;
}

.figure-right-large img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Smaller floating figure for tall images */
.figure-wrap-small {
    float: right;
    width: 25%;
    max-height: 400px;
    margin: 10px 0 16px 20px;
    text-align: center;
    clear: right;
}

.figure-wrap-small img {
    width: 100%;
    max-height: 350px;
    height: auto;
    object-fit: contain;
    display: block;
}

.text-wrap {
    text-align: justify;
}

/* Figure positioned below floating figure */
.figure-wrap-below {
    width: 48%;
    text-align: center;
    margin: 0;
}

.figure-wrap-below img {
    width: 100%;
    height: auto;
    display: block;
}

/* Container for side-by-side figures */
.figures-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin: 32px 0;
}

/* Center single large figures */
.figures-container.centered {
    display: block;
    text-align: center;
}

.figures-container figure {
    margin: 0;
}

.figures-container .large-figure {
    flex: 3;
    max-width: 75%;
}

/* Standalone centered large figures */
.figures-container.centered .large-figure {
    display: inline-block;
    margin: 0 auto;
    text-align: center;
    max-width: 80%;
    flex: none;
}

.large-figure img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.figures-container .small-figure {
    flex: 1;
    max-width: 22%;
}

.figures-container .half-width {
    flex: 1;
    max-width: 48%;
}

.figure-wrap.centered {
    display: block;
    text-align: center;
    margin: 32px auto;
    float: none;
    width: auto;
    clear: both;
}

.figure-wrap.centered img {
    display: inline-block;
    max-width: 80%;
}

footer {
    background: #222831;
    color: #fff;
    text-align: center;
    padding: 18px 0;
    margin-top: 40px;
    font-size: 1em;
    letter-spacing: 0.5px;
    box-shadow: 0 -2px 8px rgba(44, 62, 80, 0.08);
}

/* Floating back button styles */
.floating-back-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background-color: #2c3e50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.floating-back-button:hover {
    background-color: #34495e;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.floating-back-button a {
    color: white;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.floating-back-button a:hover {
    color: #ecf0f1;
}

/* Calculation container styles */
.calculation-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calculation-content {
    height: 300px;
    overflow-y: auto;
    padding: 16px;
    margin: 0;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    background: #ffffff;
    color: #2d3748;
    white-space: pre;
    border-radius: 5px;
}

.calculation-content code {
    background: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
}

/* LVS results container styles */
.lvs-results-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lvs-results-content {
    height: 250px;
    overflow-y: auto;
    padding: 16px;
    margin: 0;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    background: #ffffff;
    color: #2d3748;
    white-space: pre;
    border-radius: 5px;
}

.lvs-results-content code {
    background: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
}

/* Performance summary table styles */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    font-size: 0.95em;
}

table th {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
}

table td {
    border: 1px solid #dee2e6;
    padding: 10px 12px;
    vertical-align: top;
}

table tr:nth-child(even) {
    background-color: #f8f9fa;
}

table tr:hover {
    background-color: #e9ecef;
}

/* Custom scrollbars for code containers */
.calculation-content::-webkit-scrollbar,
.lvs-results-content::-webkit-scrollbar {
    width: 8px;
}

.calculation-content::-webkit-scrollbar-track,
.lvs-results-content::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 4px;
}

.calculation-content::-webkit-scrollbar-thumb,
.lvs-results-content::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 4px;
}

.calculation-content::-webkit-scrollbar-thumb:hover,
.lvs-results-content::-webkit-scrollbar-thumb:hover {
    background: #9aa0ac;
}

/* Dropdown submenu styles */
.has-submenu {
    position: relative;
}

.has-submenu > a:after {
    content: " ▼";
    font-size: 0.7em;
}

.submenu {
    display: none;
    position: static;
    left: auto;
    top: auto;
    background: transparent;
    padding: 0;
    margin: 10px 0 0 60px;
    min-width: auto;
    border-radius: 4px;
    box-shadow: none;
    z-index: auto;
}

.submenu li {
    margin: 5px 0;
}

.submenu li a {
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    display: block;
    text-align: center;
    font-size: 0.9em;
}

.submenu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
    display: block;
}

/* Circuit analysis specific styles */
.circuit-parameters {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 16px;
    margin: 20px 0;
}

.circuit-parameters h5 {
    margin: 0 0 12px 0;
    color: #495057;
    font-weight: 600;
}

.circuit-parameters ul {
    margin: 0;
    padding-left: 20px;
}

.circuit-parameters li {
    margin-bottom: 6px;
    color: #6c757d;
}

/* Specifications highlight */
.specifications {
    background-color: #e8f5e8;
    border: 1px solid #c3e6c3;
    border-radius: 6px;
    padding: 16px;
    margin: 20px 0;
}

.specifications h4 {
    color: #155724;
    margin-top: 0;
}

/* Status indicators in tables */
.status-pass {
    color: #28a745;
    font-weight: bold;
}

.status-fail {
    color: #dc3545;
    font-weight: bold;
}

.status-warning {
    color: #ffc107;
    font-weight: bold;
}

@media (max-width: 768px) {
    .floating-back-button {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

@media (max-width: 700px) {
    main {
        padding: 0 8px;
    }
    
    section {
        padding: 16px 8px;
    }
    
    .reduced-size-1 {
        width: 80%;
    }
    
    .reduced-size-2 {
        width: 90%;
    }
    
    .submenu {
        margin-left: 20px;
    }
    
    .figure-wrap {
        float: none;
        width: 80%;
        margin: 16px auto;
        display: block;
    }
    
    .figure-wrap-small {
        float: none;
        width: 60%;
        margin: 16px auto;
        display: block;
        max-height: none;
    }
    
    .figure-wrap-small img {
        max-height: none;
    }
    
    .figure-wrap-below {
        width: 100%;
        margin: 12px 0;
    }
    
    .figures-container {
        flex-direction: column;
        gap: 16px;
    }
    
    .figures-container .large-figure,
    .figures-container .small-figure,
    .figures-container .half-width {
        max-width: 100%;
        flex: none;
    }
    
    .text-wrap {
        text-align: left;
    }
    
    .calculation-content {
        height: 250px;
        font-size: 0.8em;
        padding: 12px;
    }
    
    .lvs-results-content {
        height: 200px;
        font-size: 0.8em;
        padding: 12px;
    }
    
    table {
        font-size: 0.8em;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

/* Equation styling */
.equations {
    margin: 20px 0;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

/* Mathematical fraction styling */
.fraction {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
}

.fraction .numerator {
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    margin-bottom: 2px;
    display: block;
}

.fraction .denominator {
    padding-top: 2px;
    display: block;
}

/* Performance table specific styling */
.performance-table {
    margin: 24px 0;
    border-radius: 8px;
    overflow: hidden;
}

.performance-table th {
    background: linear-gradient(90deg, #4b9988 0%, #6c5b7b 100%);
    color: white;
    font-weight: 600;
    text-align: center;
}

.performance-table td {
    text-align: center;
    font-family: 'Courier New', monospace;
}

.status-success {
    color: #28a745;
}

/* Image responsive styling */
.responsive-image {
    max-width: 100%;
    height: auto;
}