/* Course Layout Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.main-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
}

.tutorial-container {
    display: flex;
    margin-top: 58px;
    flex: 1;
    background-color: #fff;
    position: relative;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    width: 250px;
    background: white;
    padding: 20px;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    border-right: 1px solid #dee2e6;
    position: fixed;
    top: 58px;
    left: 0;
    z-index: 2;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.sidebar h3 {
    margin-bottom: 20px;
    color: #4CAF50;
    font-weight: bold;
    padding: 10px;
}

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

.sidebar li {
    margin-bottom: 10px;
}

.sidebar a {
    display: block;
    padding: 10px;
    color: #495057;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.sidebar a:hover {
    background-color: #e9ecef;
    color: #228be6;
}

.sidebar a.active {
    background-color: #228be6;
    color: white;
}

.tutorial-content {
    flex: 1;
    padding: 40px;
    margin-left: 250px;
    box-sizing: border-box;
    background-color: #fff;
    min-height: calc(100vh - 118px);
    word-wrap: break-word;
}

/* Code block styling */
pre {
    background-color: #f8f9fa;
    padding: 1.2rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #e9ecef;
}

code {
    font-family: 'Courier New', Courier, monospace;
    color: #333;
    font-size: 0.95em;
}

/* Code Editor Styles */
.editor-container {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    background-color: #fff;
}

.editor-header {
    background-color: #f5f5f5;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

.code-editor {
    flex: 1;
}

.CodeMirror {
    height: auto !important;
    min-height: 200px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.preview-container {
    flex: 1;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
}

.preview-frame {
    width: 100%;
    min-height: 200px;
    border: none;
    background: #fff;
}

.run-button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 10px;
}

.run-button:hover {
    background-color: #45a049;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    z-index: 1000;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* تنسيقات للشاشات الصغيرة */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        z-index: 999;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .course-container {
        margin-left: 0;
    }
}

@media screen and (min-width: 768px) {
    .tutorial-content {
        font-size: 18px;
        line-height: 1.6;
    }
}

@media screen and (min-width: 1024px) {
    .tutorial-content {
        font-size: 21px;
        line-height: 1.7;
    }
    .tutorial-content h1 {
        font-size: 32px;
    }
    .tutorial-content h2 {
        font-size: 28px;
    }
    .tutorial-content h3 {
        font-size: 24px;
    }
    .tutorial-content pre,
    .tutorial-content code {
        font-size: 18px;
    }
}

@media screen and (min-width: 768px) {
    .editor-workspace {
        flex-direction: row;
    }

    .code-editor,
    .preview-container {
        width: 50%;
    }
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .tutorial-container {
        margin-top: 45px;
    }

    .tutorial-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .tutorial-container {
        margin-top: 40px;
    }

    .sidebar {
        top: 40px;
    }
}

/* CSS Playground Styles */
.css-playground {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
    background-color: #fff;
    border-radius: 5px;
}

.css-playground .editor-container {
    flex: 1;
    margin: 0;
}

.css-playground .preview-section {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.css-playground .preview-container {
    padding: 0;
    border: none;
}

.css-playground .preview-frame {
    width: 100%;
    min-height: 300px;
    border: none;
    background: #fff;
}

.css-playground .editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f5f5f5;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
}

.css-playground .editor-workspace {
    padding: 0;
}

.css-playground .CodeMirror {
    height: 200px;
    border: 1px solid #ddd;
}

/* Responsive layout for larger screens */
@media screen and (min-width: 1024px) {
    .css-playground {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .css-playground .editor-container {
        width: calc(50% - 10px);
    }

    .css-playground .preview-section {
        width: 100%;
        margin-top: 20px;
    }

    .css-playground .preview-frame {
        min-height: 400px;
    }
}
