body { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; line-height: 1.7; margin: 0; background-color: #f8f9fa; color: #212529; }
body.sidebar-open { overflow: hidden; }
header { background: #212529; color: #fff; padding: 1.25rem 1.5rem; text-align: center; border-bottom: 3px solid #0d6efd; position: relative; }
header h1 { margin: 0; font-size: 1.75rem; font-weight: 600; }
header a { color: #fff; text-decoration: none; }
.container { display: flex; max-width: 100%; }
.sidebar { width: 260px; flex-shrink: 0; background: #fff; border-right: 1px solid #dee2e6; padding: 1.5rem; height: calc(100vh - 83px); overflow-y: auto; position: sticky; top: 0; }
.main-content { flex-grow: 1; padding: 2.5rem; min-width: 0; max-width: 960px; margin: 0 auto; }
.main-content-full { width: 100%; max-width: 1200px; margin: 0 auto; padding: 2.5rem; box-sizing: border-box; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav a { text-decoration: none; color: #495057; display: block; padding: 0.6rem 1rem; border-radius: 6px; transition: background-color 0.2s ease, color 0.2s ease; }
.sidebar-nav a:hover { background-color: #e9ecef; }
.sidebar-nav .module-item > a { font-weight: 500; }
.sidebar-nav .module-item.active > a { background-color: #0d6efd; color: #fff; font-weight: bold; }
.sidebar-nav .topic-list { border-left: 2px solid #e9ecef; padding-left: 1.5rem; margin-top: 0.5rem; margin-left: 0.5rem; }
.sidebar-nav .topic-list a { font-size: 0.9rem; padding: 0.35rem 1rem; }
.sidebar-nav .topic-item.active > a { color: #0d6efd; font-weight: bold; }
.topic-section { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 2.5rem; }
.topic-section h1 { margin-top: 0; border-bottom: 2px solid #0d6efd; padding-bottom: 0.5rem; }
.topic-content { overflow-x: auto; }
.topic-content p { margin-top: 0; margin-bottom: 1rem; }
.topic-content figure { margin: 2rem auto; padding: 1rem; border: 1px solid #dee2e6; border-radius: 8px; background-color: #f8f9fa; max-width: 600px; }
.topic-content img { max-width: 100%; height: auto; display: block; border-radius: 4px; }
.topic-content figcaption { margin-top: 0.75rem; text-align: center; font-size: 0.9rem; color: #6c757d; font-style: italic; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.module-card { display: block; background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-decoration: none; color: inherit; transition: transform 0.2s ease, box-shadow 0.2s ease; border-bottom: 3px solid transparent; }
.module-card:hover { transform: translateY(-5px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); border-bottom-color: #0d6efd; }
.module-card h2 { margin: 0 0 0.5rem 0; color: #0d6efd; font-size: 1.25rem; }
.module-card p { margin: 0; color: #6c757d; font-size: 0.95rem; }
.quiz-container { margin-top: 2.5rem; padding: 1.5rem; border: 1px solid #dee2e6; border-radius: 8px; background-color: #fff; }
.quiz-body .question { margin-bottom: 1.5rem; }
.quiz-body .question-image { max-width: 400px; margin: 0.5rem 0; border-radius: 5px; }
.quiz-body .option-image { max-height: 80px; margin-left: 1rem; vertical-align: middle; border-radius: 5px; }
.quiz-body label { display: flex; align-items: center; margin-bottom: 0.5rem; padding: 0.5rem; border-radius: 5px; cursor: pointer; }
.quiz-body .result { margin-top: 0.5rem; font-weight: bold; }
.quiz-body .correct { color: #198754; }
.quiz-body .incorrect { color: #dc3545; }
.check-btn { padding: 8px 16px; background-color: #0d6efd; color: white; border: none; border-radius: 5px; cursor: pointer; margin-top: 0.5rem; }
.menu-toggle, .sidebar-overlay { display: none; }
.simulator-wrapper { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-top: 2rem; }
#canvas-container { border: 2px solid #ccc; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.controls { background-color: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); min-width: 250px; }
.controls h2 { margin-top: 0; border-bottom: 2px solid #0d6efd; padding-bottom: 0.5rem; }
#info-box { margin-top: 1rem; padding: 1rem; background-color: #e9ecef; border-radius: 5px; }
@media (max-width: 992px) {
    .simulator-wrapper { flex-direction: column; }
    #canvas-container canvas { width: 100% !important; height: auto !important; }
}
.simulator-wrapper-3d { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-top: 2rem; }
#canvas-container-3d { flex: 2; min-width: 400px; height: 500px; border: 1px solid #dee2e6; }
.controls-3d { flex: 1; min-width: 280px; background-color: #f8f9fa; padding: 1.5rem; border-radius: 8px; }
.controls-3d h2 { margin-top: 0; border-bottom: 2px solid #0d6efd; padding-bottom: 0.5rem; }
.controls-3d h3 { margin-bottom: 0.5rem; margin-top: 1rem; }
.controls-info { font-size: 0.9rem; color: #6c757d; margin-top: -0.5rem; }
.control-group label { display: flex; justify-content: space-between; font-weight: 500; margin-bottom: 0.25rem; font-size: 0.9rem; }
.control-group input[type="range"] { width: 100%; margin-bottom: 0.5rem; }
@media (max-width: 1000px) {
    .simulator-wrapper-3d { flex-direction: column; }
    #canvas-container-3d { width: 100%; height: 400px; flex: auto; }
    .controls-3d { width: auto; flex: auto; }
}
.simulator-wrapper-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 2rem; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-top: 2rem; }
#canvas-container-links { flex: 2; min-width: 500px; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.controls-links { flex: 1; min-width: 300px; background-color: #f8f9fa; padding: 1.5rem; border-radius: 8px; border: 1px solid #dee2e6; }
.controls-links h2 { margin-top: 0; border-bottom: 2px solid #0d6efd; padding-bottom: 0.5rem; }
@media (max-width: 900px) {
    .simulator-wrapper-links { flex-direction: column; }
    #canvas-container-links { width: 100%; min-width: auto; }
    .controls-links { width: 100%; box-sizing: border-box; }
}
.simulator-wrapper-3d { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-top: 2rem; }
#canvas-container-joints { flex: 2; min-width: 400px; height: 500px; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.controls-3d { flex: 1; min-width: 320px; }
.joint-selection label { background-color: #f1f5f9; border-color: #e2e8f0; }
.joint-selection input[type="radio"]:checked + label { background-color: #3b82f6; color: white; border-color: #3b82f6; }
.slider-control label { white-space: nowrap; }
.slider-control label span:first-child { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1000px) {
    .simulator-wrapper-3d { flex-direction: column; }
    #canvas-container-joints { width: 100%; height: 400px; flex: auto; }
    .controls-3d { width: 100%; box-sizing: border-box; }
}
#canvas-container-kinematic-chain { border-radius: 12px; overflow: hidden; box-shadow: 0 10px 20px rgba(0,0,0,0.1); background: white; }
@media (max-width: 992px) {
    header { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 1001; }
    header h1 { font-size: 1.25rem; }
    .container { flex-direction: column; }
    .sidebar { width: 280px; height: 100%; position: fixed; top: 0; left: -280px; z-index: 1002; transition: transform 0.3s ease-in-out; border-right: 1px solid #dee2e6; box-sizing: border-box; }
    .sidebar.open { transform: translateX(280px); }
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; }
    .sidebar-overlay.open { display: block; }
    .main-content, .main-content-full { padding: 1.5rem; }
    .topic-section { padding: 1.5rem; }
    .menu-toggle { display: block; background: #495057; color: white; border: none; padding: 0.5rem 0.8rem; border-radius: 5px; cursor: pointer; font-size: 1.2rem; }
}
