* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

header {
    color: white;
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header-text {
    flex: 1;
    text-align: center;
}

.header-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 내 위치 찾기 버튼 */
.find-nearest-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.find-nearest-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    background: linear-gradient(135deg, #FF8E53 0%, #FF6B6B 100%);
}

.find-nearest-btn:active {
    transform: translateY(0);
}

.find-nearest-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 언어 선택기 */
.language-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.language-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.lang-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
}

.lang-btn .flag {
    font-size: 1.8rem;
    line-height: 1;
}

.lang-btn .lang-name {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.9;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.95);
    border-color: white;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
}

.lang-btn.active .lang-name {
    color: #667eea;
    opacity: 1;
}

.lang-btn.active:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.5);
}

/* 헤더 광고 */
.header-ad {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}


.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 지도 영역 */
.map-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.map-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f0fe 100%);
    border-radius: 20px;
    padding: 30px;
    overflow: auto;
    border: 3px solid #e3f2fd;
}

#seoul-map {
    width: 100%;
    height: auto;
    max-width: 950px;
    margin: 0 auto;
    display: block;
}

/* 서울시 외곽선 스타일 */
.seoul-boundary {
    transition: all 0.5s ease;
}

.seoul-boundary:hover {
    stroke-dasharray: 24,8;
    stroke-width: 7;
    filter: url(#seoul-shadow) brightness(1.05);
}

/* 서울 레이블 */
.seoul-label {
    font-family: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
    letter-spacing: 3px;
}

.seoul-label-group rect {
    transition: all 0.3s ease;
}

.seoul-label-group:hover rect {
    fill: rgba(74, 144, 226, 0.25);
}

/* 한강 레이블 */
.hangang-label {
    font-family: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
    letter-spacing: 6px;
}

.hangang-label-group rect {
    transition: all 0.3s ease;
}

.hangang-label-group:hover rect {
    fill: rgba(46, 139, 192, 0.35);
}

/* 한강 스타일 강화 */
.han-river {
    animation: river-flow 3s ease-in-out infinite;
    stroke-dasharray: 40, 15;
}

@keyframes river-flow {
    0%, 100% {
        stroke-dashoffset: 0;
        opacity: 0.7;
    }
    50% {
        stroke-dashoffset: 55;
        opacity: 0.85;
    }
}

#seoul-outline {
    pointer-events: none;
}

#seoul-outline path.seoul-boundary {
    pointer-events: visiblePainted;
}

.district {
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.district rect {
    fill: url(#gradient-normal);
    stroke: #4A90E2;
    stroke-width: 2.5;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 기본 상태에서 약간의 그라데이션 효과 */
.district rect {
    fill: linear-gradient(145deg, #e8f4f8 0%, #d5e9f7 100%);
    fill: #e8f4f8;
}

.district text {
    fill: #1E40AF;
    font-size: 24px;
    font-weight: 800;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
    transition: all 0.3s ease;
}

.district text tspan {
    font-size: 18px;
    font-weight: 700;
}

.district:hover rect {
    fill: #C7E2FF;
    stroke: #2563EB;
    stroke-width: 4;
    filter: drop-shadow(0 10px 20px rgba(37, 99, 235, 0.4));
    transform: scale(1.05);
}

.district:hover text {
    fill: #1E3A8A;
    font-size: 26px;
    font-weight: 900;
}

.district:hover text tspan {
    font-size: 19px;
    font-weight: 800;
}

.district.active rect {
    fill: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    fill: #667eea;
    stroke: #5a67d8;
    stroke-width: 5;
    filter: drop-shadow(0 12px 24px rgba(102, 126, 234, 0.6));
    animation: pulse 2s ease-in-out infinite;
}

.district.active text {
    fill: white;
    font-weight: 900;
    font-size: 26px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.district.active text tspan {
    fill: white;
    font-size: 19px;
    font-weight: 800;
}

@keyframes pulse {
    0%, 100% {
        filter: drop-shadow(0 10px 20px rgba(102, 126, 234, 0.6));
    }
    50% {
        filter: drop-shadow(0 12px 25px rgba(102, 126, 234, 0.8));
    }
}

.selected-district {
    margin-top: 20px;
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 화장실 목록 영역 */
.toilet-list-section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    max-height: 850px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.list-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.total-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
}

#total-count {
    font-size: 1.3rem;
    font-weight: bold;
    padding: 0 5px;
}

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

.toilet-list::-webkit-scrollbar {
    width: 8px;
}

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

.toilet-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.toilet-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
}


/* Footer */
.main-footer {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-top: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.footer-content h3 {
    color: #667eea;
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.footer-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateY(-3px);
}

.info-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.info-text strong {
    display: block;
    color: #333;
    font-size: 1rem;
    margin-bottom: 5px;
}

.info-text p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.footer-notice {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.footer-notice p {
    color: #888;
    font-size: 0.85rem;
    margin: 0;
}

.footer-notice a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.footer-notice a:hover {
    text-decoration: underline;
}

.footer-notice .contact {
    margin-top: 8px;
    font-weight: 500;
}

.toilet-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

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

.toilet-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.toilet-item.nearest {
    border-left: 5px solid #FF6B6B;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
}

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

.toilet-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.toilet-name::before {
    content: '🚻';
    font-size: 1.5rem;
}

.distance-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.rank-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    color: white;
    margin-left: 8px;
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    animation: shine 2s ease-in-out infinite;
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B8860B 100%);
}

@keyframes shine {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
}

.toilet-info {
    display: grid;
    gap: 8px;
}

.info-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.95rem;
    color: #555;
}

.info-label {
    font-weight: 600;
    color: #667eea;
    min-width: 80px;
    flex-shrink: 0;
}

.info-value {
    color: #333;
    line-height: 1.5;
}

.info-value.empty {
    color: #999;
    font-style: italic;
}

/* 지도 링크 스타일 */
.map-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.map-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.map-link.kakao {
    background: linear-gradient(135deg, #FEE500 0%, #F5D900 100%);
    color: #3C1E1E;
}

.map-link.kakao:hover {
    background: linear-gradient(135deg, #F5D900 0%, #E5C900 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(254, 229, 0, 0.4);
}

.map-link.naver {
    background: linear-gradient(135deg, #03C75A 0%, #02B350 100%);
    color: white;
}

.map-link.naver:hover {
    background: linear-gradient(135deg, #02B350 0%, #029A45 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 199, 90, 0.4);
}

.map-link.google {
    background: linear-gradient(135deg, #4285F4 0%, #3367D6 100%);
    color: white;
}

.map-link.google:hover {
    background: linear-gradient(135deg, #3367D6 0%, #2A56C6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

/* 로딩 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #667eea;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* 반응형 - 태블릿 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .map-section {
        order: 1;
    }
    
    .toilet-list-section {
        order: 2;
        max-height: 500px;
    }
}

/* 반응형 - 모바일 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        max-width: 100%;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .header-text {
        text-align: center;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .find-nearest-btn {
        width: 100%;
        justify-content: center;
        font-size: 1rem;
        padding: 14px 20px;
    }

    .language-buttons {
        gap: 8px;
        justify-content: center;
    }
    
    .lang-btn {
        padding: 10px 12px;
        min-width: 70px;
    }
    
    .lang-btn .flag {
        font-size: 1.6rem;
    }
    
    .lang-btn .lang-name {
        font-size: 0.7rem;
    }

    header {
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .main-content {
        gap: 15px;
    }

    .map-section {
        padding: 12px;
        border-radius: 15px;
    }
    
    .map-container {
        padding: 8px;
        border-radius: 12px;
        overflow: visible;
    }

    #seoul-map {
        width: 100%;
        height: auto;
        max-width: 100%;
    }

    .seoul-label {
        font-size: 16px !important;
    }

    .hangang-label {
        font-size: 11px !important;
    }

    .district rect {
        stroke-width: 2.5;
    }

    .district text {
        font-size: 20px;
        font-weight: 800;
    }
    
    .district text tspan {
        font-size: 15px;
        font-weight: 700;
    }
    
    .district.active text {
        font-size: 22px;
        font-weight: 900;
    }
    
    .district.active text tspan {
        font-size: 16px;
    }
    
    .district:hover text {
        font-size: 22px;
        font-weight: 900;
    }
    
    .district:hover text tspan {
        font-size: 16px;
    }

    .selected-district {
        margin-top: 15px;
        padding: 12px;
        font-size: 1rem;
    }

    .toilet-list-section {
        padding: 15px;
        max-height: 450px;
        border-radius: 15px;
    }

    .list-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .list-header h2 {
        font-size: 1.2rem;
    }

    .total-count {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .toilet-item {
        padding: 15px;
        margin-bottom: 12px;
    }

    .toilet-name {
        font-size: 1.05rem;
    }

    .toilet-name::before {
        font-size: 1.3rem;
    }

    .info-row {
        font-size: 0.9rem;
    }

    .info-label {
        min-width: 70px;
    }

    .map-links {
        gap: 8px;
    }

    .map-link {
        padding: 8px 14px;
        font-size: 0.9rem;
    }

    .distance-badge {
        padding: 5px 10px;
        font-size: 0.85rem;
    }

    .rank-badge {
        padding: 3px 8px;
        font-size: 0.75rem;
    }

    .empty-state {
        padding: 40px 15px;
        font-size: 1rem;
    }
}

/* 반응형 - 소형 모바일 */
@media (max-width: 480px) {
    body {
        padding: 6px;
    }

    header {
        margin-bottom: 10px;
    }

    header h1 {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .header-actions {
        gap: 10px;
    }

    .find-nearest-btn {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    .language-buttons {
        gap: 4px;
    }

    .lang-btn {
        padding: 6px 8px;
        min-width: 50px;
        border-width: 2px;
        border-radius: 8px;
    }

    .lang-btn .flag {
        font-size: 1.2rem;
    }

    .lang-btn .lang-name {
        font-size: 0.55rem;
    }

    .main-content {
        gap: 10px;
    }

    .map-section {
        padding: 8px;
        border-radius: 12px;
    }

    .map-container {
        padding: 5px;
        border-radius: 8px;
    }

    #seoul-map {
        width: 100%;
        max-width: 100%;
    }

    .seoul-label {
        font-size: 14px !important;
    }

    .hangang-label {
        font-size: 10px !important;
    }

    .district text {
        font-size: 17px;
        font-weight: 800;
    }
    
    .district text tspan {
        font-size: 13px;
        font-weight: 700;
    }
    
    .district.active text {
        font-size: 19px;
        font-weight: 900;
    }
    
    .district.active text tspan {
        font-size: 14px;
    }
    
    .district:hover text {
        font-size: 19px;
        font-weight: 900;
    }
    
    .district:hover text tspan {
        font-size: 14px;
    }

    .selected-district {
        margin-top: 10px;
        padding: 10px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .toilet-list-section {
        padding: 10px;
        max-height: 350px;
        border-radius: 12px;
    }

    .list-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .list-header h2 {
        font-size: 1.1rem;
    }

    .total-count {
        padding: 5px 10px;
        font-size: 0.8rem;
        border-radius: 15px;
    }

    .toilet-item {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .toilet-name {
        font-size: 0.95rem;
    }

    .toilet-name::before {
        font-size: 1.1rem;
    }

    .info-row {
        font-size: 0.8rem;
        flex-direction: column;
        gap: 2px;
    }

    .info-label {
        min-width: auto;
        font-size: 0.75rem;
    }

    .info-value {
        font-size: 0.8rem;
    }

    .map-links {
        flex-direction: column;
        gap: 6px;
    }

    .map-link {
        width: 100%;
        justify-content: center;
        padding: 10px 12px;
    }

    .distance-badge {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .empty-state {
        padding: 30px 10px;
        font-size: 0.9rem;
    }

    .main-footer {
        padding: 20px 15px;
        margin-top: 15px;
        border-radius: 15px;
    }

    .footer-content h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .footer-info {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .info-item {
        padding: 12px;
    }

    .info-icon {
        font-size: 1.5rem;
    }

    .info-text strong {
        font-size: 0.9rem;
    }

    .info-text p {
        font-size: 0.8rem;
    }

    .footer-notice p {
        font-size: 0.75rem;
    }
}
