/* =====================================================
   이용내역 페이지 스타일
   ===================================================== */

/* ── 타이틀 섹션 ── */
.history-title-section {
    padding: 20px 20px 8px;
}

.history-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.history-subtitle {
    font-size: 13px;
    color: #888;
    margin: 14px 20px 4px;
}

/* ── 탭 ── */
.history-tabs {
    display: flex;
    margin: 12px 16px 0;
    border-bottom: 2px solid #f0f0f0;
}

.history-tab {
    flex: 1;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #aaa;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.history-tab.active {
    color: #5a86ff;
    border-bottom-color: #5a86ff;
}

/* ── 무료 장수 패널 ── */
.free-prints-panel {
    padding: 0 16px 24px;
    margin-top: 20px;
}

.free-prints-summary {
    text-align: center;
    padding: 28px 16px 24px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #5a86ff 0%, #7ba3ff 100%);
    border-radius: 14px;
    color: #fff;
}

.free-prints-summary-icon {
    margin-bottom: 10px;
}

.free-prints-summary-icon svg {
    width: 44px;
    height: 44px;
}

.free-prints-total-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.85;
    margin-bottom: 6px;
}

.free-prints-total-count {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.1;
}

.free-prints-total-count span {
    font-size: 36px;
}

/* CoN 단위 색상 */
.con-unit {
    font-size: 20px !important;
    font-weight: 700;
    letter-spacing: -0.06em;
    margin-left: 2px;
    display: inline-block;
}

.con-c {
    color: inherit;
}

.con-o {
    color: #4ade80;
}

.con-n {
    color: #facc15;
}

/* 무료 장수 항목 카드 */
.free-prints-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.free-print-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.free-print-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.free-print-card-icon svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.free-print-card-icon.source-signup {
    background: #f59e0b;
}

.free-print-card-icon.source-invite {
    background: #5a86ff;
}

.free-print-card-body {
    flex: 1;
    min-width: 0;
}

.free-print-card-source {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.free-print-card-invitees {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.free-print-card-expires {
    font-size: 12px;
    color: #999;
}

.free-print-card-expires.expires-soon {
    color: #e74c3c;
    font-weight: 500;
}

.free-print-card-count {
    font-size: 18px;
    font-weight: 700;
    color: #5a86ff;
    flex-shrink: 0;
    white-space: nowrap;
}

/* 무료 장수 빈 상태 */
.free-prints-empty {
    text-align: center;
    padding: 60px 20px;
}

.free-prints-empty p {
    font-size: 14px;
    color: #999;
    margin: 0;
}

/* 무료 장수 로딩 */
.free-prints-loading {
    text-align: center;
    padding: 60px 20px;
}

.free-prints-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #e0e0e0;
    border-top-color: #5a86ff;
    border-radius: 50%;
    animation: free-prints-spin 0.7s linear infinite;
}

@keyframes free-prints-spin {
    to { transform: rotate(360deg); }
}

/* ── 카드 목록 ── */
.history-list {
    padding: 12px 16px;
}

.history-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
}

/* 카드 상단: 아이콘 + 서비스명 + 날짜 */
.history-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.history-kind-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.history-kind-icon svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.history-kind-icon.print { background: #5a86ff; }
.history-kind-icon.boxprint { background: #5a86ff; }
.history-kind-icon.copy { background: #f59e0b; }
.history-kind-icon.scan { background: #8b5cf6; }
.history-kind-icon.fax { background: #ef4444; }
.history-kind-icon.payment { background: #a4bfff; }
.history-kind-icon.canceled { background: #ccc; }

/* 결제만 완료 (출력 대기) 카드 */
.history-card-pending {
    border-left: 3px solid #a4bfff;
}

/* 결제 취소 카드 */
.history-card-canceled {
    border-left: 3px solid #ccc;
    opacity: 0.65;
}

.history-card-canceled .history-kind-text {
    color: #999;
}

.history-card-canceled .history-item-name {
    color: #999;
    text-decoration: line-through;
}

.history-card-canceled .history-amount {
    color: #999;
    text-decoration: line-through;
}

.history-kind-text {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    flex: 1;
}

.history-date {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

/* 카드 본문 */
.history-card-body {
    padding-left: 38px;
}

.history-item-name {
    font-size: 13px;
    color: #444;
    margin-bottom: 4px;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-location {
    font-size: 12px;
    color: #999;
    margin-bottom: 0;
}

/* 카드 하단: 결제 정보 */
.history-card-footer {
    margin-top: 10px;
    padding-top: 10px;
    padding-left: 38px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-pay-method {
    font-size: 12px;
    color: #666;
}

.history-amount {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

/* 무료 사용 표시 */
.history-free-info {
    padding-left: 38px;
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-free-label {
    font-size: 11px;
    color: #5a86ff;
    font-weight: 500;
}

.history-free-discount {
    font-size: 12px;
    color: #5a86ff;
    font-weight: 600;
}

.history-original-price {
    font-size: 12px;
    color: #bbb;
    text-decoration: line-through;
    margin-left: 6px;
}

/* ── 더보기 버튼 ── */
.history-more-wrap {
    padding: 0 16px 24px;
    text-align: center;
}

.history-more-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.history-more-btn:active {
    background: #f5f5f5;
}

/* ── Empty State ── */
.history-empty {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 15px;
    color: #999;
}

/* ── Error State ── */
.history-error {
    text-align: center;
    padding: 80px 20px;
}

.error-text {
    font-size: 15px;
    color: #999;
    margin-bottom: 16px;
}

.error-retry-btn {
    padding: 10px 28px;
    border: 1px solid #5a86ff;
    border-radius: 8px;
    background: #fff;
    color: #5a86ff;
    font-size: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.error-retry-btn:active {
    background: #f0f4ff;
}

/* ── 로그인 필요 State ── */
.history-login-required {
    text-align: center;
    padding: 80px 20px;
}

.login-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
}

.login-text {
    font-size: 15px;
    color: #999;
    margin-bottom: 20px;
}

.login-btn {
    display: inline-block;
    padding: 12px 32px;
    background: #fee500;
    color: #3c1e1e;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.login-btn:active {
    background: #e6cf00;
}

/* ── 스켈레톤 로딩 ── */
.skeleton-card {
    padding: 0;
}

.skeleton-item {
    background: #fff;
    border-radius: 12px;
    padding: 20px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    margin-bottom: 10px;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-short { width: 30%; }
.skeleton-medium { width: 60%; }
.skeleton-long { width: 85%; }

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =====================================================
   취소 버튼
   ===================================================== */
.history-cancel-area {
    padding: 10px 16px 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.history-cancel-deadline {
    font-size: 12px;
    color: #aaa;
}

.history-cancel-btn {
    display: inline-block;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #e74c3c;
    background: #fff;
    border: 1px solid #e74c3c;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.history-cancel-btn:active {
    background: #e74c3c;
    color: #fff;
}

/* =====================================================
   취소 모달
   ===================================================== */
.cancel-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: background 0.2s;
}

.cancel-modal-overlay.active {
    background: rgba(0, 0, 0, 0.45);
}

.cancel-modal {
    background: #fff;
    border-radius: 16px;
    width: 88%;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.cancel-modal-overlay.active .cancel-modal {
    transform: scale(1);
    opacity: 1;
}

.cancel-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px 12px;
}

.cancel-modal-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
}

.cancel-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.cancel-modal-body {
    padding: 8px 20px 16px;
    text-align: center;
}

.cancel-modal-item-name {
    font-size: 14px;
    color: #555;
    margin: 0 0 4px;
    word-break: break-all;
}

.cancel-modal-amount {
    font-size: 16px;
    font-weight: 700;
    color: #e74c3c;
    margin: 0 0 12px;
}

.cancel-modal-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.cancel-modal-warning span {
    font-size: 13px;
    font-weight: 500;
    color: #e67e22;
}

.cancel-modal-confirm-text {
    font-size: 14px;
    color: #777;
    margin: 0;
}

.cancel-modal-footer {
    display: flex;
    border-top: 1px solid #f0f0f0;
}

.cancel-modal-btn {
    flex: 1;
    padding: 14px 0;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s;
}

.cancel-modal-btn-no {
    background: #f8f8f8;
    color: #666;
    border-right: 1px solid #f0f0f0;
    border-radius: 0 0 0 16px;
}

.cancel-modal-btn-no:active {
    background: #eee;
}

.cancel-modal-btn-yes {
    background: #fff;
    color: #e74c3c;
    border-radius: 0 0 16px 0;
}

.cancel-modal-btn-yes:active {
    background: #fef0ef;
}

.cancel-modal-btn-yes:disabled {
    color: #ccc;
    cursor: default;
}

/* =====================================================
   Toast 알림
   ===================================================== */
.history-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.history-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.history-toast-error {
    background: #e74c3c;
}

/* =====================================================
   쿠폰 등록 버튼 (summary 카드 내)
   ===================================================== */
.coupon-register-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.coupon-register-btn:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.35);
}
.coupon-register-btn svg {
    flex-shrink: 0;
}

/* =====================================================
   쿠폰 등록 모달
   ===================================================== */
.coupon-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 20px;
}
.coupon-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 340px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: couponModalIn 0.25s ease-out;
}
@keyframes couponModalIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.coupon-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f0f0f0;
}
.coupon-modal-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: #333;
}
.coupon-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.coupon-modal-body {
    padding: 20px;
}
.coupon-modal-desc {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0 0 16px;
}
.coupon-input-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.coupon-input {
    width: 80px;
    height: 48px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 4px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    color: #333;
    transition: border-color 0.2s;
}
.coupon-input:focus {
    border-color: #5a86ff;
    box-shadow: 0 0 0 3px rgba(90, 134, 255, 0.15);
}
.coupon-input-dash {
    font-size: 22px;
    font-weight: 700;
    color: #999;
}
.coupon-input-error {
    text-align: center;
    color: #e74c3c;
    font-size: 13px;
    margin: 10px 0 0;
}

/* 쿠폰 미리보기 */
.coupon-preview {
    margin-top: 16px;
    padding: 14px;
    background: #f4f8ff;
    border-radius: 10px;
    border: 1px solid #dce6f8;
}
.coupon-preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}
.coupon-preview-label {
    font-size: 13px;
    color: #666;
}
.coupon-preview-value {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}
.coupon-preview-con {
    color: #ff8c00;
    font-size: 15px;
}

/* 모달 푸터 */
.coupon-modal-footer {
    display: flex;
    gap: 8px;
    padding: 12px 20px 20px;
}
.coupon-modal-btn {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.coupon-modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.coupon-modal-btn-cancel {
    background: #f0f0f0;
    color: #666;
}
.coupon-modal-btn-cancel:active {
    background: #e0e0e0;
}
.coupon-modal-btn-submit {
    background: #5a86ff;
    color: #fff;
}
.coupon-modal-btn-submit:active:not(:disabled) {
    background: #4070e0;
}

/* 쿠폰 카드 아이콘 색상 */
.source-coupon {
    background: #ff8c00 !important;
}

.source-cs_reward,
.source-cs_grant {
    background: #6366f1 !important;
}

.source-cs_deduct {
    background: #ef4444 !important;
}

.source-admin {
    background: #475569 !important;
}

.source-event {
    background: #10b981 !important;
}

.source-etc {
    background: #94a3b8 !important;
}

/* 쿠폰 토스트 */
.coupon-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}
.coupon-toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =====================================================
   PC 레이아웃 — 400px 고정
   ===================================================== */
@media (min-width: 450px) {
    .cancel-modal-overlay {
        max-width: 400px;
        left: 50%;
        transform: translateX(-50%);
    }

    .coupon-modal-overlay {
        max-width: 400px;
        left: 50%;
        transform: translateX(-50%);
    }

    .history-toast,
    .coupon-toast {
        max-width: 400px;
    }
}
