/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation - RTU Theme with Orange/Red Colors */
.navbar {
    background: linear-gradient(135deg, #d35400, #e67e22);
    color: white;
    padding: 1rem 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.home-button {
    color: white;
    text-decoration: none;
}

.home-button :visited {
    color: white;
    text-decoration: none;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.logo-link {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.logo-link:hover {
    color: #f39c12;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    color: #f39c12;
}

.nav-link.external-link {
    background: linear-gradient(135deg, #3498db, #2980b9);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.nav-link.external-link:hover {
    color: white;
    background: linear-gradient(135deg, #2980b9, #3498db);
    border-color: #5dade2;
    transform: translateY(-2px);
}

/* Main Content */
main {
    margin-top: 80px;
}

.section {
    padding: 4rem 0;
    min-height: 100vh;
}

.section:nth-child(even) {
    background-color: white;
}

.section h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #d35400;
    text-align: center;
}

.section h3 {
    font-size: 1.8rem;
    margin: 2rem 0 1rem 0;
    color: #e67e22;
}

.section h4 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.5rem 0;
    color: #d35400;
}

/* Introduction Section */
.intro-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.intro-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.intro-text ul {
    margin: 1rem 0 1.5rem 2rem;
}

.intro-text li {
    margin-bottom: 0.5rem;
}

.modbus-diagram {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.client-box, .server-box {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    min-width: 120px;
}

.client-box h4, .server-box h4 {
    color: white !important;
    margin: 0 0 0.5rem 0;
}

.arrow {
    font-size: 2rem;
    color: #e67e22;
    font-weight: bold;
}

/* Practical Example Diagram */
.practical-example {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.practical-example h4 {
    text-align: center;
    color: #d35400;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.example-diagram {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
}

.device {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 3px solid #e9ecef;
    transition: transform 0.3s ease;
}

.device:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.temperature-sensor {
    border-color: #e74c3c;
}

.display-unit {
    border-color: #e67e22;
}

.device-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.device-header h5 {
    color: #d35400;
    margin-bottom: 0.3rem;
    font-size: 1.2rem;
}

.device-header small {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.sensor-reading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #fff5f5, #ffeaa7);
    border-radius: 8px;
}

.temp-icon {
    font-size: 2rem;
}

.temp-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e74c3c;
}

.register-info {
    text-align: center;
    background: #f8f9fa;
    padding: 0.8rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.communication-flow {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.communication-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
}

.communication-step:first-child {
    justify-content: flex-start;
}

.communication-step:last-child {
    justify-content: flex-start;
}

.step-number {
    background: #e67e22;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-description {
    background: #f8f9fa;
    padding: 0.8rem;
    border-radius: 8px;
    border-left: 4px solid #e67e22;
    flex-grow: 1;
    text-align: center;
}

.step-description strong {
    color: #d35400;
    display: block;
    margin-bottom: 0.3rem;
}

.message-details {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.flow-arrow {
    font-size: 2rem;
    color: #e74c3c;
    font-weight: bold;
    flex-shrink: 0;
}

.display-screen {
    background: #2c3e50;
    color: #ecf0f1;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
}

.screen-header {
    background: #34495e;
    color: #e67e22;
    padding: 0.5rem;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: bold;
}

.displayed-temp {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background: rgba(230, 126, 34, 0.1);
    border-radius: 4px;
}

.display-label {
    color: #bdc3c7;
}

.display-value {
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.2rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online {
    background: #27ae60;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
}

.example-explanation {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-left: 5px solid #e67e22;
}

.example-explanation h5 {
    color: #d35400;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.example-explanation ol {
    margin-left: 1.5rem;
}

.example-explanation li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    color: #5d6d7e;
}

.example-explanation strong {
    color: #d35400;
}

/* API Section */
.function-codes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.function-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.function-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.function-card h4 {
    color: #e67e22;
    margin-bottom: 0.5rem;
}

.code-example {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-top: 1rem;
    border-left: 4px solid #e67e22;
}

/* Message Format */
.format-diagram {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.format-header {
    text-align: center;
    margin-bottom: 2rem;
}

.format-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.field {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    border: 2px solid #e1e8ed;
}

.field strong {
    color: #d35400;
    display: block;
    margin-bottom: 0.5rem;
}

.field small {
    color: #7f8c8d;
}

/* RTU Specific Features */
.rtu-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.feature-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 5px solid #e67e22;
}

.feature-card h4 {
    color: #d35400;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.feature-details ul {
    margin-left: 1.5rem;
}

.feature-details li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Terms Section */
.terms-intro {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.1rem;
    color: #7f8c8d;
}

.terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.term-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-left: 5px solid #e67e22;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.term-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.12);
}

.term-card h3 {
    color: #d35400;
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.term-details {
    margin-top: 1rem;
}

.term-description p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.term-description strong {
    color: #d35400;
}

.term-description ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.term-description li {
    margin-bottom: 0.4rem;
    color: #5d6d7e;
}

.term-example {
    background: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    border-left: 4px solid #27ae60;
}

.term-example h4 {
    color: #27ae60;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.term-example code {
    display: block;
    font-family: 'Courier New', monospace;
    color: #d35400;
    line-height: 1.6;
    font-size: 0.95rem;
}

.addressing-explanation {
    margin: 4rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa, #ecf0f1);
    border-radius: 12px;
}

.addressing-explanation h3 {
    text-align: center;
    color: #d35400;
    margin-bottom: 2rem;
}

.addressing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.addressing-card {
    background: white;
    padding: 1.8rem;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.06);
}

.addressing-card h4 {
    color: #e67e22;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.addressing-card ul {
    margin-left: 1.5rem;
}

.addressing-card li {
    margin-bottom: 0.6rem;
    line-height: 1.6;
}

.manufacturer-differences {
    border-left: 5px solid #e74c3c !important;
}

.warning-box {
    background: #fdf2f2;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    border-left: 4px solid #e74c3c;
    font-weight: 500;
}

/* Data Format Challenges */
.data-format-challenges {
    margin: 4rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #fff5f5, #fef5e7);
    border-radius: 12px;
    border: 2px solid #fed7d7;
}

.data-format-challenges h3 {
    text-align: center;
    color: #d35400;
    margin-bottom: 2rem;
}

.format-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
}

.format-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-left: 5px solid #f39c12;
}

.format-card h4 {
    color: #e67e22;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

/* Timing specific styles */
.timing-examples {
    margin: 3rem 0;
}

.timing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.timing-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 5px solid #e67e22;
}

.timing-card h4 {
    color: #d35400;
    margin-bottom: 1rem;
}

.timing-card pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1.5rem;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

.timing-explanation {
    margin: 1.5rem 0;
}

.timing-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.timing-example {
    background: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e9ecef;
}

.timing-example h5 {
    color: #d35400;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.timing-calc {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.timing-value {
    background: #e67e22;
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.timing-note {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 0.8rem;
}

.baud-timing {
    background: #f1f3f4;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.baud-timing h5 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.timing-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timing-row {
    background: white;
    padding: 0.8rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    border-left: 4px solid #e67e22;
}

.serial-explanation {
    margin: 1.5rem 0;
}

.serial-issues {
    margin: 1.5rem 0;
}

.serial-issue {
    background: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #17a2b8;
}

.serial-issue h5 {
    color: #17a2b8;
    margin-bottom: 0.8rem;
}

.issue-solutions {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.issue-solutions ul {
    margin-left: 1.5rem;
}

.issue-solutions li {
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

/* Configuration Challenges */
.configuration-challenges {
    margin: 4rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #fdf2f2, #fff5f5);
    border-radius: 12px;
    border: 2px solid #e74c3c;
}

.configuration-challenges h3 {
    text-align: center;
    color: #c0392b;
    margin-bottom: 2rem;
}

.challenge-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.challenge-card {
    background: white;
    padding: 1.8rem;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    border-left: 5px solid #e74c3c;
}

.challenge-card h4 {
    color: #c0392b;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.challenge-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.challenge-content strong {
    color: #d35400;
}

.challenge-content ul {
    margin: 0.8rem 0 1rem 1.5rem;
}

.challenge-content li {
    margin-bottom: 0.4rem;
    color: #5d6d7e;
}

.best-practices-config {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.best-practices-config h4 {
    color: #27ae60;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.practices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.practice-item {
    background: #f8fff4;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #27ae60;
}

.practice-item h5 {
    color: #27ae60;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.practice-item ul {
    margin-left: 1.5rem;
}

.practice-item li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: #d35400;
}

.data-types-summary {
    margin: 4rem 0;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.data-types-summary h3 {
    text-align: center;
    color: #d35400;
    margin-bottom: 2rem;
}

.reference-table {
    overflow-x: auto;
}

.reference-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.reference-table th {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    padding: 1rem 0.8rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #d35400;
}

.reference-table td {
    padding: 0.8rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: top;
}

.reference-table tr:nth-child(even) {
    background: #f8f9fa;
}

.reference-table tr:hover {
    background: #fff3e0;
}

.reference-table th:first-child,
.reference-table td:first-child {
    font-weight: 600;
    color: #d35400;
}

/* Examples Section */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.example-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.example-card h3 {
    color: #e67e22;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.example-card pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1.5rem;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Client Section */
.steps {
    margin: 2rem 0;
}

.step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.step-number {
    background: #e67e22;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.step-content h4 {
    margin-bottom: 0.5rem;
    color: #d35400;
}

.best-practices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.practice {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.practice h4 {
    color: #e67e22;
    margin-bottom: 1rem;
}

.practice ul {
    margin-left: 1.5rem;
}

.practice li {
    margin-bottom: 0.5rem;
}

/* Server Section */
.data-model {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.data-type {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-left: 4px solid #e67e22;
}

.data-type h4 {
    color: #e67e22;
    margin-bottom: 0.5rem;
}

.address-range {
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 5px;
    font-weight: bold;
    color: #7f8c8d;
    margin-top: 1rem;
}

.considerations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.consideration {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.consideration h4 {
    color: #e67e22;
    margin-bottom: 1rem;
}

/* Quiz Section */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.quiz-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e1e8ed;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e67e22, #d35400);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.question-container {
    margin-bottom: 2rem;
    min-height: 300px;
}

.question {
    margin-bottom: 1.5rem;
}

.question h3 {
    color: #d35400;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    line-height: 1.4;
    font-weight: 600;
}

.options {
    list-style: none;
}

.option {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    color: #333;
    font-size: 1rem;
    line-height: 1.5;
}

.option:hover {
    background: #fff3e0;
    border-color: #e67e22;
    color: #333;
}

.option.selected {
    background: #fff3e0;
    border-color: #e67e22;
    color: #333;
}

.option.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
    font-weight: 500;
}

.option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
    font-weight: 500;
}

.immediate-feedback {
    margin-top: 1.5rem;
    animation: fadeIn 0.5s ease-in;
}

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

.feedback-content {
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}

.correct-feedback {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-left: 5px solid #28a745;
    color: #155724;
}

.incorrect-feedback {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-left: 5px solid #dc3545;
    color: #721c24;
}

.feedback-content h4 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.feedback-content p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.feedback-content strong {
    color: inherit;
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-btn {
    background: #e67e22;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.quiz-btn:hover:not(:disabled) {
    background: #d35400;
}

.quiz-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.submit-btn {
    background: #27ae60;
}

.submit-btn:hover {
    background: #229954;
}

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

.score-display {
    font-size: 2rem;
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    border-radius: 10px;
}

.answers-review {
    text-align: left;
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.answer-item {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 5px;
}

.answer-item.correct {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.answer-item.incorrect {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0,0,0,0.1);
}

.question-number {
    background: #e67e22;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.9rem;
}

.result-icon {
    font-size: 1.5rem;
}

.question-text {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.answer-details {
    margin-left: 1rem;
}

.answer-line {
    margin-bottom: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.user-answer, .correct-answer {
    padding: 0.3rem 0.8rem;
    border-radius: 5px;
    font-weight: 500;
}

.correct-answer {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.incorrect-answer {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.explanation {
    background: rgba(0,0,0,0.05);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    line-height: 1.6;
}

.explanation strong {
    color: #d35400;
}

/* Footer */
footer {
    background: #d35400;
    color: white;
    text-align: center;
    padding: 2rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .intro-content {
        grid-template-columns: 1fr;
    }
    
    .example-diagram {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 1.5rem;
    }
    
    .display-unit {
        order: 1;
    }
    
    .communication-flow {
        order: 2;
    }
    
    .temperature-sensor {
        order: 3;
    }
    
    .communication-step {
        flex-direction: column;
        text-align: center;
        max-width: 100%;
    }
    
    .communication-step:first-child .flow-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
    
    .communication-step:last-child .flow-arrow {
        transform: rotate(-90deg);
        margin: 0.5rem 0;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .function-codes {
        grid-template-columns: 1fr;
    }
    
    .format-fields {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .best-practices,
    .data-model,
    .considerations,
    .terms-grid,
    .addressing-cards,
    .format-cards,
    .challenge-cards,
    .practices-grid,
    .rtu-features,
    .timing-cards {
        grid-template-columns: 1fr;
    }
    
    .timing-examples,
    .packing-examples {
        grid-template-columns: 1fr;
    }
    
    .quiz-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    main {
        margin-top: 120px;
    }
}

@media (max-width: 480px) {
    .format-fields {
        grid-template-columns: 1fr;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        margin-right: 0;
        margin-bottom: 1rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Code highlighting adjustments */
.token.keyword {
    color: #e74c3c !important;
}

.token.string {
    color: #27ae60 !important;
}

.token.comment {
    color: #95a5a6 !important;
}

.token.function {
    color: #e67e22 !important;
}

/* Active navigation link */
.nav-link.active {
    color: #f39c12 !important;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #f39c12;
}

/* Modbus Gotchas Section */
.gotcha-grid {
    display: grid;
    gap: 2rem;
    margin: 3rem 0;
}

.gotcha-card {
    background: white;
    border-radius: 15px;
    padding: 2.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    border-left: 5px solid #e67e22;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gotcha-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.gotcha-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.gotcha-card h3 {
    color: #d35400;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
}

.gotcha-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #5d6d7e;
    margin-bottom: 2rem;
    text-align: center;
}

.representation-examples {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

.representation-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    border-left: 4px solid #e67e22;
}

.representation-card h4 {
    color: #d35400;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.format-info {
    background: #fef5e7;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.format-info p {
    margin: 0.3rem 0;
    font-size: 0.95rem;
}

.example-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.example-table th {
    background: #e67e22;
    color: white;
    padding: 0.8rem;
    text-align: left;
    font-weight: 600;
}

.example-table td {
    padding: 0.8rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: top;
}

.example-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.example-table tbody tr:hover {
    background: #fef2e6;
}

.format-notes {
    background: #e3f2fd;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-example {
    margin: 1rem 0;
}

.code-example pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

.representation-card p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.representation-card p strong {
    color: #d35400;
}

.gotcha-tips {
    background: linear-gradient(135deg, #fef2e6, #f8e6cc);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.gotcha-tips h4 {
    color: #d35400;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.gotcha-tips ul {
    list-style: none;
    padding: 0;
}

.gotcha-tips li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(211, 84, 0, 0.1);
    line-height: 1.5;
}

.gotcha-tips li:last-child {
    border-bottom: none;
}

.gotcha-tips li strong {
    color: #d35400;
}
