/* ==========================================
   Layout - Dark Theme (FIXED MOBILE)
   ========================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #1e1e1e;
    color: #cccccc;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: #1e1e1e;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: #252526;
    border-right: 1px solid #3e3e42;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, margin 0.3s ease;
    z-index: 100;
    flex-shrink: 0;
    position: relative;
}

.sidebar.collapsed {
    transform: translateX(-280px);
    margin-right: -280px;
}

.sidebar-header {
    padding: 15px 20px;
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #cccccc;
}

.sidebar-tabs {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Content Area */
.content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1e1e1e;
    transition: all 0.3s ease;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    height: 56px;
    padding: 0;
    padding-left: 0;
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    gap: 0;
}

.toolbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.toolbar-title h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #cccccc;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Content Body */
.content-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #1e1e1e;
}

#tabContents {
    height: 100%;
    width: 100%;
}

.tab-content {
    display: none;
    height: 100%;
    width: 100%;
    position: relative;
}

.tab-content.active {
    display: flex;
}

.tab-content.edit-mode {
    flex-direction: row;
}

/* Preview Container */
.preview-container {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #1e1e1e;
}

.preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* File Input (Hidden) */
input[type="file"] {
    display: none;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* Scrollbar Styling - Dark */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #3e3e42;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4e4e52;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 101;
        width: 280px;
        min-width: 280px;
        margin-right: 0;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 280px;
        min-width: 280px;
        margin-right: 0;
    }
    
    /* Content always full width on mobile */
    .content-area {
        width: 100%;
    }
    
    .toolbar {
        padding: 0;
        height: 52px;
    }
    
    .toolbar-title h1 {
        font-size: 14px;
    }
}