/* ==================== 기본 설정 ==================== */
:root {
    --primary-color: #5f6ac4;
    --primary-dark: #4a5ab0;
    --primary-light: #e8eaf6;
    --secondary-color: #3d4152;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #e0e0e0;
    --background-light: #f8f9fa;
    --white: #ffffff;
    --success-color: #4caf50;
    --error-color: #f44336;
    --warning-color: #ff9800;
    --info-color: #2196f3;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --mobile-header-height: 56px; /* 모바일 헤더 높이 */
    --top-banner-height: 58px;    /* 미입금 띠 높이 */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Apple SD Gothic Neo', sans-serif;
    background-color: var(--background-light);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== 앱 컨테이너 - 전체 너비 ==================== */
.app-container {
    width: 100%;
    max-width: none;
    margin: 0;
    background-color: var(--background-light);
    min-height: 100vh;
    min-height: 100dvh; /* 동적 viewport 높이 (모바일 브라우저 대응) */
    position: relative;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

/* ==================== 헤더 ==================== */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, #5f6ac4 0%, #6b76d1 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
}

.back-btn {
    position: absolute;
    left: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
    width: 40px;
    height: 40px;
}

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

.back-btn:active {
    transform: scale(0.95);
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* 헤더 버튼/뱃지는 common.css에서 통합 관리 */

/* ==================== 미입금 금액 상단 띠 ==================== */
.unpaid-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(255, 214, 145, 0.95) 0%, rgba(255, 181, 94, 0.95) 100%);
    color: #4b2c00;
    font-size: 14px;
    font-weight: 600;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 12px rgba(255, 181, 94, 0.25);
    position: sticky;
    top: 56px;
    z-index: 90;
}

.unpaid-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4b2c00;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unpaid-label i {
    font-size: 16px;
}

.unpaid-value {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #723100;
}

/* ==================== 메인 컨텐츠 ==================== */
.main-content {
    padding: calc(24px + var(--mobile-header-height) + var(--top-banner-height)) 18px 90px;
    flex: 1; /* 남은 공간을 모두 채움 */
}

/* ==================== 카테고리 섹션 ==================== */
.category-section {
    padding: 0 18px 32px;
}

.section-header {
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

/* 모바일에서는 1열로 */
@media (max-width: 768px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
}

.category-card {
    background: var(--white);
    border-radius: 16px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color) 0%, #6b76d1 100%);
    transform: scaleY(0);
    transition: var(--transition);
}

.category-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.category-card:hover::before {
    transform: scaleY(1);
}

.category-card:active {
    transform: translateX(2px) scale(0.98);
}

.category-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #f3f4fb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.category-card:hover .category-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

.category-icon-wrapper.medicine {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.category-icon-wrapper.health {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.category-icon-wrapper.device {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.category-icon-wrapper.cosmetic {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
}

.category-icon-wrapper.hygiene {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
}

/* 카테고리 썸네일 이미지 스타일 */
.category-icon-wrapper.category-has-image {
    background: var(--white);
    border: 2px solid var(--border-color);
    padding: 0;
    overflow: hidden;
}

.category-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.category-card:hover .category-icon-wrapper.category-has-image {
    border-color: var(--primary-color);
}

.category-icon i {
    font-size: 26px;
    color: var(--primary-color);
}

.category-icon-wrapper.medicine i {
    color: var(--success-color);
}

.category-icon-wrapper.health i {
    color: var(--warning-color);
}

.category-icon-wrapper.device i {
    color: var(--info-color);
}

.category-icon-wrapper.cosmetic i {
    color: #e91e63;
}

.category-icon-wrapper.hygiene i {
    color: #009688;
}

.category-info {
    flex: 1;
}

.category-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.category-desc {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.category-select-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.category-card:hover .category-select-btn {
    background: var(--primary-color);
    color: var(--white);
    transform: translateX(4px);
}

/* ==================== 빠른 주문 섹션 ==================== */
.quick-order-section {
    padding: 0 18px 32px;
}

.quick-order-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.quick-order-card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.quick-order-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.quick-order-card:active {
    transform: translateY(-2px);
}

.quick-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #f3f4fb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.quick-order-card:hover .quick-icon {
    transform: scale(1.1);
    background: linear-gradient(135deg, var(--primary-color) 0%, #6b76d1 100%);
}

.quick-icon i {
    font-size: 22px;
    color: var(--primary-color);
    transition: var(--transition);
}

.quick-order-card:hover .quick-icon i {
    color: var(--white);
}

.quick-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.quick-desc {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== 주문 안내 섹션 ==================== */
.info-section {
    padding: 0 18px 32px;
}

.info-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
    display: flex;
    gap: 18px;
}

.info-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-icon i {
    font-size: 22px;
    color: var(--info-color);
}

.info-content {
    flex: 1;
}

.info-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.info-list {
    list-style: none;
    padding: 0;
}

.info-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    line-height: 1.6;
    font-weight: 500;
}

.info-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 16px;
}

/* ==================== 고객 지원 배너 ==================== */
.support-banner {
    margin: 0 18px 32px;
    padding: 24px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 2px solid #90caf9;
}

.support-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.support-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.support-icon i {
    font-size: 26px;
    color: var(--info-color);
}

.support-text {
    flex: 1;
}

.support-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.support-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.support-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--info-color);
}

.support-phone i {
    font-size: 13px;
}

.support-button {
    padding: 12px 24px;
    background: var(--white);
    color: var(--info-color);
    border: 2px solid var(--info-color);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.support-button:hover {
    background: var(--info-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.support-button:active {
    transform: translateY(0);
}

/* 하단 네비게이션은 common.css에서 통합 관리 */

/* ==================== 반응형 디자인 ==================== */
/* 태블릿 (769px ~ 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }

    .quick-order-cards {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
}

/* PC 환경 (1025px 이상) */
@media (min-width: 1025px) {
    /* PC에서 메인 컨텐츠 중앙 정렬 및 최대 너비 설정 */
    body.lb-platform-web .main-content {
        max-width: 1400px;
        margin: 0 auto;
        padding: 24px 40px 120px;
    }

    /* PC에서 카테고리 그리드 확장 */
    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 24px;
    }

    /* PC에서 카테고리 카드 크기 조정 */
    .category-card {
        min-height: 140px;
        padding: 28px;
    }

    .category-icon-wrapper {
        width: 64px;
        height: 64px;
    }

    .category-icon i {
        font-size: 30px;
    }

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

@media (max-width: 560px) {
    .deadline-banner {
        flex-direction: column;
        text-align: left;
        align-items: flex-start;
        gap: 12px;
        padding: 20px;
    }

    .banner-icon {
        width: 48px;
        height: 48px;
    }

    .banner-title {
        font-size: 13px;
    }

    .banner-amount {
        font-size: 22px;
    }
}

@media (max-width: 380px) {
    .deadline-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .banner-icon {
        width: 50px;
        height: 50px;
    }

    .banner-icon i {
        font-size: 24px;
    }

    .banner-amount {
        font-size: 22px;
    }

    .category-card {
        padding: 16px;
    }

    .category-icon-wrapper {
        width: 48px;
        height: 48px;
    }

    .category-icon i {
        font-size: 22px;
    }

    .quick-order-cards {
        gap: 8px;
    }

    .quick-order-card {
        padding: 16px 8px;
    }

    .quick-icon {
        width: 42px;
        height: 42px;
    }

    .quick-icon i {
        font-size: 20px;
    }

    .support-banner {
        flex-direction: column;
        text-align: center;
    }

    .support-content {
        flex-direction: column;
    }
}

/* ==================== 로딩 및 빈 상태 ==================== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.loading-spinner {
    font-size: 32px;
    color: var(--primary-color);
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.empty-icon {
    font-size: 48px;
    color: var(--text-light);
    opacity: 0.5;
}

.empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

/* ==================== 애니메이션 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.deadline-banner {
    animation: fadeIn 0.5s ease-out;
}

.category-card {
    animation: slideInUp 0.4s ease-out;
}

.category-card:nth-child(1) { animation-delay: 0.05s; }
.category-card:nth-child(2) { animation-delay: 0.1s; }
.category-card:nth-child(3) { animation-delay: 0.15s; }
.category-card:nth-child(4) { animation-delay: 0.2s; }
.category-card:nth-child(5) { animation-delay: 0.25s; }
.category-card:nth-child(6) { animation-delay: 0.3s; }

.quick-order-card {
    animation: fadeIn 0.5s ease-out;
}

.quick-order-card:nth-child(1) { animation-delay: 0.1s; }
.quick-order-card:nth-child(2) { animation-delay: 0.2s; }
.quick-order-card:nth-child(3) { animation-delay: 0.3s; }

/* ==================== 팝업 모달 ==================== */
.popup-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.popup-modal-container {
    background: var(--white);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.popup-modal-overlay.active .popup-modal-container {
    transform: translateY(0);
}

.popup-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border-color);
}

.popup-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
    flex: 1;
    word-break: keep-all;
}

.popup-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--background-light);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.popup-modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.popup-modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

/* 팝업 모달 내 HTML 콘텐츠 스타일 */
.popup-modal-content p {
    margin-bottom: 12px;
}

.popup-modal-content p:last-child {
    margin-bottom: 0;
}

.popup-modal-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.popup-modal-content ul,
.popup-modal-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.popup-modal-content li {
    margin-bottom: 6px;
}

.popup-modal-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

.popup-modal-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.popup-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
    border-radius: 0 0 20px 20px;
}

.popup-dismiss-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.popup-dismiss-btn:hover {
    background: var(--white);
    border-color: var(--text-light);
}

.popup-dismiss-btn i {
    font-size: 14px;
}

.popup-close-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #6b76d1 100%);
    border: none;
    border-radius: 8px;
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(95, 106, 196, 0.3);
}

.popup-close-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(95, 106, 196, 0.4);
}
