/* ========== 로봇 선택 모달 스타일 ========== */
#robotSelectorModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

#robotSelectorModal.show {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.modal-title {
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
    line-height: 1;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    background: #ffffff;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.robot-selector-content {
    color: #333;
}

.selector-description {
    text-align: center;
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
}

.skip-section {
    text-align: center;
    margin-bottom: 16px;
}

.skip-btn {
    background: #f5f5f5;
    color: #555;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skip-btn:hover {
    background: #eee;
    border-color: #ccc;
}

/* ========== 1단: 컨트롤러 필터 탭 ========== */
.filter-tabs {
    display: flex;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 12px;
    gap: 4px;
}

.filter-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: #666;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-tab:hover {
    background: #e8e8e8;
}

.filter-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

/* ========== 2단: 그룹 탭 (A, B, C - 가로) ========== */
.group-tabs {
    display: flex;
    justify-content: center;  /* 가운데 정렬 추가 */
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px 0;
    overflow-x: auto;
}

.group-tabs::-webkit-scrollbar {
    height: 4px;
}

.group-tabs::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.group-tab {
    flex-shrink: 0;
    background: #f8f8f8;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    padding: 10px 20px;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 70px;
}

.group-tab:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

.group-tab.active {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.3);
}

.group-tab.hidden {
    display: none;
}

.group-tab-name {
    font-size: 15px;
    font-weight: 700;
}

.group-tab-count {
    font-size: 10px;
    opacity: 0.8;
    margin-top: 2px;
}

/* ========== 3단: 로봇 카드 영역 (가로 스크롤) ========== */
.robot-panel {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 16px;
    min-height: 280px;
}

.robot-scroll-area {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
}

.robot-scroll-area::-webkit-scrollbar {
    height: 6px;
}

.robot-scroll-area::-webkit-scrollbar-track {
    background: #eee;
    border-radius: 3px;
}

.robot-scroll-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.robot-horizontal-list {
    display: flex;
    gap: 14px;
    padding: 4px;
}

/* ========== 로봇 카드 ========== */
.robot-card {
    flex-shrink: 0;
    width: 155px;
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 14px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.robot-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: #ddd;
}

.robot-card.selected {
    border-color: #38a169;
    background: #f0fff4;
    box-shadow: 0 8px 24px rgba(72, 187, 120, 0.2);
}

.robot-card.filtered-out {
    display: none !important;
}

.selection-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: #38a169;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(56, 161, 105, 0.4);
    border: 2px solid white;
}

.robot-card.selected .selection-indicator {
    opacity: 1;
    transform: scale(1);
}

.robot-card .robot-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 12px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.robot-card .robot-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    box-sizing: border-box;
}

.robot-info-section {
    width: 100%;
    margin-bottom: 12px;
}

.robot-name {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin: 0 0 4px 0;
}

.robot-subtitle {
    font-size: 11px;
    color: #888;
    margin: 0 0 8px 0;
}

.controller-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.robot-card .specs {
    width: 100%;
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: auto;
}

.robot-card .spec-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.robot-card .spec-label {
    font-size: 10px;
    color: #999;
}

.robot-card .spec-value {
    font-size: 10px;
    color: #555;
    font-weight: 600;
}

/* 로봇이 없을 때 */
.empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

.empty-message-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* 푸터 */
.modal-footer {
    padding: 16px 24px;
    background: #f8f8f8;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.continue-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.4;
    pointer-events: none;
}

.continue-btn.active {
    opacity: 1;
    pointer-events: all;
}

.continue-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* 반응형 */
@media (max-width: 500px) {
    .modal-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .group-tab {
        padding: 8px 16px;
        min-width: 60px;
    }
    
    .robot-panel {
        padding: 12px;
        min-height: 240px;
    }
    
    .robot-card {
        width: 140px;
        padding: 12px 10px;
    }
    
    .robot-card .robot-icon {
        width: 64px;
        height: 64px;
    }
}
