/**
 * ncrom_builder - Layout CSS
 * @version 0.1.0
 */

/* CSS Variables */
:root {
    /* Colors */
    --ncrom-primary: #3498db;
    --ncrom-primary-hover: #2980b9;
    --ncrom-primary-light: #e3f2fd;
    --ncrom-secondary: #2ecc71;
    --ncrom-danger: #e74c3c;
    --ncrom-warning: #f39c12;

    /* Grays */
    --ncrom-gray-100: #f8f9fa;
    --ncrom-gray-200: #e9ecef;
    --ncrom-gray-300: #dee2e6;
    --ncrom-gray-400: #ced4da;
    --ncrom-gray-500: #adb5bd;
    --ncrom-gray-600: #6c757d;
    --ncrom-gray-700: #495057;
    --ncrom-gray-800: #343a40;
    --ncrom-gray-900: #212529;

    /* Text */
    --ncrom-text-primary: #333333;
    --ncrom-text-secondary: #666666;
    --ncrom-text-muted: #999999;
    --ncrom-text-inverse: #ffffff;

    /* Layout - can be overridden by inline styles */
    --ncrom-container-width: 1200px;
    --ncrom-sidebar-left-width: 250px;
    --ncrom-sidebar-right-width: 250px;
    --ncrom-fixed-left-width: 160px;
    --ncrom-fixed-right-width: 160px;

    /* Panel */
    --ncrom-panel-width: 320px;
    --ncrom-panel-bg: #ffffff;
    --ncrom-panel-shadow: 0 0 20px rgba(0,0,0,0.15);
    --ncrom-panel-z-index: 9999;

    /* Typography */
    --ncrom-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
    --ncrom-font-size-xs: 11px;
    --ncrom-font-size-sm: 12px;
    --ncrom-font-size-base: 14px;
    --ncrom-font-size-md: 16px;
    --ncrom-font-size-lg: 18px;

    /* Spacing */
    --ncrom-space-xs: 4px;
    --ncrom-space-sm: 8px;
    --ncrom-space-md: 16px;
    --ncrom-space-lg: 24px;
    --ncrom-space-xl: 32px;
}

/* Reset */
.ncrom-wrapper,
.ncrom-wrapper *,
.ncrom-wrapper *::before,
.ncrom-wrapper *::after {
    box-sizing: border-box;
}

/* Wrapper */
.ncrom-wrapper {
    position: relative;
    min-height: 100vh;
    font-family: var(--ncrom-font-family);
    font-size: var(--ncrom-font-size-base);
    color: var(--ncrom-text-primary);
    line-height: 1.5;
}

/* Header */
.ncrom-header {
    background: var(--ncrom-gray-100);
    border-bottom: 1px solid var(--ncrom-gray-200);
}

.ncrom-header-inner {
    max-width: var(--ncrom-container-width);
    margin: 0 auto;
    padding: var(--ncrom-space-md);
}

.ncrom-logo {
    font-size: var(--ncrom-font-size-lg);
    font-weight: bold;
    color: var(--ncrom-primary);
}

/* Container */
.ncrom-container {
    max-width: var(--ncrom-container-width);
    margin: 0 auto;
    padding: var(--ncrom-space-md);
    display: flex;
    gap: var(--ncrom-space-md);
}

/* Main Content */
.ncrom-main {
    flex: 1;
    min-width: 0;
    min-height: 300px;
}

/* Sidebar */
.ncrom-sidebar {
    flex-shrink: 0;
    background: var(--ncrom-gray-100);
    border: 1px solid var(--ncrom-gray-200);
    border-radius: 4px;
}

.ncrom-sidebar--left {
    width: var(--ncrom-sidebar-left-width);
    order: -1;
}

.ncrom-sidebar--right {
    width: var(--ncrom-sidebar-right-width);
    order: 1;
}

.ncrom-sidebar--sticky {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Sidebar Visibility based on wrapper class */
.ncrom-sidebar {
    display: none;
}

.ncrom-sidebar-left .ncrom-sidebar--left,
.ncrom-sidebar-both .ncrom-sidebar--left {
    display: block;
}

.ncrom-sidebar-right .ncrom-sidebar--right,
.ncrom-sidebar-both .ncrom-sidebar--right {
    display: block;
}

/* Editing Mode - always show sidebars for editing */
.ncrom-editing .ncrom-sidebar {
    display: block;
    opacity: 0.5;
    border-style: dashed;
}

.ncrom-editing.ncrom-sidebar-left .ncrom-sidebar--left,
.ncrom-editing.ncrom-sidebar-right .ncrom-sidebar--right,
.ncrom-editing.ncrom-sidebar-both .ncrom-sidebar--left,
.ncrom-editing.ncrom-sidebar-both .ncrom-sidebar--right {
    opacity: 1;
    border-style: solid;
}

/* Fixed Layers */
.ncrom-fixed-layer {
    position: fixed;
    z-index: 100;
    background: var(--ncrom-panel-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.ncrom-fixed-layer--left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: var(--ncrom-fixed-left-width);
    border-radius: 0 4px 4px 0;
}

.ncrom-fixed-layer--right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: var(--ncrom-fixed-right-width);
    border-radius: 4px 0 0 4px;
}

.ncrom-fixed-layer--top {
    top: 0;
    left: 0;
    right: 0;
}

.ncrom-fixed-layer--bottom {
    bottom: 0;
    left: 0;
    right: 0;
}

/* Layer Content */
.ncrom-layer-content {
    padding: var(--ncrom-space-md);
    min-height: 50px;
}

/* Footer */
.ncrom-footer {
    background: var(--ncrom-gray-800);
    color: var(--ncrom-text-inverse);
    margin-top: var(--ncrom-space-xl);
}

.ncrom-footer-inner {
    max-width: var(--ncrom-container-width);
    margin: 0 auto;
    padding: var(--ncrom-space-lg);
    text-align: center;
}

.ncrom-footer p {
    margin: 0;
    font-size: var(--ncrom-font-size-sm);
    opacity: 0.8;
}

/* Edit Toggle Button */
.ncrom-edit-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--ncrom-primary);
    color: var(--ncrom-text-inverse);
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    z-index: var(--ncrom-panel-z-index);
    transition: all 0.3s ease;
}

.ncrom-edit-toggle:hover {
    background: var(--ncrom-primary-hover);
    transform: scale(1.1);
}

.ncrom-edit-toggle.is-active {
    background: var(--ncrom-danger);
}

/* Responsive */
@media (max-width: 1199px) {
    .ncrom-fixed-layer--left,
    .ncrom-fixed-layer--right {
        display: none;
    }

    .ncrom-sidebar--left {
        width: 200px;
    }

    .ncrom-sidebar--right {
        width: 200px;
    }
}

@media (max-width: 767px) {
    .ncrom-container {
        flex-direction: column;
    }

    .ncrom-sidebar {
        width: 100% !important;
        order: 2 !important;
    }

    .ncrom-sidebar--sticky {
        position: static;
        max-height: none;
    }

    .ncrom-edit-toggle {
        right: 10px;
        bottom: 10px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}
