/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 400px;
    height: 100%;
    height: 100dvh;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

/* Page Styles */
.page {
    display: none;
    width: 100%;
    height: 100%;
    height: 100dvh;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.page.active {
    display: flex;
}

/* Page Content - Scrollable area if needed */
.page-content {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 25px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Center content vertically (for Page 2) */
.page-content.center-content {
    justify-content: center;
    overflow: hidden;
}

/* Page Footer - Fixed at bottom */
.page-footer {
    width: 100%;
    padding: 15px 25px 30px;
    padding-bottom: max(30px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    flex-shrink: 0;
}

/* Stars Decoration */
.stars-decoration {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.star {
    color: #FFD4E5;
    font-size: 12px;
    animation: twinkle 2s ease-in-out infinite;
}

.star:nth-child(1) { animation-delay: 0s; color: #FFB6C1; }
.star:nth-child(2) { animation-delay: 0.3s; color: #FFC0CB; }
.star:nth-child(3) { animation-delay: 0.6s; color: #FFD4E5; }
.star:nth-child(4) { animation-delay: 0.9s; color: #FFC0CB; }
.star:nth-child(5) { animation-delay: 1.2s; color: #FFB6C1; }

@keyframes twinkle {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Main Title */
.main-title {
    font-size: clamp(32px, 8vw, 42px);
    font-weight: 900;
    color: #FFB6C1;
    text-align: center;
    line-height: 1.3;
    margin-bottom: clamp(25px, 5vh, 50px);
    text-shadow: 2px 2px 4px rgba(255, 182, 193, 0.3);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.main-title span:first-child {
    font-size: clamp(28px, 7vw, 36px);
}

/* Hero Image (Page 1) */
.hero-image-container {
    width: 100%;
    max-width: 400px;
    height: 200px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: clamp(20px, 4vh, 35px);
    flex-shrink: 0;
}

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

/* Selection Sections */
.selection-section {
    width: 100%;
    margin-bottom: clamp(20px, 4vh, 40px);
    flex-shrink: 0;
}

.section-title {
    text-align: center;
    color: #FF69B4;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
}

/* Button Groups */
.button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.menu-buttons {
    max-width: 280px;
    margin: 0 auto;
}

.location-buttons {
    max-width: 320px;
    margin: 0 auto;
}

/* Select Buttons */
.select-btn {
    padding: 10px 20px;
    border: 1.5px solid #E0E0E0;
    border-radius: 25px;
    background: #ffffff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.select-btn:hover {
    border-color: #FFB6C1;
    background: #FFF5F7;
}

.select-btn.selected {
    border-color: #FF69B4;
    background: #FFF0F5;
    color: #FF69B4;
}

.select-btn.wide {
    padding: 10px 25px;
}

.select-btn.location {
    padding: 10px 18px;
}

/* Primary Button */
.primary-btn {
    width: 100%;
    max-width: 340px;
    padding: 16px 40px;
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
    border: none;
    border-radius: 15px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
    flex-shrink: 0;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.4);
}

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

.primary-btn.share {
    margin-top: 0;
}

/* Secondary Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 340px;
    flex-shrink: 0;
}

.secondary-btn {
    flex: 1;
    padding: 14px 15px;
    background: #ffffff;
    border: 2px solid #FFB6C1;
    border-radius: 12px;
    color: #FF69B4;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.secondary-btn:hover {
    background: #FFF5F7;
}

/* Page 2: Info Page */
#page2 .page-content {
    justify-content: center;
}

.info-content {
    text-align: center;
}

.info-title {
    font-size: clamp(30px, 7vw, 38px);
    font-weight: 900;
    color: #FFB6C1;
    line-height: 1.4;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(255, 182, 193, 0.3);
    display: flex;
    flex-direction: column;
}

.info-title span:first-child {
    font-size: clamp(26px, 6vw, 32px);
}

#totalCount {
    color: #FF69B4;
}

.info-description {
    color: #999;
    font-size: 13px;
    line-height: 1.8;
}

/* Page 3 & 4: Result Pages */
.result-title {
    font-size: clamp(28px, 7vw, 38px);
    font-weight: 900;
    color: #FFB6C1;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(255, 182, 193, 0.3);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Menu Image */
.menu-image-container {
    width: calc(100% + 50px);
    margin: -30px -25px 0;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

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

/* Title Section */
.title-section {
    width: 100%;
    text-align: center;
    padding: 15px 0 10px;
    flex-shrink: 0;
}

.title-section .stars-decoration {
    margin-bottom: 10px;
}

.title-section .result-title {
    margin-bottom: 0;
}

/* Result Card Wrapper */
.result-card-wrapper {
    width: 100%;
    background: #ffffff;
    border: 2px solid #FFB6C1;
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* Result Card */
.result-card {
    width: 100%;
    background: transparent;
    border-radius: 15px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* More Button (inside card wrapper) */
.more-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 0;
    background: transparent;
    border: none;
    border-top: 1px solid #F0F0F0;
    color: #FFB6C1;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    transition: color 0.2s ease;
}

.more-btn:hover {
    color: #FF69B4;
}

.more-btn .arrow {
    color: #FF69B4;
    font-size: 18px;
}

/* Share Button (pink background) */
.share-btn {
    width: 100%;
    max-width: 340px;
    padding: 16px 40px;
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
    border: none;
    border-radius: 15px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
    flex-shrink: 0;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.4);
}

/* Back Button */
.back-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #FF69B4;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.back-btn:hover {
    transform: translateX(-3px);
}

/* Page 4 specific styles */
#page4 .page-content {
    position: relative;
}

#page4 .menu-image-container {
    margin-top: 10px;
}

.restaurant-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
    margin-top: -2px;
}

.open-time {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #E0E0E0;
    border-radius: 15px;
    padding: 5px 12px;
    font-size: 12px;
    color: #666;
    width: fit-content;
}

.restaurant-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-top: 5px;
}

/* Map Links */
.map-links {
    display: flex;
    gap: 10px;
}

.map-btn {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.map-btn:hover {
    transform: scale(1.05);
}

.map-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-btn.naver {
    background: #03C75A;
}

.map-btn.kakao {
    background: #FEE500;
}

.map-btn.google {
    background: #ffffff;
}

/* Results List (Page 4) */
.results-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}

.results-list::-webkit-scrollbar {
    width: 4px;
}

.results-list::-webkit-scrollbar-thumb {
    background: #FFB6C1;
    border-radius: 2px;
}

.result-item {
    width: 100%;
    background: #ffffff;
    border: 2px solid #FFB6C1;
    border-radius: 15px;
    padding: 15px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.bottom-map-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

/* Page 4 specific */
#page4 .primary-btn {
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
}

#page4 .primary-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.4);
}

/* Animations */
.page {
    animation: fadeIn 0.3s ease;
}

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

/* Responsive adjustments */
@media (max-width: 420px) {
    .page-content {
        padding: 25px 20px 15px;
    }
    
    .page-footer {
        padding: 12px 20px 25px;
        padding-bottom: max(25px, env(safe-area-inset-bottom));
        gap: 10px;
    }
    
    .primary-btn {
        padding: 14px 30px;
        font-size: 17px;
    }
    
    .secondary-btn {
        padding: 12px 12px;
        font-size: 14px;
    }
    
    .action-buttons {
        gap: 10px;
    }
    
    .menu-image-container {
        width: calc(100% + 40px);
        margin: -25px -20px 0;
        height: 180px;
    }
}

/* Very small screens */
@media (max-height: 600px) {
    .page-content {
        padding: 15px 20px 10px;
    }
    
    .page-footer {
        padding: 10px 20px 20px;
        gap: 8px;
    }
    
    .main-title {
        margin-bottom: 15px;
    }
    
    .selection-section {
        margin-bottom: 15px;
    }
    
    .stars-decoration {
        margin-bottom: 10px;
    }
    
    .result-title {
        margin-bottom: 15px;
    }
    
    .menu-image-container {
        height: 140px;
    }
    
    .title-section {
        padding: 10px 0 5px;
    }
    
    .result-card-wrapper {
        padding: 15px;
        margin-bottom: 10px;
    }
}

/* PC/Large screens */
@media (min-width: 768px) {
    .app-container {
        max-width: 400px;
        height: 100vh;
        height: 100dvh;
        border-left: 1px solid #f0f0f0;
        border-right: 1px solid #f0f0f0;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Share Modal */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.share-modal-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 320px;
    text-align: center;
}

.share-modal-content h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 20px;
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.share-option-btn {
    padding: 15px 20px;
    border: 1.5px solid #E0E0E0;
    border-radius: 12px;
    background: #ffffff;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.share-option-btn:hover {
    background: #FFF5F7;
    border-color: #FFB6C1;
}

.share-close-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    background: #F0F0F0;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.share-close-btn:hover {
    background: #E0E0E0;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Map Button improvements */
.map-btn {
    border: none;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

.result-item .map-btn {
    width: 40px;
    height: 40px;
}
