/* 당근마켓 검색기 스타일 */

/* 이미지 모달 스타일 */
.daangn-image-modal {
    display: none;
    position: fixed !important;
    z-index: 99999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0,0,0,0.95) !important;
    align-items: center !important;
    justify-content: center !important;
}

.daangn-modal-content {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 90vw !important;
    max-height: 90vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    animation: zoom 0.3s !important;
    box-shadow: 0 0 50px rgba(0,0,0,0.8) !important;
    border-radius: 8px !important;
    margin: 0 !important;
}

@keyframes zoom {
    from {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.daangn-modal-close {
    position: fixed !important;
    top: 30px !important;
    right: 50px !important;
    color: #ffffff !important;
    font-size: 60px !important;
    font-weight: bold !important;
    transition: 0.3s !important;
    cursor: pointer !important;
    text-shadow: 0 0 20px rgba(0,0,0,1) !important;
    z-index: 100000 !important;
    background: rgba(0,0,0,0.5) !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

.daangn-modal-close:hover,
.daangn-modal-close:focus {
    color: #ff6f31;
    text-decoration: none;
    transform: scale(1.2);
}

.daangn-modal-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    text-align: center;
    color: #ffffff;
    padding: 15px;
    background-color: rgba(0,0,0,0.7);
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
}

/* 썸네일 이미지 커서 스타일 */
.daangn-result-image img {
    cursor: pointer;
    transition: transform 0.2s;
}

.daangn-result-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 모달 래퍼 스타일 */
.daangn-modal-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 모바일 대응 */
@media screen and (max-width: 768px) {
    .daangn-modal-content {
        max-width: 100vw;
        max-height: 80vh;
    }

    .daangn-modal-close {
        top: 10px;
        right: 20px;
        font-size: 40px;
        background-color: rgba(0,0,0,0.5);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .daangn-modal-caption {
        font-size: 14px;
        padding: 10px;
        bottom: 10px;
    }
}

/* 태블릿 대응 */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .daangn-modal-content {
        max-width: 90vw;
        max-height: 90vh;
    }
}

/* 당근마켓 검색기 스타일 */
#daangn-search-widget {
    background: linear-gradient(135deg, #ff8a4c 0%, #ff6f31 100%);
    padding: 20px 0;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.daangn-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.daangn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.daangn-header h2 {
    color: white;
    font-size: 24px;
    margin: 0;
}

.daangn-toggle {
    background: white;
    color: #ff6f31;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.3s;
}

.daangn-toggle:hover {
    transform: scale(1.05);
}

#daangn-search-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.daangn-step {
    margin-bottom: 25px;
}

.daangn-step h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff6f31;
}

.daangn-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.daangn-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.daangn-input-group input:focus {
    outline: none;
    border-color: #ff6f31;
}

.daangn-input-group button {
    background: #ff6f31;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

.daangn-input-group button:hover {
    background: #ff8a4c;
}

.daangn-input-group button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 전국 검색 버튼 */
.nationwide-btn {
    background: #2196f3 !important;
    margin-left: 10px;
}

.nationwide-btn:hover {
    background: #1976d2 !important;
}

/* 지역 선택 목록 */
#daangn-location-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    position: relative;
}

/* 지역 목록 헤더 */
.location-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

/* 지역 목록 닫기 버튼 */
.close-location-results {
    background: #666;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.close-location-results:hover {
    background: #555;
    transform: scale(1.05);
}

.location-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 4px;
}

.location-item:hover {
    background: #fff3e0;
}

.location-item.selected {
    background: #ff6f31;
    color: white;
}

/* 검색 결과 */
#daangn-search-results {
    margin-top: 20px;
}

.daangn-result-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.3s;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.daangn-result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 매물 컨테이너 레이아웃 */
.daangn-item-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

/* 이미지 영역 스타일 - PC에서 크기 증가 */
.daangn-result-image {
    flex: 0 0 180px;
    width: 180px;
    height: 180px;
    min-width: 180px;
    min-height: 180px;
    max-width: 180px;
    max-height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #f5f5f5;
    border-radius: 8px;
    margin: 0;
    padding: 0;
}

.daangn-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.daangn-result-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 콘텐츠 영역 */
.daangn-result-content-wrapper {
    flex: 1;
    min-width: 0;
    padding-left: 0;
}

/* 모바일 스타일 - 세로 레이아웃 */
@media screen and (max-width: 600px) {
    .daangn-item-container {
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .daangn-result-image {
        width: 100%;
        height: 250px;
        max-width: 400px;
        margin: 0 auto 15px auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .daangn-result-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .daangn-result-content-wrapper {
        width: 100%;
    }

    /* 위치정보, 판매상태, 닉네임, 날짜는 가운데 정렬 */
    .daangn-result-location {
        text-align: center !important;
        margin-bottom: 10px;
        justify-content: center !important;
        display: flex !important;
    }

    .daangn-result-info {
        text-align: center !important;
    }

    .daangn-result-item {
        padding: 20px 15px;
    }
}

/* 태블릿 스타일 */
@media screen and (min-width: 601px) and (max-width: 1024px) {
    .daangn-result-image {
        width: 150px;
        height: 150px;
    }

    .daangn-result-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

.daangn-result-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.daangn-result-price {
    color: #ff6f31;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}

.daangn-result-location {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.daangn-result-info {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.daangn-result-info span {
    display: inline-block;
    margin-right: 15px;
}

.daangn-result-content {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.daangn-result-link {
    display: inline-block;
    margin-top: 10px;
    color: #ff6f31;
    text-decoration: none;
    font-weight: bold;
}

/* 선택된 지역 표시 영역 */
.selected-location {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 15px;
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selected-location strong {
    color: #333;
    font-size: 14px;
}

/* 지역 삭제 버튼 */
.remove-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: normal;
    transition: all 0.3s;
    margin-left: 10px;
}

.remove-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

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

.daangn-result-link:hover {
    text-decoration: underline;
}

/* 로딩 상태 */
.daangn-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.daangn-loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* 에러 메시지 */
.daangn-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* 다운로드 버튼 공통 스타일 */
.excel-btn, .html-btn {
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* 엑셀 다운로드 버튼 */
.excel-btn {
    background: #4caf50 !important;
    margin-right: 10px;
}

.excel-btn:hover {
    background: #45a049 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* HTML 다운로드 버튼 */
.html-btn {
    background: #2196F3 !important;
}

.html-btn:hover {
    background: #1976D2 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 페이징 섹션 */
#daangn-pagination-section {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 2px solid #f0f0f0;
}

.daangn-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#daangn-pagination-info {
    color: #666;
    font-size: 14px;
}

/* 필터 버튼 스타일 */
.daangn-filter-section {
    margin: 15px 0;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: #f5f5f5;
    border-color: #ff6f31;
    color: #ff6f31;
}

.filter-btn.active {
    background: #ff6f31;
    color: white;
    border-color: #ff6f31;
}

.filter-btn.active:hover {
    background: #ff8a4c;
    border-color: #ff8a4c;
}

@media (max-width: 768px) {
    .daangn-filter-section {
        flex-wrap: wrap;
        justify-content: center;
        flex-direction: column;
        gap: 10px !important;
    }

    .filter-btn {
        font-size: 12px;
        padding: 6px 12px;
        margin: 3px;
    }

    .export-buttons {
        width: 100%;
        flex-direction: column;
        gap: 10px !important;
    }

    .daangn-filter-section .excel-btn,
    .daangn-filter-section .html-btn {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* 페이징 버튼 */
#daangn-pagination {
    text-align: center;
}

.page-btn {
    background: white;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 12px;
    margin: 0 2px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}

.page-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.page-btn.active {
    background: #ff6f31;
    color: white;
    border-color: #ff6f31;
}

.page-btn.active:hover {
    background: #ff8a4c;
}

.page-dots {
    padding: 8px 4px;
    color: #999;
    font-size: 14px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .daangn-header {
        flex-direction: column;
        text-align: center;
    }

    .daangn-header h2 {
        margin-bottom: 10px;
    }

    .daangn-input-group {
        flex-direction: column;
    }

    .daangn-input-group button {
        width: 100%;
    }

    .nationwide-btn {
        margin-left: 0 !important;
        margin-top: 10px;
    }

    .daangn-controls {
        flex-direction: column;
        text-align: center;
    }

    .excel-btn, .html-btn {
        margin-right: 0 !important;
        margin-bottom: 10px !important;
        width: 100% !important;
        padding: 10px 20px !important;
        font-size: 14px !important;
        display: block !important;
        text-align: center !important;
    }

    .page-btn {
        padding: 6px 10px;
        margin: 0 1px;
        font-size: 12px;
    }
}
/* 상하단 잘림 방지 - 레이아웃 수정 */
#daangn-search-widget {
    margin: 20px auto !important;
    padding: 25px !important;
    max-width: 1200px !important;
    width: 95% !important;
    overflow: visible !important;
    min-height: auto !important;
    height: auto !important;
}

#daangn-search-results {
    max-height: none !important;
    overflow: visible !important;
    padding: 20px !important;
    margin-bottom: 20px !important;
    height: auto !important;
}

.search-container {
    min-height: auto !important;
    overflow: visible !important;
    height: auto !important;
}

body, html {
    overflow: auto !important;
}

.wp-block-group,
.uagb-block-wrapper {
    overflow: visible !important;
    min-height: auto !important;
}

/* 위치 정보 스타일 */
.daangn-result-location {
    color: #666;
    font-size: 14px;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.daangn-result-info span {
    margin-right: 10px;
}

/* 하단 페이지네이션 영역의 엑셀 다운로드 버튼 숨기기 */
#daangn-pagination-section .daangn-controls {
    display: none !important;
}

/* 필터 버튼 스타일 */
.daangn-filter-section .filter-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 6px 12px;
    margin: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.daangn-filter-section .filter-btn:hover {
    background: #f8f8f8;
    border-color: #ff6f00;
}

.daangn-filter-section .filter-btn.active {
    background: #ff6f00;
    color: #fff;
    border-color: #ff6f00;
}

/* 페이지네이션 정보만 표시 */
#daangn-pagination-info {
    display: block !important;
    text-align: center;
    margin: 10px 0;
}

@media (max-width: 768px) {
    #daangn-search-widget {
        margin: 15px 5px !important;
        padding: 20px 15px !important;
        width: calc(100% - 10px) !important;
    }
}
