@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI', sans-serif;
    background-color: #fafafa;
    color: #1a1a1a;
    line-height: 1.5;
}

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-container {
    display: flex;
    align-items: center;
    padding: 0;
    height: 60px;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-text {
    background: linear-gradient(135deg, #5e10a1 0%, #7a1fc7 100%);
    color: white;
    font-size: 28px;
    font-weight: 800;
    padding: 0 20px;
    border-radius: 0;
    letter-spacing: 2px;
    line-height: 60px;
    height: 60px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-text:hover {
    opacity: 0.9;
}

.main-nav {
    display: flex;
    gap: 20px;
    margin-left: 30px;
    margin-right: 40px;
}

.nav-link {
    text-decoration: none;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link.active {
    color: #5e10a1;
    font-weight: 700;
}

.nav-link:hover {
    color: #5e10a1;
}

.main-menu {
    display: flex;
    gap: 40px;
    margin-left: auto;
}

.menu-link {
    text-decoration: none;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    padding: 20px 0;
    position: relative;
    transition: color 0.2s;
}

.menu-link.active {
    color: #5e10a1;
    border-bottom: 2px solid #5e10a1;
}

.menu-link:hover {
    color: #5e10a1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding-right: 20px;
}

.login-link {
    text-decoration: none;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    transition: all 0.3s;
    background: #fff;
    white-space: nowrap;
}

.login-link:hover {
    border-color: #5e10a1;
    color: #5e10a1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(94, 16, 161, 0.1);
}

.signup-link {
    text-decoration: none;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 20px;
    transition: all 0.3s;
    background: linear-gradient(135deg, #5e10a1 0%, #7a1fc7 100%);
    white-space: nowrap;
    border: none;
}

.signup-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(94, 16, 161, 0.3);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    color: #333;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 20px;
}

.mypage-link,
.logout-link {
    color: #666;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    transition: all 0.3s;
    background: #fff;
}

.mypage-link:hover,
.logout-link:hover {
    background: #5e10a1;
    color: white;
    border-color: #5e10a1;
    transform: translateY(-1px);
}

.search-box {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    background: #f9f9f9;
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: #5e10a1;
    background: #fff;
    box-shadow: 0 2px 8px rgba(94, 16, 161, 0.1);
}

.search-input {
    border: none;
    outline: none;
    font-size: 13px;
    width: 220px;
    background: transparent;
    font-weight: 500;
}

.search-input::placeholder {
    color: #999;
}

.search-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: color 0.3s;
}

.search-btn:hover {
    color: #5e10a1;
}

/* Tabs */
.tabs-container {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.tabs {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 40px;
}

.gender-filter-notice {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
    background: #fff3e0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.filter-badge {
    background: #5e10a1;
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
}

.clear-filter {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.clear-filter:hover {
    color: #5e10a1;
}

.tab {
    background: none;
    border: none;
    padding: 20px 0;
    font-size: 15px;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab.active {
    color: #5e10a1;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #5e10a1;
}

.tab:hover {
    color: #5e10a1;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Filters - Full Width */
.filters-wrapper {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 20px;
    margin: 0;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-bottom: 30px;
}

.filters-section {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.filter-left {
    flex: 0 0 auto;
}

.filter-select {
    padding: 10px 36px 10px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8"><path fill="%23666" d="M6 8L0 0h12z"/></svg>') no-repeat right 12px center;
    background-size: 12px;
    appearance: none;
    cursor: pointer;
    min-width: 200px;
}

.filter-center {
    flex: 1;
    max-width: 500px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 16px;
}

.shop-search {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
}

.search-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0 0 0 10px;
}

.filter-right {
    display: flex;
    gap: 8px;
}

.age-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.age-btn.active {
    background: #5e10a1;
    color: white;
    border-color: #5e10a1;
}

.age-btn:hover:not(.active) {
    border-color: #5e10a1;
    color: #5e10a1;
}

/* Hospital Grid */
.hospital-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

@media (min-width: 1200px) {
    .hospital-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .hospital-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .hospital-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 마이병원 Card */
.my-hospital-card {
    cursor: pointer;
    border: 2px solid #5e10a1 !important;
    background: linear-gradient(to bottom, #fff 0%, #fff9f7 100%) !important;
}

.my-hospital-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.2);
}

.hospital-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #eee;
}

.hospital-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.rank-number {
    position: absolute;
    top: 12px;
    left: 12px;
    color: #5e10a1;
    font-size: 13px;
    font-weight: 700;
}

.hospital-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    background: #f5f5f5;
}

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

.hospital-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    min-height: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hospital-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 8px;
    min-height: 28px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f0f0;
    color: #666;
    font-size: 11px;
    border-radius: 12px;
}

.hospital-location {
    color: #999;
    font-size: 13px;
    margin-bottom: 12px;
}

.hospital-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
    padding: 12px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    color: #999;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #5e10a1;
}

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

.btn-detail,
.btn-favorite {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-detail:hover {
    background: #5e10a1;
    color: white;
    border-color: #5e10a1;
}

.btn-favorite {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-favorite:hover {
    border-color: #5e10a1;
    color: #5e10a1;
}

.btn-favorite.active {
    background: #5e10a1;
    color: white;
    border-color: #5e10a1;
}

.btn-favorite.active:hover {
    background: #4a0d82;
}

.plus-icon {
    font-size: 16px;
    font-weight: 300;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    text-decoration: none;
    color: #666;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.page-link:hover {
    border-color: #5e10a1;
    color: #5e10a1;
}

.page-link.active {
    background: #5e10a1;
    color: white;
    border-color: #5e10a1;
}

.page-link.prev,
.page-link.next {
    font-weight: bold;
}

/* Floating Rank Box */
.floating-rank {
    position: fixed;
    right: 30px;
    bottom: 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    max-width: 250px;
    text-align: center;
    max-height: 80vh;
    overflow-y: auto;
}

.floating-title {
    font-size: 13px;
    color: #333;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #5e10a1;
}

.recent-hospitals-list {
    margin-bottom: 16px;
    text-align: left;
}

.recent-hospital-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    margin-bottom: 8px;
    border: 1px solid #f0f0f0;
}

.recent-hospital-item:hover {
    background: #f9f9f9;
    border-color: #5e10a1;
}

.recent-hospital-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.recent-hospital-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.recent-hospital-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-hospital-rating {
    font-size: 11px;
    color: #5e10a1;
    font-weight: 600;
}

.floating-count {
    font-size: 13px;
    font-weight: 700;
    color: #5e10a1;
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.floating-nav {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.nav-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    background: #fff;
    transition: all 0.2s;
}

.nav-arrow:hover {
    background: #5e10a1;
    color: white;
    border-color: #5e10a1;
}

/* Empty State */
.hospitals-empty {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 8px;
    margin: 40px 0;
}

.hospitals-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.hospitals-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.hospitals-empty-text {
    font-size: 14px;
    color: #999;
    line-height: 1.6;
    margin-bottom: 24px;
}

.hospitals-empty-text strong {
    color: #5e10a1;
}

.btn-reset-search {
    display: inline-block;
    padding: 12px 24px;
    background: #5e10a1;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-reset-search:hover {
    background: #e55a28;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        height: auto;
        padding: 10px;
    }

    .main-menu {
        order: 3;
        width: 100%;
        justify-content: space-around;
        border-top: 1px solid #eee;
        padding-top: 10px;
        margin-top: 10px;
    }

    .filters-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-left,
    .filter-center,
    .filter-right {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .filter-right {
        justify-content: center;
    }

    .hospital-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .floating-rank {
        right: 10px;
        bottom: 10px;
        min-width: 100px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .hospital-grid {
        grid-template-columns: 1fr;
    }

    .hospital-card {
        padding: 16px;
    }

    .hospital-image {
        width: 100px;
        height: 100px;
    }
}

/* Toast Message */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    min-width: 250px;
    text-align: center;
    justify-content: center;
}

.toast.success {
    background: rgba(94, 16, 161, 0.95);
}

.toast.error {
    background: rgba(220, 53, 69, 0.95);
}

.toast-icon {
    font-size: 18px;
}

@keyframes slideUp {
    from {
        bottom: 0;
        opacity: 0;
    }
    to {
        bottom: 30px;
        opacity: 1;
    }
}
