/**
 * 3D Modeler CSS
 * 123D Design inspired interface
 */

/* 컨테이너 */
#modeler-container {
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    margin: 0 !important;
    padding: 0 !important;
}

/* 툴바 - Modern Minimal */
#modeler-toolbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-right: 1px solid #e5e7eb;
}

.toolbar-section:last-child {
    border-right: none;
}

.toolbar-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
}

.toolbar-btn {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    color: #374151;
    font-weight: 500;
}

.toolbar-btn:hover {
    background: #fff;
    border-color: #9ca3af;
    color: #111827;
}

.toolbar-btn.active {
    background: #374151;
    color: white;
    border-color: #374151;
}

.toolbar-btn span {
    font-size: 16px;
}

/* 메인 영역 */
#modeler-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* 사이드바 (객체 목록) - Clean Design */
#modeler-sidebar {
    width: 240px;
    min-width: 200px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
}

.object-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.object-item {
    padding: 12px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.object-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.object-item.selected {
    background: #374151;
    color: white;
    border-color: #374151;
}

.object-name {
    font-size: 13px;
    font-weight: 500;
}

.object-type {
    font-size: 11px;
    color: #666;
    margin-top: 3px;
}

.object-item.selected .object-type {
    color: rgba(255, 255, 255, 0.8);
}

.empty-message {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 40px 20px;
}

/* 뷰포트 */
#modeler-viewport {
    flex: 1;
    position: relative;
    background: #f5f5f5;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

#modeler-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    cursor: crosshair;
    outline: none;
}

#viewport-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 12px;
}

.info-item {
    margin-bottom: 5px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item strong {
    color: #333;
}

.info-item span {
    color: #2196F3;
    font-weight: 600;
}

/* 로딩 */
#modeler-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#modeler-loading p {
    margin: 0;
    font-size: 14px;
    color: #333;
}

/* 속성 패널 */
#modeler-properties {
    width: 220px;
    min-width: 180px;
    background: white;
    border-left: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.properties-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.properties-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

#properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.property-group {
    margin-bottom: 20px;
}

.property-group h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.property-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
}

.property-label {
    color: #666;
    font-weight: 500;
}

.property-value {
    color: #333;
    font-weight: 600;
}

.property-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 5px;
}

.property-input:focus {
    outline: none;
    border-color: #2196F3;
}

/* 상태바 */
#modeler-statusbar {
    background: #2c2c2c;
    color: white;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    flex-shrink: 0;
}

.status-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

#status-message {
    color: #4CAF50;
    font-weight: 500;
}

/* 반응형 */
@media (max-width: 1200px) {
    #modeler-sidebar {
        width: 180px;
        min-width: 150px;
    }

    #modeler-properties {
        width: 200px;
        min-width: 150px;
    }
}

@media (max-width: 1024px) {
    #modeler-sidebar {
        width: 160px;
    }

    #modeler-properties {
        width: 180px;
    }

    .toolbar-btn span {
        display: none;
    }
}

@media (max-width: 768px) {
    #modeler-toolbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 8px 10px;
    }

    .toolbar-section {
        padding: 0 5px;
        gap: 3px;
    }

    .toolbar-btn {
        padding: 6px 8px;
        font-size: 12px;
    }

    #modeler-sidebar,
    #modeler-properties {
        display: none;
    }

    #viewport-info {
        font-size: 10px;
        padding: 8px 10px;
    }
}

/* 커브 포인트 스타일 */
.curve-point {
    width: 8px;
    height: 8px;
    background: #2196F3;
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 100;
}

.curve-point:hover {
    background: #1976D2;
    transform: translate(-50%, -50%) scale(1.3);
}

/* 컨트롤 포인트 (베지어) */
.control-point {
    width: 6px;
    height: 6px;
    background: #FF9800;
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 99;
}

.control-point:hover {
    background: #F57C00;
    transform: translate(-50%, -50%) scale(1.3);
}

/* WordPress 테마 요소 숨기기 */
body.modeler-fullscreen {
    overflow: hidden !important;
}

body.modeler-fullscreen #wpadminbar,
body.modeler-fullscreen header,
body.modeler-fullscreen footer,
body.modeler-fullscreen .site-header,
body.modeler-fullscreen .site-footer,
body.modeler-fullscreen nav,
body.modeler-fullscreen .navigation,
body.modeler-fullscreen aside {
    display: none !important;
}

body.modeler-fullscreen #modeler-container {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   모바일 반응형 스타일
   ============================================ */

/* 태블릿 (768px 이하) */
@media (max-width: 768px) {
    /* 툴바 - 작은 버튼, 스크롤 가능 */
    #modeler-toolbar {
        padding: 8px 10px;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .toolbar-section {
        gap: 3px;
        padding: 0 5px;
        flex-shrink: 0;
    }

    .toolbar-title {
        font-size: 14px;
    }

    .toolbar-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: auto;
    }

    .toolbar-btn span {
        font-size: 14px;
    }

    /* 사이드바 축소 */
    #modeler-sidebar {
        width: 150px;
        min-width: 120px;
    }

    #modeler-properties {
        width: 180px;
        min-width: 150px;
    }

    .sidebar-header h3,
    .properties-header h3 {
        font-size: 14px;
    }

    /* 객체 목록 */
    .object-item {
        padding: 8px;
    }

    .object-name {
        font-size: 12px;
    }

    .object-type {
        font-size: 10px;
    }

    /* 다이얼로그 */
    .dialog-content {
        min-width: 90%;
        max-width: 95%;
    }

    .dialog-body {
        padding: 15px;
    }

    /* 버튼 크기 조정 */
    .btn-primary, .btn-secondary {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* 모바일 (480px 이하) */
@media (max-width: 480px) {
    /* 툴바 - 아이콘만 표시 */
    #modeler-toolbar {
        padding: 5px;
        gap: 5px;
    }

    .toolbar-section {
        padding: 0 3px;
        gap: 2px;
    }

    .toolbar-title {
        display: none; /* 모바일에서는 타이틀 숨김 */
    }

    .toolbar-btn {
        padding: 8px;
        font-size: 0; /* 텍스트 숨김 */
        min-width: 40px;
        min-height: 40px;
        justify-content: center;
    }

    .toolbar-btn span {
        font-size: 18px; /* 아이콘만 크게 */
    }

    /* 스냅 표시 */
    #snap-size-display {
        display: none;
    }

    /* 사이드바 숨김 또는 최소화 */
    #modeler-sidebar {
        width: 60px;
        min-width: 60px;
    }

    #modeler-sidebar .sidebar-header h3 {
        font-size: 12px;
        writing-mode: vertical-rl;
        text-align: center;
    }

    .object-list {
        display: none; /* 모바일에서는 객체 목록 숨김 */
    }

    /* 속성 패널 숨김 */
    #modeler-properties {
        display: none;
    }

    /* 뷰포트 정보 */
    #viewport-info {
        padding: 8px;
        font-size: 11px;
    }

    .info-item {
        font-size: 11px;
    }

    /* 다이얼로그 */
    .dialog-content {
        min-width: 95%;
        margin: 10px;
    }

    .dialog-header {
        padding: 12px;
    }

    .dialog-header h3 {
        font-size: 16px;
    }

    .dialog-body {
        padding: 12px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-control {
        padding: 10px;
        font-size: 14px;
        min-height: 44px; /* 터치 친화적 */
    }

    /* 버튼 - 터치 친화적 크기 */
    .btn-primary, .btn-secondary {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 44px;
    }

    /* 체크박스 크기 증가 */
    .checkbox-wrapper input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* 상태바 */
    #modeler-statusbar {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* 초소형 모바일 (360px 이하) */
@media (max-width: 360px) {
    .toolbar-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 6px;
    }

    .toolbar-btn span {
        font-size: 16px;
    }

    #modeler-sidebar {
        width: 50px;
        min-width: 50px;
    }

    .sidebar-header {
        padding: 5px;
    }

    #viewport-info {
        font-size: 10px;
        padding: 5px;
    }
}

/* 가로 모드 (landscape) - 모바일/태블릿 */
@media (max-width: 768px) and (orientation: landscape) {
    /* 툴바 더 작게 */
    #modeler-toolbar {
        padding: 4px 8px;
    }

    .toolbar-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    /* 사이드바 숨김 (가로 모드에서는 공간 확보) */
    #modeler-sidebar,
    #modeler-properties {
        display: none;
    }

    /* 뷰포트 정보 작게 */
    #viewport-info {
        top: 5px;
        left: 5px;
        padding: 5px 8px;
        font-size: 10px;
        opacity: 0.8;
    }
}

/* 터치 디바이스 전용 스타일 */
@media (hover: none) and (pointer: coarse) {
    /* 모든 클릭 가능한 요소 터치 친화적으로 */
    .toolbar-btn,
    .object-item,
    .btn-primary,
    .btn-secondary,
    .dialog-close {
        min-height: 44px;
        min-width: 44px;
    }

    /* 스크롤바 숨김 (터치 디바이스) */
    #modeler-toolbar::-webkit-scrollbar {
        display: none;
    }

    #modeler-toolbar {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}
