* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #2c3e50 0%, #1a2632 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 1px;
}

.chapter-nav ul {
    list-style: none;
    padding: 15px 0;
}

.chapter-nav li {
    margin: 2px 0;
    transition: all 0.3s;
}

.chapter-nav li.active {
    background: rgba(52, 152, 219, 0.3);
    border-left: 4px solid #3498db;
}

.chapter-nav li:hover {
    background: rgba(255,255,255,0.1);
}

.chapter-nav a {
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    padding: 12px 20px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.chapter-nav a:hover {
    padding-left: 25px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.progress {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: #3498db;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Main Content Styles */
.content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
    background: #f5f5f5;
}

.content-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.content-section h1 {
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #3498db;
}

.content-section h2 {
    color: #34495e;
    margin: 20px 0 15px;
}

/* Definition Cards */
.definition-card {
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    padding: 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.definition-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

/* Simulation Boxes */
.simulation-box {
    background: #ecf0f1;
    border-radius: 10px;
    padding: 25px;
    margin: 30px 0;
}

.simulation-title {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

/* Canvas for visualizations */
.simulation-canvas {
    width: 100%;
    height: 300px;
    background: white;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

/* Interactive elements */
.control-panel {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

/* Component Grid */
.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.component-item {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.component-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

/* Data Flow Animation */
.data-flow-demo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
    background: #2c3e50;
    border-radius: 10px;
    color: white;
}

.device {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.data-packet {
    width: 40px;
    height: 40px;
    background: #e74c3c;
    border-radius: 5px;
    animation: movePacket 3s infinite;
}

@keyframes movePacket {
    0% { transform: translateX(0); }
    50% { transform: translateX(100px); }
    100% { transform: translateX(200px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .content {
        margin-left: 0;
    }
    
    .container {
        flex-direction: column;
    }
    
    .components-grid {
        grid-template-columns: 1fr;
    }
}