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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
    overflow: hidden;
}

/* Header */
.header {
    background-color: #2a2a2a;
    border-bottom: 2px solid #00ff88;
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left, .header-right {
    flex: 0 0 auto;
    min-width: 120px;
}

.header-center {
    flex: 1;
    text-align: center;
}

.home-link {
    color: #00ff88;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s;
}

.home-link:hover {
    color: #00cc66;
}

.license {
    color: #888;
    font-size: 0.85em;
    font-style: italic;
}

.license-box {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px 15px;
    font-size: 0.75em;
    line-height: 1.4;
    text-align: left;
}

.license-box h2,
.license-box h3 {
    font-size: 1em;
    margin: 0 0 5px 0;
    color: #ccc;
}

.license-box p {
    margin: 3px 0;
    color: #ccc;
    font-size: 0.9em;
}

.header h1 {
    color: #00ff88;
    font-size: 1.8em;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 255, 136, 0.3);
}

.header p {
    color: #aaa;
    font-size: 0.9em;
}

/* Main Layout */
.main-container {
    display: flex;
    height: calc(100vh - 80px);
    position: relative;
}

/* Splitter Styles */
.splitter {
    width: 6px;
    background-color: #333;
    cursor: col-resize;
    position: relative;
    transition: background-color 0.2s;
}

.splitter:hover {
    background-color: #00ff88;
}

.splitter.dragging {
    background-color: #00ff88;
    opacity: 0.8;
}

.splitter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background-color: #666;
}

/* Left Sidebar - Chapter Navigation */
.chapter-nav {
    width: 280px;
    background-color: #242424;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #444;
    min-width: 200px;
}

.chapter-nav h2 {
    color: #00ff88;
    font-size: 1.2em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.chapter-list {
    list-style: none;
}

.chapter-list li {
    margin-bottom: 8px;
}

.chapter-link {
    display: block;
    padding: 8px 12px;
    color: #ccc;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.chapter-link:hover {
    background-color: #333;
    color: #00ff88;
    border-color: #00ff88;
}

.chapter-link.active {
    background-color: #00ff88;
    color: #1a1a1a;
    font-weight: bold;
}

/* Main Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #1e1e1e;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

#content {
    max-width: 800px;
    margin: 0 auto;
}

#content h2 {
    color: #00ff88;
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #00ff88;
}

#content h3 {
    color: #66ff99;
    margin: 25px 0 15px;
}

#content h4 {
    color: #88ffaa;
    margin: 20px 0 10px;
}

#content p {
    margin-bottom: 15px;
    line-height: 1.8;
}

#content ul, #content ol {
    margin: 0 0 20px 30px;
}

#content li {
    margin-bottom: 8px;
}

#content code {
    background-color: #2a2a2a;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #00ff88;
}

/* Code Blocks */
.code-block {
    background-color: #0a0a0a;
    border: 1px solid #444;
    border-radius: 6px;
    margin: 20px 0;
    overflow: hidden;
}

.code-block pre {
    padding: 20px;
    overflow-x: auto;
    margin: 0;
}

.code-block code {
    background: none;
    padding: 0;
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.5;
}

/* Right Sidebar */
.right-sidebar {
    width: 300px;
    background-color: #242424;
    padding: 20px;
    border-left: 1px solid #444;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Scrollable content area */
.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Tool Panel */
.tool-panel {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #444;
}

.tool-panel h3 {
    color: #00ff88;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.tool-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.tool-option input[type="checkbox"] {
    margin-right: 8px;
}

/* Guide Section */
.guide-section {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #444;
}

.guide-section h3 {
    color: #00ff88;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.guide-content {
    color: #ccc;
    font-size: 0.9em;
}

.guide-content ul {
    margin: 10px 0 0 20px;
}

.guide-content li {
    margin-bottom: 5px;
}

/* Diff Display */
#diff-content {
    margin-top: 30px;
    padding: 20px;
    background-color: #252525;
    border: 1px solid #444;
    border-radius: 6px;
}

#diff-content h3 {
    color: #ffaa00;
    margin-bottom: 15px;
}

.diff-content {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}




/* Chapter Code Section */
.chapter-code-section {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #444;
}

.chapter-code-section h3 {
    color: #00ff88;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.code-container {
    background-color: #0a0a0a;
    border-radius: 4px;
    overflow: hidden;
}

.code-header {
    background-color: #2a2a2a;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.code-header:hover {
    background-color: #333;
}

.code-toggle {
    color: #888;
    font-size: 0.9em;
}

.code-actions {
    display: flex;
    gap: 10px;
}

.copy-button {
    background-color: #00ff88;
    color: #1a1a1a;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    transition: all 0.2s;
}

.copy-button:hover {
    background-color: #00cc66;
    transform: translateY(-1px);
}

.copy-button:active {
    transform: translateY(0);
}

.copy-button.copied {
    background-color: #4CAF50;
}

.code-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.code-content.expanded {
    max-height: 400px;
    overflow-y: auto;
}

.code-content pre {
    margin: 0;
    padding: 15px;
    overflow-x: auto;
}

.code-content code {
    color: #e0e0e0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    line-height: 1.4;
}

/* Chapter Summary Section */
.chapter-summary-section {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #444;
}

.chapter-summary-section h3 {
    color: #ffaa00;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.summary-content {
    color: #ccc;
    font-size: 0.9em;
    line-height: 1.6;
}

.summary-content ul {
    margin: 10px 0 0 20px;
}

.summary-content li {
    margin-bottom: 5px;
}

/* Cover Image Section */
.cover-section {
    flex-shrink: 0;
    padding-top: 20px;
    text-align: center;
    border-top: 1px solid #444;
}

.cover-image {
    max-width: 100%;
    height: auto;
    max-height: 250px;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cover-image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
}

/* Modal Styles */
.cover-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    position: relative;
    margin: 5% auto;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 255, 136, 0.2);
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: #00ff88;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00ff88;
}

/* Mobile Notice */
.mobile-notice {
    display: none;
    background-color: #2a2a2a;
    border: 1px solid #00ff88;
    padding: 15px;
    margin: 10px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9em;
}

.mobile-notice h3 {
    color: #00ff88;
    margin-bottom: 10px;
}

.mobile-notice p {
    margin-bottom: 8px;
}

.mobile-notice .browser-info {
    color: #ffaa00;
    font-size: 0.85em;
    margin-top: 10px;
}

/* Mobile Chapter Selector */
.mobile-chapter-selector {
    display: none;
    background-color: #2a2a2a;
    padding: 15px;
    border-bottom: 2px solid #00ff88;
    position: sticky;
    top: 80px;
    z-index: 90;
}

.chapter-dropdown {
    width: 100%;
    padding: 10px;
    background-color: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
}

.chapter-dropdown:focus {
    outline: none;
    border-color: #00ff88;
}

.chapter-dropdown option {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* Responsive */
@media (max-width: 1200px) {
    .right-sidebar {
        display: none;
    }
    
    #splitter-right {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Hide desktop elements */
    .chapter-nav {
        display: none;
    }
    
    .splitter {
        display: none;
    }
    
    .right-sidebar {
        display: none;
    }
    
    /* Show mobile elements */
    .mobile-notice {
        display: block;
    }
    
    .mobile-chapter-selector {
        display: block;
    }
    
    /* Adjust main container */
    .main-container {
        flex-direction: column;
        height: auto;
        /* height: calc(100vh + 600px); */
        min-height: calc(100vh - 80px);
    }
    
    /* Full width content area */
    .content-area {
        width: 100%;
        padding: 15px;
    }
    
    /* Adjust header for mobile */
    .header h1 {
        font-size: 1.4em;
    }
    
    .header p {
        font-size: 0.8em;
    }
    
    /* Adjust content styling for mobile */
    .content-header h2 {
        font-size: 1.5em;
    }
    
    .code-block {
        font-size: 0.85em;
    }
    
    .diff-content pre {
        font-size: 0.8em;
        padding: 10px;
    }
    
    /* Adjust diff navigation for mobile */
    .diff-navigation {
        padding: 8px;
        font-size: 0.8em;
    }
    
    /* Adjust footer for mobile */
    footer {
        padding: 15px;
        font-size: 0.8em;
    }
    
    /* Hide cover modal close button text on mobile */
    .close-modal {
        top: 10px;
        right: 10px;
        font-size: 30px;
    }
}
