/**
 * Common Styles
 * 모바일 웹앱 공통 스타일
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #e5e5e5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* 모바일 래퍼 - 428px로 제한 (iPhone 14 Pro Max) */
/* Android/iOS 앱에서 상단 상태바·하단 내비와 겹치지 않도록 safe area 적용 */
.mobile-wrapper {
    width: 100%;
    max-width: 428px;
    min-height: 100vh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow-x: clip; /* hidden 대신 clip: scroll container 미생성 → position:fixed 정상 동작 */
}

@media (max-width: 428px) {
    body {
        background-color: #fff;
    }

    .mobile-wrapper {
        box-shadow: none;
    }
}

/* 공통 유틸리티 클래스 */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.flex-column {
    flex-direction: column;
}

/* 버튼 공통 스타일 */
button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 입력 필드 공통 스타일 */
input,
textarea,
select {
    font-family: inherit;
    font-size: 15px;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
}

/* 링크 스타일 */
a {
    text-decoration: none;
    color: inherit;
}

/* 이미지 기본 스타일 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 카드 공통 스타일 */
.card {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 스크롤바 스타일 (Webkit 브라우저) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 로딩 스피너 */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fade-in 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* 숨김 처리 */
.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden !important;
}

/* 반응형 이미지 */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* 그림자 효과 */
.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shadow {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ──────────────────────────────────────
   페이지 전환 상단 로딩 진행 바
   (sd.js의 navStart/navDone이 제어)
   ────────────────────────────────────── */
#sd-nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #0284c7 0%, #2d9fd4 60%, #5ebeea 100%);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.5);
    will-change: width, opacity;
}

#sd-nav-progress.active {
    opacity: 1;
}

/* 페이지 이동 중 링크/버튼 클릭 시각 피드백 */
.sd-bottom-nav-item:active,
.sd-bottom-nav a:active {
    opacity: 0.6;
    transition: opacity 0.08s;
}

/* 뒤로가기 버튼 탭 즉각 피드백 */
.sd-back-button:active {
    opacity: 0.6;
    transition: opacity 0.08s;
}

/* 카테고리/메뉴 카드 탭 시 즉각 피드백 */
.sd-category-nav-item-card:active,
.sd-submenu-item--link:active {
    opacity: 0.65;
    transform: scale(0.97);
    transition: opacity 0.08s, transform 0.08s;
}

/* ──────────────────────────────────────
   원형 스피너 (폼 제출 대기, 모달 검색 등)
   ────────────────────────────────────── */
@keyframes sd-spin {
    to { transform: rotate(360deg); }
}

.sd-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e7e5e4;
    border-top-color: #02547c;
    border-radius: 50%;
    animation: sd-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.sd-spinner-sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.sd-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    gap: 14px;
}

.sd-spinner-wrap span {
    font-size: 12.5px;
    font-weight: 600;
    color: #a8a29e;
}

/* ──────────────────────────────────────
   스켈레톤 로딩 UI (데이터 로딩 중 표시)
   ────────────────────────────────────── */
@keyframes sd-skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.sd-skeleton {
    background: linear-gradient(90deg, #f5f5f4 25%, #e7e5e4 50%, #f5f5f4 75%);
    background-size: 800px 100%;
    animation: sd-skeleton-shimmer 1.4s infinite linear;
    border-radius: 4px;
}

/* 추천 제품 스켈레톤 */
.sd-skeleton-product {
    width: 140px;
    height: 180px;
    flex-shrink: 0;
    display: inline-block;
    margin-right: 12px;
    border-radius: 4px;
}

/* 공지/알림 한 줄 스켈레톤 */
.sd-skeleton-notice-row {
    height: 48px;
    margin: 8px 0;
    border-radius: 4px;
    width: 100%;
}

/* 테이블 행 스켈레톤 (상병코드, 리스트 등) */
.sd-skeleton-table-row {
    display: grid;
    grid-template-columns: 60px 1fr 2fr;
    padding: 10px;
    border-bottom: 1px solid #f5f5f4;
    align-items: center;
    gap: 8px;
}
.sd-skeleton-table-row:last-child {
    border-bottom: none;
}

/* 심사자료/컨텐츠 카드 스켈레톤 */
.sd-skeleton-review-card {
    padding: 14px;
    margin-bottom: 10px;
    background: #fafaf9;
    border: 1px solid #e8eff2;
    border-radius: 4px;
}
.sd-skeleton-review-card:last-child {
    margin-bottom: 0;
}

/* 검색 결과 / 모달 목록 항목 스켈레톤 */
.sd-skeleton-list-item {
    list-style: none;
    padding: 10px 14px;
}