:root {
    --sidebar-width: 300px;
    --header-height: 60px;
    --primary-color: #2563eb;
    --border-color: #e2e8f0;
    --bg-color: #f8fafc;
}

.m2p-container {
    height: calc(100vh - var(--header-height));
    background-color: var(--bg-color);
    overflow: hidden;
}

/* Sidebar Styles */
.m2p-sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.m2p-sidebar-header,
.m2p-panel-header {
    height: var(--header-height);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    background: white;
    justify-content: space-between;
}

.m2p-controls {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
}

/* Main Area Styles */
.m2p-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
}

.m2p-workspace {
    display: flex;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

.m2p-editor, .m2p-preview-pane {
    flex: 1;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.m2p-editor {
    border-right: 1px solid var(--border-color);
    background: white;
}

#markdown-input {
    flex: 1;
    width: 100%;
    resize: none;
    border: none;
    padding: 1.5rem;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    background: #fff;
    color: #1a1a1a;
}

.m2p-preview-area {
    flex: 1;
    background: #525659; /* PDF viewer background color */
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}

/* A4 Paper Simulation */
#preview-content {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 10mm; /* Default padding, controlled by JS */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin: 0 auto;
    transition: width 0.3s ease, min-height 0.3s ease, padding 0.3s ease;
}

/* Landscape Mode */
#preview-content.landscape {
    width: 297mm;
    min-height: 210mm;
}

/* Form Control Tweaks */
.form-range {
    width: 100%;
}
.form-control-sm {
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .m2p-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - var(--header-height));
    }

    .m2p-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .m2p-workspace {
        flex-direction: column;
        height: auto;
    }

    .m2p-editor, .m2p-preview-area {
        height: 50vh;
        width: 100%;
    }
    
    .m2p-editor {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    #preview-content {
        width: 100%;
        padding: 1rem;
    }
}

/* Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
