/* 패널 전용 스타일 */

/* CSS 변수 정의 */
:root {
    --panel-padding-desktop: 16px;
    --panel-padding-tablet: 12px;
    --panel-padding-mobile: 10px;
    --form-input-height: 36px;
    --form-input-height-mobile: 40px;
    --button-height: 36px;
    --button-height-mobile: 44px;
    --font-size-base: 14px;
    --font-size-mobile: 16px;
}

/* 기본 패널 스타일 */
.panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.panel-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    min-height: 48px;
}

.panel-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.panel-header .panel-icon {
    font-size: 18px;
    color: #007bff;
    flex-shrink: 0;
}

.panel-controls {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.panel-controls button {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
}

.panel-controls button:hover {
    background: rgba(0,123,255,0.1);
    color: #007bff;
    transform: scale(1.1);
}

.panel-controls .btn-minimize {
    font-size: 16px;
    font-weight: bold;
}

.panel-controls .btn-settings {
    font-size: 14px;
}

.panel-controls .btn-refresh {
    font-size: 14px;
}

.panel-content {
    padding: var(--panel-padding-desktop);
    transition: all 0.3s ease;
}

.panel-content.collapsed {
    display: none;
}

/* 폼 요소 스타일 */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: var(--font-size-base);
    line-height: 1.4;
}

.form-label.required::after {
    content: ' *';
    color: #dc3545;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: var(--font-size-base);
    transition: all 0.2s;
    background: white;
    min-height: var(--form-input-height);
    box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* 범위 입력 */
.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.range-input {
    flex: 1;
    min-width: 100px;
}

.range-separator {
    color: #666;
    font-weight: 500;
    padding: 0 4px;
    flex-shrink: 0;
}

/* 버튼 스타일 */
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-info {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--button-height);
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #1e7e34;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 검색 결과 스타일 */
.search-results {
    margin-top: 16px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.results-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    min-width: 0;
}

.result-count {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.results-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    background: white;
}

.results-container::-webkit-scrollbar {
    width: 6px;
}

.results-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.results-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.result-item {
    padding: 12px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background: #f8f9fa;
    transform: translateX(2px);
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.result-item.selected {
    background: #e3f2fd;
    border-left: 3px solid #007bff;
}

.result-item.active {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.result-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    flex: 1;
    min-width: 0;
}

.result-type {
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

.result-details p {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.result-details .address {
    color: #007bff;
    font-weight: 500;
}

.result-details .area,
.result-details .price {
    font-weight: 600;
    color: #333;
}

.no-results,
.loading,
.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-results {
    font-size: 16px;
    color: #999;
}

.loading {
    position: relative;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* 리스트 필터 */
.list-filters {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 120px;
}

.filter-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.filter-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    min-height: 32px;
}

/* 리스트 헤더 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.list-info {
    flex: 1;
    min-width: 0;
}

.list-count {
    font-size: 18px;
    font-weight: 600;
    color: #007bff;
    margin-bottom: 4px;
}

.list-status {
    font-size: 13px;
    color: #666;
}

.list-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-select-all,
.btn-clear-selection {
    background: #f8f9fa;
    border: 1px solid #ddd;
    color: #333;
    padding: 6px 12px;
    font-size: 13px;
    min-height: 32px;
}

.btn-select-all:hover,
.btn-clear-selection:hover {
    background: #e9ecef;
    border-color: #007bff;
    color: #007bff;
}

/* 선택된 항목 정보 */
.selected-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.selected-info.hidden {
    display: none;
}

.selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1976d2;
    flex: 1;
    min-width: 0;
}

.selected-count {
    background: #1976d2;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.selected-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* 체크박스 스타일 */
.item-checkbox {
    position: relative;
    flex-shrink: 0;
}

.item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007bff;
}

/* 항목 액션 버튼 */
.item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
    margin-left: auto;
}

.result-item:hover .item-actions {
    opacity: 1;
}

.btn-map,
.btn-edit,
.btn-delete {
    padding: 4px 6px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-map {
    background: #17a2b8;
    color: white;
}

.btn-map:hover {
    background: #138496;
    transform: scale(1.1);
}

.btn-edit:hover {
    background: #ffc107;
    color: #212529;
    transform: scale(1.1);
}

.btn-delete:hover {
    background: #dc3545;
    color: white;
    transform: scale(1.1);
}

/* ===== 반응형 미디어 쿼리 ===== */

/* 태블릿 (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    :root {
        --panel-padding-desktop: var(--panel-padding-tablet);
        --form-input-height: 38px;
        --button-height: 38px;
    }
    
    .panel-header {
        padding: 10px 12px;
        min-height: 44px;
    }
    
    .panel-header h3 {
        font-size: 15px;
    }
    
    .form-actions {
        gap: 6px;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-warning,
    .btn-danger,
    .btn-info {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .list-filters {
        padding: 10px;
        gap: 10px;
    }
    
    .filter-group {
        min-width: 100px;
    }
    
    .list-header {
        gap: 10px;
    }
    
    .selected-actions {
        gap: 4px;
    }
    
    .range-inputs {
        gap: 6px;
    }
    
    .range-input {
        min-width: 80px;
    }
    
    .results-container {
        max-height: 350px;
    }
    
    .result-item {
        padding: 10px;
        gap: 10px;
    }
}

/* 모바일 (767px 이하) */
@media (max-width: 767px) {
    :root {
        --panel-padding-desktop: var(--panel-padding-mobile);
        --form-input-height: var(--form-input-height-mobile);
        --button-height: var(--button-height-mobile);
        --font-size-base: var(--font-size-mobile);
    }
    
    .panel-header {
        padding: 12px 10px;
        min-height: 48px;
        flex-wrap: wrap;
    }
    
    .panel-header h3 {
        font-size: 14px;
        flex: 1 1 100%;
        margin-bottom: 4px;
    }
    
    .panel-controls {
        gap: 2px;
        flex: 1 1 100%;
        justify-content: flex-end;
    }
    
    .panel-controls button {
        min-width: 36px;
        min-height: 36px;
        padding: 8px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-label {
        margin-bottom: 4px;
        font-size: 14px;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 12px;
        font-size: 16px; /* iOS 줌 방지 */
        border-radius: 6px;
    }
    
    .form-textarea {
        min-height: 100px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-warning,
    .btn-danger,
    .btn-info {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px;
        justify-content: center;
    }
    
    .list-filters {
        padding: 8px;
        gap: 8px;
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
    
    .filter-select {
        padding: 8px 10px;
        font-size: 16px;
        min-height: 40px;
    }
    
    .list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .list-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .btn-select-all,
    .btn-clear-selection {
        flex: 1;
        padding: 8px 12px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .selected-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .selected-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .selected-actions .btn-primary,
    .selected-actions .btn-secondary,
    .selected-actions .btn-danger {
        flex: 1;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .range-inputs {
        flex-direction: column;
        gap: 8px;
    }
    
    .range-input {
        width: 100%;
        min-width: auto;
    }
    
    .range-separator {
        align-self: center;
        padding: 4px 0;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .results-container {
        max-height: 300px;
    }
    
    .result-item {
        padding: 12px 8px;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-header {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    
    .result-header h4 {
        font-size: 15px;
    }
    
    .result-type {
        align-self: flex-start;
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .result-details p {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .item-actions {
        opacity: 1;
        margin-left: 0;
        margin-top: 8px;
        justify-content: flex-end;
    }
    
    .btn-map,
    .btn-edit,
    .btn-delete {
        min-width: 32px;
        min-height: 32px;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .item-checkbox input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
}

/* 초소형 모바일 (480px 이하) */
@media (max-width: 480px) {
    .panel-header {
        padding: 10px 8px;
    }
    
    .panel-content {
        padding: 8px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-actions {
        gap: 6px;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-warning,
    .btn-danger,
    .btn-info {
        padding: 10px 12px;
        font-size: 15px;
    }
    
    .list-filters {
        padding: 6px;
    }
    
    .results-container {
        max-height: 250px;
    }
    
    .result-item {
        padding: 10px 6px;
    }
    
    .result-details p {
        font-size: 13px;
    }
}

/* 가로 모드 최적화 (모바일) */
@media (max-width: 767px) and (orientation: landscape) {
    .results-container {
        max-height: 200px;
    }
    
    .form-textarea {
        min-height: 80px;
    }
    
    .panel-header {
        min-height: 40px;
        padding: 8px 10px;
    }
    
    .panel-header h3 {
        font-size: 13px;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-warning,
    .btn-danger,
    .btn-info {
        min-height: 36px;
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .panel-controls button {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn-map,
    .btn-edit,
    .btn-delete {
        min-width: 36px;
        min-height: 36px;
    }
    
    .item-checkbox input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
    
    .result-item {
        padding: 16px 12px;
    }
    
    .result-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .item-actions {
        opacity: 1;
    }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .panel {
        border: 2px solid #000;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        border: 2px solid #000;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-warning,
    .btn-danger,
    .btn-info {
        border: 2px solid #000;
    }
} 