/* ===================================================
   🎨 [Spring Shop] 메인 페이지 (home.css)
   =================================================== */

/* 1. 기본 초기화 및 폰트 설정 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333333;
    padding-bottom: 60px;
    min-height: 100vh;
}

/* 2. 상단 네비게이션 바 (Navbar) */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: #3182f6; /* 토스 시그니처 블루 */
    text-decoration: none;
    letter-spacing: -0.5px;
}

.mypage-link {
    font-size: 14px;
    font-weight: 600;
    color: #4e5968;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    background-color: #f2f4f6;
    transition: all 0.2s ease-in-out;
}

.mypage-link:hover {
    background-color: #e5e8eb;
    color: #191f28;
}

/* 3. 메인 컨테이너 */
.container {
    max-width: 1200px;
    margin: 36px auto;
    padding: 0 20px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #191f28;
    letter-spacing: -0.3px;
}

/* 4. 🛍️ 상품 그리드 레이아웃 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 데스크톱 기본 5개씩 2줄 */
    gap: 20px;
}

/* 5. 상품 카드 (Product Card) */
.product-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #f2f4f6;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

/* 이미지 영역 */
.product-img-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background-color: #f2f4f6;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

/* 상품 상세 정보 영역 */
.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: #333d4b;
    margin-bottom: 10px;
    line-height: 1.35;
    /* 긴 제목 2줄 이상 처리 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.product-price {
    font-size: 17px;
    font-weight: 700;
    color: #191f28;
}

.product-stock {
    font-size: 12px;
    color: #6b7684;
    background-color: #f2f4f6;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* 구매하기 버튼 */
.btn-buy {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background-color: #3182f6;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-buy:hover {
    background-color: #1b64da;
}

.btn-buy:active {
    transform: scale(0.98);
}

/* 빈 상태 처리 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #8b95a1;
    font-size: 15px;
    grid-column: 1 / -1;
}

/* 6. 📱 반응형 분기 (화면이 줄어들면 카드 개수도 자연스럽게 줄어듦) */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr); /* 태블릿: 3개씩 */
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 14px 20px;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr); /* 모바일: 2개씩 */
        gap: 12px;
    }
    .product-img-wrapper {
        height: 150px;
    }
}
/* ===================================================
   [결제위젯 모달 정중앙 배치 & 블러 배경]
   =================================================== */

/* 1. 모달 전체 오버레이 (화면 전체를 덮고 정중앙 정렬) */
.modal-overlay {
    display: none; /* JS에서 flex로 변경함 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4); /* 어두운 반투명 배경 */
    backdrop-filter: blur(5px);           /* 뒤 화면 블러 효과 */
    -webkit-backdrop-filter: blur(5px);

    /* 💡 핵심: 화면 정중앙 정렬 */
    justify-content: center;
    align-items: center;

    z-index: 9999; /* 최상단에 배치 */
}

/* 2. 모달 하얀색 대화상자 박스 */
.modal-content {
    background-color: #ffffff;
    width: 90%;
    max-width: 440px;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);

    /* 💡 동적 높이 조절 및 화면 이탈 방지 */
    max-height: 85vh;
    overflow-y: auto;

    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.25s ease-out;
}

/* 3. 모달 내 닫기 버튼 */
.close-btn {
    width: 100%;
    background-color: #f2f4f6;
    color: #4e5968;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.close-btn:hover {
    background-color: #e5e8eb;
}

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

.sold-out-text {
    color: #ff4d4f !important;
    font-weight: bold;
}

/* 💡 관리자 버튼 스타일 추가 */
.admin-link {
    text-decoration: none;
    color: #4a5568;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    background-color: #edf2f7;
    transition: all 0.2s ease;
    margin-left: 10px;
}
.admin-link:hover {
    background-color: #e2e8f0;
    color: #2d3748;
}
.nav-right {
    display: flex;
    align-items: center;
}