/**
 * Adjuvantkorea 사용자 공통 CSS
 * - 알림/확인 모달 스타일
 * - 토스트 메시지 스타일
 */

/* =========================================================================
   공통 모달 스타일
   ========================================================================= */

.common-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.common-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.common-modal-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px 24px 24px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.2s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.common-modal-overlay.active .common-modal-container {
    transform: scale(1);
}

.common-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
}

.common-modal-icon.info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
}

.common-modal-icon.success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #388e3c;
}

.common-modal-icon.warning {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #f57c00;
}

.common-modal-icon.error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #d32f2f;
}

.common-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.common-modal-message {
    font-size: 14px;
    color: #666666;
    line-height: 1.6;
    margin-bottom: 24px;
    word-break: keep-all;
    white-space: pre-line;
}

.common-modal-actions {
    display: flex;
    gap: 10px;
}

.common-modal-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.common-modal-btn-primary {
    background: linear-gradient(135deg, #5f6ac4 0%, #6b76d1 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(95, 106, 196, 0.3);
}

.common-modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(95, 106, 196, 0.4);
}

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

.common-modal-btn-secondary {
    background: #f5f5f5;
    color: #666666;
    border: 1px solid #e0e0e0;
}

.common-modal-btn-secondary:hover {
    background: #eeeeee;
}

/* =========================================================================
   토스트 메시지 스타일
   ========================================================================= */

.common-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333333;
    color: #ffffff;
    padding: 14px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
    max-width: 90%;
}

.common-toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.common-toast i {
    font-size: 18px;
}

.common-toast.info {
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
}

.common-toast.success {
    background: linear-gradient(135deg, #388e3c 0%, #4caf50 100%);
}

.common-toast.warning {
    background: linear-gradient(135deg, #f57c00 0%, #ff9800 100%);
}

.common-toast.error {
    background: linear-gradient(135deg, #d32f2f 0%, #f44336 100%);
}

/* =========================================================================
   PC/모바일 반응형 레이아웃
   ========================================================================= */

/* PC 브레이크포인트: 769px 이상 */
/* 모바일 브레이크포인트: 768px 이하 */

/* ---------- PC용 헤더 스타일 ---------- */
.pc-header {
    display: none; /* 기본: 모바일에서 숨김 */
    background: linear-gradient(135deg, #5f6ac4 0%, #6b76d1 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.pc-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.pc-logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pc-logo-text {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.pc-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.pc-nav-item i {
    font-size: 16px;
}

.pc-nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.pc-nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.pc-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
}

.pc-cart-badge {
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 4px;
}

/* PC 햄버거 메뉴 버튼 (기본 숨김, 화면 작아지면 표시) */
.pc-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pc-menu-btn:hover,
.pc-menu-btn.active {
    background: rgba(255, 255, 255, 0.2);
}

/* PC 드롭다운 메뉴 (기본 숨김) */
.pc-dropdown-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 99;
    flex-direction: column;
    padding: 8px 0;
}

.pc-dropdown-menu.show {
    display: flex;
}

.pc-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    text-decoration: none;
    color: #333333;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.pc-dropdown-item i {
    font-size: 18px;
    color: #5f6ac4;
    width: 24px;
    text-align: center;
}

.pc-dropdown-item:hover {
    background: #f5f5f5;
}

.pc-dropdown-item.active {
    background: linear-gradient(135deg, #f0f1ff 0%, #e8e9ff 100%);
    color: #5f6ac4;
}

/* ---------- 모바일용 헤더 (기본 표시) ---------- */
.mobile-header {
    display: flex; /* 기본: 모바일에서 표시 */
}

/* =========================================================================
   공통 모바일 헤더 스타일 (top-header)
   ========================================================================= */

.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    height: 56px;
    background: linear-gradient(135deg, #5f6ac4 0%, #6b76d1 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.header-title {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 헤더 장바구니 버튼 */
.cart-btn {
    position: relative;
}

/* 헤더 장바구니 뱃지 - 통일된 빨간 동그라미 스타일 */
.cart-badge-header {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
}

/* 뱃지 숫자가 0일 때 숨김 */
.cart-badge-header:empty,
.cart-badge-header[data-count="0"] {
    display: none;
}

/* =========================================================================
   공통 하단 네비게이션 스타일 (bottom-nav)
   ========================================================================= */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    border-top: 1px solid #f0f0f0;
    padding: 8px 0;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    text-decoration: none;
    color: #999999;
    font-size: 10px;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 8px;
    margin: 0 2px;
}

.nav-item i {
    font-size: 20px;
    transition: all 0.2s ease;
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* 선택된 메뉴 아이템 - 통일된 스타일 (아이콘 색상만 변경, 배경 없음) */
.nav-item.active {
    color: #5f6ac4;
}

/* 하단 네비 hover/focus 상태 무효화 (페이지 활성화 상태만 사용) */
.bottom-nav .nav-item:not(.active):hover,
.bottom-nav .nav-item:not(.active):focus,
.bottom-nav .nav-item:not(.active):active {
    color: inherit;
    background: transparent;
}

/* =========================================================================
   공통 장바구니/알림 뱃지 스타일
   ========================================================================= */

/* 일반 장바구니 뱃지 (카드 등에서 사용) */
.cart-badge,
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
}

/* =========================================================================
   플랫폼별 헤더/네비 제어 (common.js에서 body에 클래스 추가)
   - lb-platform-web: 웹 환경 (PC 헤더 표시)
   - lb-platform-android: 안드로이드 앱 (모바일 헤더 + 바텀 네비)
   - lb-platform-ios: iOS 앱 (모바일 헤더 + 바텀 네비)
   ========================================================================= */

/* 웹 환경: PC 헤더 표시, 모바일 헤더/바텀네비 숨김 */
body.lb-platform-web .pc-header {
    display: block;
}

body.lb-platform-web .mobile-header {
    display: none !important;
}

body.lb-platform-web .bottom-nav {
    display: none !important;
}

/* 웹 환경에서는 하단 패딩 최소화 (모바일 바텀 네비 자리 제거) */
body.lb-platform-web .main-content,
body.lb-platform-web .app-container,
body.lb-platform-web .content-section,
body.lb-platform-web .page-content,
body.lb-platform-web .content-wrapper {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* 웹 환경: 주문 요약 바를 화면 하단에 밀착 */
body.lb-platform-web .order-summary-bar {
    bottom: 0 !important;
}

/* 모바일 환경: 하단 네비 위에 주문 요약 바 유지 */
body.lb-platform-android .order-summary-bar,
body.lb-platform-ios .order-summary-bar {
    bottom: calc(70px + env(safe-area-inset-bottom)) !important;
}

/* 모바일 환경 (Android/iOS): 모바일 헤더 + 바텀 네비 표시, PC 헤더 숨김 */
body.lb-platform-android .pc-header,
body.lb-platform-ios .pc-header {
    display: none !important;
}

body.lb-platform-android .mobile-header,
body.lb-platform-ios .mobile-header {
    display: flex !important;
}

body.lb-platform-android .bottom-nav,
body.lb-platform-ios .bottom-nav {
    display: flex !important;
}

/* 모든 환경에서 app-container가 화면 전체를 채우도록 설정 */
.app-container {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh; /* 동적 viewport 높이 */
    display: flex;
    flex-direction: column;
    box-shadow: none;
}

/* 모든 환경에서 메인 컨텐츠가 남은 공간을 채우도록 설정 */
.main-content {
    flex: 1;
}

/* 앱(WebView) 환경에서 헤더/네비가 가로 폭을 모두 쓰도록 강제 - 환경별 화면폭 차이를 제거하기 위함 */
body.lb-platform-android .app-container,
body.lb-platform-ios .app-container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
}

body.lb-platform-android .mobile-header,
body.lb-platform-ios .mobile-header {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
}

/* 앱(WebView) 환경에서는 상단 헤더가 좌우 전체를 덮도록 위치/너비 보정 */
body.lb-platform-android .top-header,
body.lb-platform-ios .top-header {
    left: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.lb-platform-android .bottom-nav,
body.lb-platform-ios .bottom-nav {
    /* 네이티브 앱에서는 고정 하단 네비를 전체 너비로 확장 */
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* 앱 환경에서 하단 회색 배경 제거 */
body.lb-platform-android,
body.lb-platform-ios {
    background-color: #ffffff !important;
}

/* =========================================================================
   PC 반응형 (769px 이상)
   ========================================================================= */
@media (min-width: 769px) {
    /* PC 헤더 표시 */
    .pc-header {
        display: block;
    }
    
    /* 모바일 헤더 숨김 */
    .mobile-header {
        display: none !important;
    }
    
    /* 하단 네비게이션 숨김 */
    .bottom-nav {
        display: none !important;
    }
    
    /* 앱 컨테이너 전체 너비로 확장 */
    .app-container {
        max-width: 100% !important;
        box-shadow: none !important;
    }

    /* 메인 컨텐츠 전체 너비 사용 (웹 환경) */
    body.lb-platform-web .main-content {
        max-width: none !important;
        margin: 0 !important;
        padding: 24px 40px;
        padding-bottom: 40px;
        width: 100% !important;
    }

    /* 주문 요약 바 (하단 고정 바) PC 스타일 - 전체 너비 */
    body.lb-platform-web .order-summary-bar {
        max-width: none !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        transform: none !important;
        border-radius: 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
        padding: 16px 40px !important;
    }
    
    /* 카테고리 섹션 PC 그리드 */
    .category-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
        gap: 20px !important;
    }

    /* 빠른 주문 카드 PC 그리드 */
    .quick-order-cards {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
        gap: 16px !important;
    }

    /* 상품 목록 PC 그리드 - 4열 레이아웃 */
    .products-list {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        gap: 20px !important;
    }

    /* 주문 목록 PC 그리드 */
    .order-list {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)) !important;
        gap: 20px !important;
    }

    /* 장바구니/찜목록 PC 그리드 */
    .cart-list,
    .wishlist-products {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
        gap: 20px !important;
    }
    
    /* 필터 섹션 PC 스타일 */
    .filter-section {
        max-width: 600px;
    }
    
    /* 검색 섹션 PC 스타일 */
    .search-section {
        max-width: 500px;
    }
    
    /* 모달 PC 스타일 */
    .modal-container {
        max-width: 560px !important;
        max-height: 80vh !important;
    }
    
    /* 배너 PC 스타일 */
    .deadline-banner {
        max-width: 600px;
    }
    
    /* 고객지원 배너 PC 스타일 */
    .support-banner {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* 정보 카드 PC 스타일 */
    .info-card {
        max-width: 600px;
    }
    
    /* 마이페이지 메뉴 PC 그리드 */
    .mypage-menu {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        gap: 12px !important;
    }
    
    /* 프로필 카드 PC 스타일 */
    .profile-card {
        max-width: 500px;
    }
    
    /* 폼 컨테이너 PC 스타일 */
    .form-container,
    .login-form,
    .register-form {
        max-width: 480px;
        margin: 0 auto;
    }
    
    /* 공지사항/FAQ 목록 PC 그리드 */
    .notice-list,
    .faq-list {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)) !important;
        gap: 12px !important;
    }
    
    /* 상품 카드 PC 스타일 */
    .product-card {
        min-height: auto;
    }
    
    /* 브레드크럼 PC 스타일 */
    .breadcrumb {
        max-width: 500px;
    }
}

/* =========================================================================
   웹 환경 + 작은 화면 (768px 이하) - 햄버거 메뉴 표시
   ========================================================================= */
@media (max-width: 768px) {
    /* 웹 환경에서 화면이 작아지면 햄버거 메뉴 표시 */
    body.lb-platform-web .pc-menu-btn {
        display: flex;
    }
    
    /* 웹 환경에서 화면이 작아지면 네비게이션 메뉴 숨김 */
    body.lb-platform-web .pc-nav {
        display: none;
    }
    
    /* 웹 환경에서 헤더 내부 정렬 조정 */
    body.lb-platform-web .pc-header-inner {
        justify-content: flex-start;
        gap: 12px;
    }
    
    /* 웹 환경에서 로고 가운데 정렬 */
    body.lb-platform-web .pc-logo {
        flex: 1;
        justify-content: center;
    }
}

/* =========================================================================
   정책 재동의 모달 스타일
   ========================================================================= */

/* 모달 오버레이 */
.policy-agreement-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

/* 모달 컨테이너 */
.policy-agreement-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* 모달 헤더 */
.policy-agreement-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.policy-agreement-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
}

.policy-agreement-header p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* 모달 본문 */
.policy-agreement-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* 정책 아이템 */
.policy-agreement-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.policy-agreement-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 정책 제목 */
.policy-agreement-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

/* 정책 내용 */
.policy-agreement-content {
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* 모달 푸터 */
.policy-agreement-footer {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #e5e7eb;
}

/* 동의하지 않음 버튼 */
.btn-policy-disagree {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-policy-disagree:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* 모두 동의 버튼 */
.btn-policy-agree {
    flex: 2;
    padding: 14px 16px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-policy-agree:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
