/* potree-profile.css - 2D Profile split view styles - v1.0.0 */

/* ===== Split Container ===== */
.potree-split-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.potree-split-container .viewer-potree-container {
    flex: 1;
    position: relative;
    width: 100%;
}

/* ===== Profile View (hidden by default) ===== */
.potree-profile-view {
    width: 100%;
    height: 0;
    background: #000;
    overflow: hidden;
    display: none;
    position: relative;
}

.potree-profile-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* When profile is active: 50/50 split */
.potree-split-container.split-active .potree-profile-view {
    display: block !important;
    height: 50%;
    flex-shrink: 0;
}

.potree-split-container.split-active .potree-profile-resizer {
    display: flex !important;
}

.potree-split-container.split-active .viewer-potree-container {
    flex: none;
    height: calc(50% - 8px);
}

/* ===== Resizer Bar ===== */
.potree-profile-resizer {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    cursor: row-resize;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 300;
    transition: background 0.15s;
}

.potree-profile-resizer:hover {
    background: rgba(79, 195, 247, 0.3);
}

.potree-profile-resizer-handle {
    width: 40px;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}

.potree-profile-resizer:hover .potree-profile-resizer-handle {
    background: rgba(79, 195, 247, 0.8);
}

/* ===== Profile Toolbar (inside profile view) ===== */
.potree-profile-toolbar {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 310;
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    align-items: center;
}

.potree-profile-toolbar .profile-tb-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.potree-profile-toolbar .profile-tb-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.potree-profile-toolbar .profile-tb-btn.active {
    background: rgba(79, 195, 247, 0.25);
    border-color: rgba(79, 195, 247, 0.5);
    color: #4fc3f7;
}

.potree-profile-toolbar .profile-tb-separator {
    width: 1px;
    height: 20px;
    margin: 0 2px;
    background: rgba(255, 255, 255, 0.2);
}

/* Width input */
.potree-profile-toolbar .profile-width-group {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 4px;
}

.potree-profile-toolbar .profile-width-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    white-space: nowrap;
}

.potree-profile-toolbar .profile-width-input {
    width: 50px;
    height: 26px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    font-family: monospace;
    text-align: center;
    padding: 0 4px;
    outline: none;
}

.potree-profile-toolbar .profile-width-input:focus {
    border-color: rgba(79, 195, 247, 0.5);
}

/* ===== Segment Navigation ===== */
.potree-profile-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 310;
    width: 32px;
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.potree-profile-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}

.potree-profile-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.potree-profile-nav.potree-profile-prev {
    left: 8px;
    border-radius: 6px;
}

.potree-profile-nav.potree-profile-next {
    right: 8px;
    border-radius: 6px;
}

/* ===== Profile Loader ===== */
.potree-profile-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 320;
}

/* ===== Segment Info ===== */
.potree-profile-segment-info {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 310;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-family: monospace;
    white-space: nowrap;
    pointer-events: none;
}

/* ===== Grid Labels ===== */
.potree-profile-grid-label {
    position: absolute;
    color: #cfe8ff;
    font-size: 11px;
    font-family: monospace;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 305;
}

.potree-profile-grid-label-x {
    bottom: 4px;
}

.potree-profile-grid-label-y {
    left: 4px;
}

/* ===== 2D/3D Mode Toggle ===== */
.potree-profile-toolbar .profile-mode-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 6px;
    height: 26px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    cursor: pointer;
}

.potree-profile-toolbar .profile-mode-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    font-weight: 600;
}

.potree-profile-toolbar .profile-mode-label.active {
    color: #4fc3f7;
}

/* ===== Potree viewer inside profile — override sidebar ===== */
.potree-profile-container .potree_container {
    width: 100% !important;
    height: 100% !important;
}

.potree-profile-container #potree_sidebar_container {
    display: none !important;
}

/* ===== Resizer drag state ===== */
.potree-split-container.resizing {
    cursor: row-resize;
    user-select: none;
    -webkit-user-select: none;
}

.potree-split-container.resizing * {
    pointer-events: none;
}

.potree-split-container.resizing .potree-profile-resizer {
    pointer-events: auto;
}

/* ===== DXF Export Button States ===== */
.potree-profile-toolbar .profile-tb-export-dxf.processing {
    background: rgba(79, 195, 247, 0.25);
    border-color: rgba(79, 195, 247, 0.5);
    color: #4fc3f7;
}

.potree-profile-toolbar .profile-tb-export-dxf.done {
    background: rgba(76, 175, 80, 0.25);
    border-color: rgba(76, 175, 80, 0.5);
    color: #4caf50;
}

.potree-profile-toolbar .profile-tb-export-dxf.done:hover {
    background: rgba(76, 175, 80, 0.4);
    color: #66bb6a;
}

.potree-profile-toolbar .profile-tb-export-dxf.error {
    background: rgba(244, 67, 54, 0.25);
    border-color: rgba(244, 67, 54, 0.5);
    color: #f44336;
}

.potree-profile-toolbar .profile-tb-export-dxf.error:hover {
    background: rgba(244, 67, 54, 0.4);
    color: #ef5350;
}
