@charset "UTF-8";

/* =========================================
   1. 초기??�?기본 ?��???   ========================================= */
:root {
    --primary-color: #2563eb;       /* 메인 브랜??컬러 (KH?�품�?블루) */
    --primary-dark: #0ea5e9;        /* 그라?�이?????�상 (?�카??블루) */
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --primary-soft: #eff6ff;        /* ?�한 블루 배경 */
    --primary-shadow: rgba(37, 99, 235, 0.28);
    --text-main: #0f172a;
    --text-sub: #64748b;
    --bg-page: #f4f7fb;
    --bg-white: #ffffff;
    --border-color: #e6ebf2;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-soft: 0 6px 24px rgba(15, 23, 42, 0.06);
    --shadow-brand: 0 10px 26px var(--primary-shadow);
}

* {
    box-sizing: border-box; /* box_sizing ?��? ?�정 */
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", Roboto, "Segoe UI", sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    padding-bottom: 80px;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* =========================================
   2. ?�이?�웃 & ?�더
   ========================================= */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-white);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    /* Safe Area �?기본 ?�딩 */
    padding: 15px 20px; 
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.app-user-badge {
    font-size: 13px;
    background-color: #eff6ff;
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.app-container {
    max-width: 600px; 
    margin: 0 auto;
    /* Safe Area �?기본 ?�딩 */
    padding: 20px 20px; 
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

/* =========================================
   3. 카드 & ?�션 공통
   ========================================= */
.app-card {
    background-color: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 10px;
    padding: 0 5px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

/* =========================================
   4. 메인: 지�?카드 (Wallet Card) - [?�정??
   ========================================= */
.wallet-card {
    /* 배경: 그라?�이??+ ?�?�???�턴 ?�과 추�? (CSS Generated Texture) */
    background: var(--primary-gradient);
    background-image: radial-gradient(circle at 100% 150%, rgba(255, 255, 255, 0.1) 0%, transparent 70%),
                      var(--primary-gradient);
    color: white;
    text-align: center;
    padding: 35px 25px; /* ?�딩 증�? */
    border-radius: 18px; /* 모서�????��?�?*/
    box-shadow: 0 12px 25px -5px rgba(37, 99, 235, 0.4); /* 그림??강조 */
    position: relative;
    overflow: hidden;
}

.wallet-label {
    font-size: 16px; /* ?�트 ?�기 증�? */
    font-weight: 500;
    opacity: 0.95;
    margin-bottom: 10px; /* 간격 증�? */
    letter-spacing: 0.5px;
    /* ?�스??주�????�?�??그림??추�? (?�명??보조) */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); 
}

.wallet-balance {
    font-size: 48px; /* 금액 ?�트 ?�기 ?�??증�? */
    font-weight: 900; /* 극도�?굵게 */
    letter-spacing: 1px;
    margin-bottom: 15px;
    /* ?�트 ?�두�?그림???�과�?가?�성 극�???*/
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3), 0 0 10px rgba(255, 255, 255, 0.3);
}

.wallet-unit {
    font-size: 20px; /* ?�위 ?�트 ?�기 증�? */
    font-weight: 600;
    opacity: 1;
}

/* =========================================
   5. 메인: ?�션 버튼 그리??(?�렬 �??�상 최적??
   ========================================= */
.action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4??그리???��? */
    gap: 10px;
    margin-bottom: 30px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-white);
    border: none;
    border-radius: 18px;
    padding: 15px 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    /* 버튼 ?�체 그림??강조 */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08); 
    min-height: 95px; /* ?�이 고정?�로 ?�렬 문제 방�? */
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.action-btn:active {
    transform: scale(0.96);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

/* ?�이�?감싸???�형 배경 �??�이�??�렬 */
/* ?�이�?감싸???�형 배경 �??�이�??�렬 */
.action-icon-wrapper {
    /* ... (기존 ?��????��?) ... */
    /* ?�이�?배경?� ?�색?�로 명확?�게 */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05); 
}

/* [?�정] �?버튼�??�이�??�마 컬러 (고급�?금융 ???��??? */
.btn-buy .action-icon-wrapper    { background-color: #d8f5d8; color: #1e8449; }      /* 구매: 짙�? ?�색 계열 */
.btn-owned .action-icon-wrapper  { background-color: #f7e0fc; color: #a932ff; }      /* 보유?�품�? ?�벤???�플 */
.btn-coupon .action-icon-wrapper { background-color: #e6f9ff; color: #0088cc; }      /* ?�품권�?�? ?�카??블루 */
.btn-account .action-icon-wrapper{ background-color: #ffe0b2; color: #ff8c00; }      /* 계좌관�? ?�렌지/?�버 */

.action-text {
    font-size: 13px;
    font-weight: 700; 
    color: #374151;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* =========================================
   6. 거래 ?�역 리스??   ========================================= */
.tx-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tx-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f3f4f6;
}

.tx-item:last-child { border-bottom: none; }

.tx-info { display: flex; flex-direction: column; gap: 2px; }
.tx-title { font-size: 14px; font-weight: 600; color: #333; }
.tx-date { font-size: 12px; color: #9ca3af; }

.tx-amount { font-size: 15px; font-weight: 700; }
.tx-plus { color: var(--primary-color); }
.tx-minus { color: #333; }

/* =========================================
   7. ?�단 ?�비게이??   ========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--bg-white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
    /* Safe Area ?�용 */
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #9ca3af;
    gap: 4px;
    padding: 5px 10px;
}

.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--primary-color); font-weight: 600; }

/* =========================================
   8. ?�품권함 ?�이지 ?��???(user_wallet_coupons.php)
   ========================================= */
.coupon-summary-card {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
    text-align: center;
}

.coupon-summary-card h2 {
    font-size: 15px;
    font-weight: 400;
    opacity: 0.9;
    margin: 0 0 5px 0;
}

.coupon-summary-card .total-amount {
    font-size: 28px;
    font-weight: 700;
}

.coupon-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.coupon-item-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.coupon-item-card:hover { transform: translateY(-3px); }

.coupon-item-card img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.coupon-item-card .quantity {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.coupon-item-card .value {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 15px;
}

/* ?�품�?카드 ??버튼 그룹 */
.action-btn-group {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.action-btn-group button {
    flex: 1;
    border: none;
    padding: 8px 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: white;
}

.btn-gift { background-color: var(--success-color); }
.btn-refund { background-color: var(--danger-color); }

.action-btn-group button.disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
}

/* =========================================
   9. ?�증 (로그??가?? & TruePay ?�볼
   ========================================= */
.auth-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--bg-white);
}

.auth-logo { text-align: center; margin-bottom: 40px; }
.auth-logo h1 { font-size: 24px; font-weight: 800; color: var(--primary-color); margin: 0; }

.truepay-symbol {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background-color: var(--primary-color);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}
.truepay-symbol .lock {
    width: 28px;
    height: 22px;
    background-color: #fff;
    border-radius: 4px;
    position: relative;
    top: 2px;
}
.truepay-symbol .lock::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    border: 4px solid #fff;
    border-radius: 50% 50% 0 0;
    border-bottom: none;
}
.truepay-symbol .coin {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 900;
    line-height: 24px;
    letter-spacing: -0.5px;
    text-align: center;
    background-color: #ffcc00;
    border-radius: 12px;
    border: 2px solid #fff;
    z-index: 2;
}

.auth-input {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-input:focus { border-color: var(--primary-color); }

.auth-btn {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

.auth-btn:disabled { background-color: #a5b4fc; cursor: not-allowed; }

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-sub);
}

.auth-link a { color: var(--primary-color); font-weight: 600; text-decoration: underline; }

/* KYC ?�풋 그룹 */
.kyc-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}
.kyc-input-group > .auth-input { margin-bottom: 0; flex-grow: 1; }
.kyc-input-group > button { margin-top: 0; white-space: nowrap; width: 110px; font-size: 13px; }

/* =========================================
   10. 모달 (Popups)
   ========================================= */
.app-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* 반투�?배경 */
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-white);
    padding: 25px;
    border-radius: 16px;
    max-width: 90%;
    width: 340px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #111;
    text-align: center;
}

.modal-close {
    float: right;
    font-size: 24px;
    font-weight: bold;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}

.modal-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 12px;
    line-height: 1.5;
    color: #4b5563;
    background: #f3f4f6;
    padding: 10px;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
}

/* =========================================
   11. 모바???�용 바�? ?�트 (Payment/Gift UI)
   ========================================= */
.bottom-sheet-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bottom-sheet {
    position: fixed;
    bottom: -100%; /* 처음???�면 ?�래 ?��? */
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.15);
    z-index: 2001;
    transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    padding-bottom: env(safe-area-inset-bottom);
}

.sheet-header {
    padding: 20px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid #f3f4f6;
}

.sheet-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.sheet-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 5px;
}

.sheet-body {
    padding: 25px 20px;
    overflow-y: auto;
}

/* 금액 ?�력 ?�스?�레??*/
.amount-display-wrap {
    text-align: center;
    margin-bottom: 30px;
}

.amount-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
}

.amount-value {
    font-size: 36px;
    font-weight: 800;
    color: #4f46e5;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.amount-cursor {
    width: 2px;
    height: 36px;
    background: var(--primary-gradient);
    animation: blink 1s infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ?�풋 ?�드 ?��??�링 (?��?ID ?? */
.sheet-input-group {
    margin-bottom: 20px;
    text-align: left;
}
.sheet-input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}
.sheet-input {
    width: 100%;
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    background: #f9fafb;
    outline: none;
    transition: all 0.2s;
}
.sheet-input:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 가???�패??*/
.virtual-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #f9fafb;
    padding-bottom: 20px;
}

.keypad-btn {
    padding: 20px 0;
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.1s;
}

.keypad-btn:active { background: #e5e7eb; }

/* ?�단 ?�션 버튼 */
.sheet-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
}

.sheet-action-btn {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    background: var(--primary-gradient);
    color: white;
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sheet-action-btn:disabled {
    background: #d1d5db;
    box-shadow: none;
    cursor: not-allowed;
}

/* ?�성???�태 ?�래??*/
.bottom-sheet-overlay.active { display: block; opacity: 1; }
.bottom-sheet.active { bottom: 0; }

/* =========================================
   12. ?�품�??�벤?�리 리스??(멀???�택 UI)
   ========================================= */
.inventory-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 100px; /* ?�단 고정 �?공간 ?�보 */
}

.inventory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #f3f4f6;
}

.inv-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inv-img {
    width: 60px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.inv-text h4 { margin: 0; font-size: 15px; color: #1f2937; }
.inv-text p { margin: 3px 0 0; font-size: 12px; color: #6b7280; }
.inv-text .highlight { color: #4f46e5; font-weight: 700; }

/* ?�량 조절�?(Stepper) */
.qty-control {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 2px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #fff;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.qty-btn:active { background: #e5e7eb; transform: scale(0.95); }
.qty-btn:disabled { color: #d1d5db; cursor: not-allowed; }

.qty-input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    pointer-events: none; /* 직접 ?�력 방�? */
}

/* ?�단 고정 ?�션 �?(?�정?? */
.fixed-action-bar {
    position: fixed;
    bottom: 60px; /* ?�단 ?�비게이??�???*/
    left: 0;
    width: 100%;
    background: var(--bg-white);
    border-top: 1px solid #e5e7eb;
    z-index: 90;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.03);
    
    /* [?�정] ?��? ?�딩 �?좌우 ?�렬???�한 Safe Area ?�용 */
    padding: 15px 20px; 
    padding-bottom: 22px; /* �??�이�??��??�기 ?�해 ?�단 ?�딩 조정 */
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.total-selection {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding: 0; /* ?��? ?�딩 ?�거 (fixed-action-bar가 ?�딩???�당) */
}

.total-label { font-size: 14px; font-weight: 600; color: #4b5563; }
.total-val { font-size: 20px; font-weight: 800; color: var(--primary-color); }

.action-buttons {
    display: flex;
    gap: 10px;
}

.bar-btn {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: white;
}

.bar-btn.gift { background: #10b981; }
.bar-btn.refund { background: #ef4444; }
.bar-btn:disabled { background: #d1d5db; cursor: not-allowed; }