* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; } 
body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; } 

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  background: white; /* 메인 배경 */
}

/* Left Sidebar */
.sidebar {
  width: 80px;
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  box-shadow: 2px 0 15px rgba(0,0,0,0.1);
  z-index: 100;
}

.sidebar-btn {
  width: 60px;
  height: 60px;
  margin: 10px 0;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: #ecf0f1;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.7em;
  padding: 5px;
  position: relative;
}

.sidebar-btn:hover {
  background: rgba(52, 152, 219, 0.2);
  transform: scale(1.05);
}

.sidebar-btn.active {
  background: #3498db;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.sidebar-btn-icon {
  font-size: 1.8em;
  margin-bottom: 4px;
}

.sidebar-spacer { flex: 1; }

/* Right Panel */
.right-panel {
  width: 380px;
  background: white;
  box-shadow: -2px 0 15px rgba(0,0,0,0.1);
  overflow-y: auto;
  display: none;
  z-index: 50;
}

.right-panel.active { display: block; }

.panel-header {
  padding: 25px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  font-size: 1.3em;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.panel-content {
  padding: 25px;
}

/* Main Canvas Area */
.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white; /* 통일된 배경 */
}

.top-toolbar {
  height: 70px;
  background: white;
  box-shadow: 0 2px 15px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  padding: 0 30px;
  justify-content: space-between;
  z-index: 10;
}

.project-title {
  font-size: 1.4em;
  font-weight: 700;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle {
  display: flex;
  gap: 5px;
  background: #ecf0f1;
  border-radius: 10px;
  padding: 5px;
}

.view-toggle-btn {
  padding: 10px 25px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  font-size: 0.95em;
}

.view-toggle-btn.active {
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  color: #3498db;
}

/* Canvas Container */
.canvas-container {
  flex: 1;
  position: relative;
  margin: 0; /* 여백 제거 */
  background: white;
  border-radius: 0; /* 둥근 모서리 제거 */
  box-shadow: none; /* 그림자 제거 */
  overflow: hidden;
}

#main-canvas {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Search Section */
.search-section {
  margin-bottom: 30px;
}

.search-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-tab {
  flex: 1;
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s;
  font-weight: 600;
  font-size: 0.95em;
}

.search-tab:hover {
  border-color: #3498db;
  background: #f0f8ff;
  transform: translateY(-2px);
}

.search-tab.active {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border-color: #3498db;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.search-tab-icon {
  font-size: 2em;
  display: block;
  margin-bottom: 8px;
}

.address-search-box {
  position: relative;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 15px 50px 15px 20px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 1em;
  transition: all 0.3s;
  font-weight: 500;
}

.search-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.search-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3em;
  color: #999;
}

/* Complex List */
.complex-list {
  max-height: 400px;
  overflow-y: auto;
  display: none;
}

.complex-list.active { display: block; }

.complex-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.complex-card:hover {
  border-color: #3498db;
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.2);
}

.complex-name {
  font-weight: 700;
  font-size: 1.1em;
  color: #2c3e50;
  margin-bottom: 8px;
}

.complex-info {
  display: flex;
  gap: 12px;
  font-size: 0.85em;
  color: #666;
  flex-wrap: wrap;
}

.complex-tag {
  background: #f0f8ff;
  padding: 4px 10px;
  border-radius: 6px;
  color: #3498db;
  font-weight: 600;
}

/* Type Selection */
.type-selection {
  display: none;
  animation: slideIn 0.3s ease;
}

.type-selection.active { display: block; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.selected-complex-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  border-radius: 12px;
  color: white;
  margin-bottom: 25px;
}

.selected-complex-name {
  font-size: 1.2em;
  font-weight: 700;
  margin-bottom: 8px;
}

.selected-complex-address {
  font-size: 0.9em;
  opacity: 0.9;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.type-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.type-card:hover {
  border-color: #3498db;
  transform: scale(1.03);
  box-shadow: 0 5px 20px rgba(52, 152, 219, 0.2);
}

.type-size {
  font-size: 2em;
  font-weight: 700;
  color: #3498db;
  margin-bottom: 5px;
}

.type-area {
  font-size: 0.85em;
  color: #666;
}

/* Variant Selection */
.variant-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.variant-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
}

.variant-card:hover {
  border-color: #3498db;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.2);
}

.variant-preview {
  width: 100%;
  height: 120px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3em;
}

.variant-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.variant-info {
  padding: 12px;
  text-align: center;
}

.variant-name {
  font-weight: 700;
  color: #2c3e50;
  font-size: 0.95em;
}

/* Upload Section */
.upload-area {
  border: 3px dashed #ddd;
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fafafa;
}

.upload-area:hover {
  border-color: #3498db;
  background: #f0f8ff;
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4em;
  margin-bottom: 15px;
}

.upload-text {
  color: #666;
  font-size: 0.95em;
  line-height: 1.6;
}

.upload-btn {
  display: inline-block;
  margin-top: 15px;
  padding: 12px 30px;
  background: #3498db;
  color: white;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.upload-btn:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

input[type="file"] { display: none; }

/* Action Buttons */
.action-btn {
  width: 100%;
  padding: 15px;
  margin-bottom: 12px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1em;
}

.action-btn.primary {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.action-btn.secondary {
  background: white;
  color: #3498db;
  border: 2px solid #3498db;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Instructions */
.instructions {
  background: linear-gradient(135deg, #f0f8ff 0%, #e8f4ff 100%);
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 25px;
  font-size: 0.9em;
  line-height: 1.8;
  color: #555;
  border-left: 4px solid #3498db;
}

.instructions-title {
  font-weight: 700;
  margin-bottom: 10px;
  color: #2c3e50;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Empty State */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #999;
}

.empty-state-icon {
  font-size: 6em;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1.3em;
  font-weight: 500;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 18px 30px;
  border-radius: 12px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 10000;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  box-shadow: 0 6px 25px rgba(52, 152, 219, 0.4);
  font-size: 0.95em;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Back Button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 20px;
  transition: all 0.3s;
  color: #666;
}

.back-btn:hover {
  border-color: #3498db;
  color: #3498db;
  transform: translateX(-3px);
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2980b9;
}

/* 3D 뷰어 컨트롤 */
.viewer-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.control-group {
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.control-btn {
  width: 50px;
  height: 50px;
  border: none;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  overflow: hidden;
}

.control-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  opacity: 0;
  transition: opacity 0.2s;
}

.control-btn:hover::before {
  opacity: 0.1;
}

.control-btn:active {
  transform: scale(0.95);
}

.control-btn.active {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
}

.control-btn.active .control-icon {
  filter: brightness(2);
}

.control-icon {
  font-size: 1.3em;
  position: relative;
  z-index: 1;
}

.control-label {
  font-size: 0.65em;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* 반응형 */
@media (max-width: 768px) {
  .viewer-controls {
    bottom: 10px;
    right: 10px;
  }
  
  .control-btn {
    width: 45px;
    height: 45px;
  }
  
  .control-label {
    display: none;
  }
}

/* 2D 툴바 */
.toolbar-2d {
  height: 60px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  display: none; /* 기본 숨김 */
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.toolbar-2d.active {
  display: flex;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  background: white;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.toolbar-btn {
  min-width: 70px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
}

.toolbar-btn:hover {
  background: #f0f8ff;
  transform: translateY(-1px);
}

.toolbar-btn.active {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.toolbar-icon {
  font-size: 1.3em;
}

.toolbar-label {
  font-size: 0.7em;
  font-weight: 600;
}

.toolbar-btn.active .toolbar-label {
  color: white;
}
