/* 🌟 무료 웹 폰트 'Pretendard' 적용 */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root { color-scheme: light; }

* { 
    box-sizing: border-box; margin: 0; padding: 0; 
    font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif; 
    -webkit-tap-highlight-color: transparent !important; 
}

body { background-color: #f7f9fc; color: #1d1d1f; padding: 20px; -webkit-user-select: none; user-select: none; }

input, textarea { 
    -webkit-user-select: text; user-select: text; padding: 14px; 
    border: 1.5px solid #e1e4e8; border-radius: 12px; font-size: 15px; 
    width: 100%; transition: all 0.2s ease; 
    background-color: #ffffff !important; color: #1d1d1f !important; color-scheme: light;
}
input:focus, textarea:focus { outline: none; border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15); }

select {
    padding: 14px; border: 1.5px solid #e1e4e8; border-radius: 12px; font-size: 15px; width: 100%;
    background-color: #ffffff !important; color: #1d1d1f !important; color-scheme: light;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 15px center; background-size: 16px; padding-right: 40px;
    transition: none !important;
}
select:focus { outline: none; border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15); }
select option { background-color: #ffffff !important; color: #1d1d1f !important; }

.container { max-width: 1100px; margin: 0 auto; position: relative; overflow-x: hidden; width: 95%; }
header { text-align: center; margin-bottom: 20px; }
h1 { color: #111827; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.3; }
.subtitle { color: #6b7280; margin-top: 8px; font-size: 15px; font-weight: 500; }

.card { background: white; padding: 24px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.04); border: 1px solid #f1f3f5; margin-bottom: 20px; }
.card:last-child { margin-bottom: 0; }
.hidden { display: none !important; }

.notice-card { background-color: #fffbeb; border: 1px solid #fde68a; margin-bottom: 20px; transition: all 0.3s ease; }
.notice-card li { margin-bottom: 6px; }

.form-group { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
.form-group.inline { display: flex; flex-direction: row; gap: 10px; align-items: center; }
.form-group.inline > input, .form-group.inline > select { flex: 1; min-width: 0; }
.form-group.inline > button { flex-shrink: 0; white-space: nowrap; }

button { 
    display: inline-flex; justify-content: center; align-items: center; text-align: center;
    padding: 14px 20px; background-color: #10b981; color: white; border: none; border-radius: 12px; 
    font-weight: 600; cursor: pointer; transition: all 0.2s ease; font-size: 15px; 
    line-height: 1.4; white-space: nowrap; word-break: keep-all;
}
button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }
button:disabled { background-color: #d1d5db; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background-color: #4361ee; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2); }
.btn-danger { background-color: #ef4444; }
.btn-danger:hover { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn-outline { background: transparent; color: #4361ee; border: 1.5px solid #4361ee; }

.auction-layout { 
    display: grid; 
    grid-template-columns: 1.4fr 1.1fr; 
    gap: 20px; 
    align-items: stretch;
    width: 100%;
}
/* 좌우 컬럼 기본 뼈대 */
.left-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.right-col { display: flex; flex-direction: column; gap: 15px; min-width: 0; height: auto; min-height: 100%; }

.left-col .card, .right-col .card { margin-bottom: 0; display: flex; flex-direction: column; min-height: 0; }
.left-col .card { flex: 1; }

.right-col .card { flex: 0 0 auto !important; min-height: 0; overflow: visible; }

.slider-container { position: relative; width: 100%; height: auto; aspect-ratio: 4/3; background-color: #f8fafc; border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; border: 1px solid #e2e8f0; }
#main-slider-image { width: 100%; height: 100%; object-fit: contain; cursor: pointer; transition: opacity 0.2s ease; }
.slider-counter { position: absolute; bottom: 15px; right: 15px; background: rgba(0,0,0,0.6); color: white; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; pointer-events: none; }
.thumbnail-gallery { display: flex; gap: 12px; margin-top: 15px; overflow-x: auto; padding-bottom: 8px; }
.thumbnail-gallery img { height: 65px; width: 85px; object-fit: cover; border-radius: 10px; cursor: pointer; opacity: 0.5; transition: 0.2s; border: 2px solid transparent; }
.thumbnail-gallery img:hover { opacity: 0.8; }
.thumbnail-gallery img.active { border-color: #4361ee; opacity: 1; }

.spec-tags { display: flex; gap: 8px; justify-content: center; margin: 15px 0 10px; flex-wrap: wrap; }
.tag { background: #fef3c7; color: #d97706; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; }
.tag.sex { background: #dcfce7; color: #15803d; }
.tag.weight { background: #fee2e2; color: #b91c1c; }

.timer-box { text-align: center; background: #1e293b; color: #fbbf24; padding: 16px; border-radius: 14px; font-size: 22px; font-weight: 800; margin-bottom: 20px; animation: pulse 2s infinite; box-shadow: 0 4px 15px rgba(0,0,0,0.1); line-height: 1.4; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(251, 191, 36, 0); } 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); } }

/* 🔑 [카카오 로그인] authorize() 리다이렉트로 돌아온 뒤 서버 왕복(토큰 교환 등)에 몇 초 걸리는데,
   페이지가 새로 로드된 직후라 버튼의 "처리 중" 표시가 남아있지 않다 — 별도 전체화면 오버레이로
   그 사이 시간에도 "로그인 중"임을 알려준다. */
@keyframes spin { to { transform: rotate(360deg); } }

/* 💌 안읽은 쪽지 배지: 숫자 표기 + 반짝임(펄스)으로 눈에 띄게 강조 */
.dm-badge-pulse { animation: dmBadgePulse 1.4s ease-in-out infinite; }
@keyframes dmBadgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    50% { transform: scale(1.15); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

/* 🔴 종료 10초 전 카운트다운 오버레이: 실시간 입찰하기 패널 최상단에 붙어, 모바일 하단 고정 입찰바와 함께 항상 노출됨 */
.countdown-overlay { display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, #7f1d1d, #dc2626); border-radius: 12px; padding: 8px 14px; margin-bottom: 14px; animation: countdownGlow 1s ease-in-out infinite; }
.countdown-overlay .countdown-number { font-size: 40px; font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 0 10px rgba(255,255,255,0.85), 0 0 22px rgba(239,68,68,0.9); display: inline-block; min-width: 34px; text-align: center; }
.countdown-overlay .countdown-number.countdown-pop { animation: countdownPop 0.5s cubic-bezier(.2,1.6,.4,1); }
.countdown-overlay .countdown-label { font-size: 14px; font-weight: 800; letter-spacing: 0.5px; color: #fff; white-space: nowrap; }
.countdown-overlay .countdown-price-box { display: none; } /* 데스크톱의 작은 배너에서는 화면이 안 가려지므로 안 띄움 */
@keyframes countdownPop { 0% { transform: scale(2.2); opacity: 0; } 55% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes countdownGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); } 50% { box-shadow: 0 0 18px 4px rgba(239,68,68,0.85); } }

/* 실시간 입찰하기 패널 전체를 은은하게 붉은 테두리로 강조 (레이아웃에 영향 없는 outline 사용, 버튼 탭 방해 없음) */
#bid-panel.bid-panel-urgent { outline: 3px solid #ef4444; outline-offset: -3px; animation: bidPanelUrgentPulse 1s ease-in-out infinite; }
@keyframes bidPanelUrgentPulse { 0%, 100% { outline-color: rgba(239,68,68,0.45); } 50% { outline-color: rgba(239,68,68,1); } }

.price-board { display: flex; flex-direction: column; gap: 12px; background: #f8fafc; padding: 20px; border-radius: 16px; border: 1px solid #e2e8f0; border-left: 6px solid #4361ee; margin-top: 20px; }
.price-block { display: flex; justify-content: space-between; align-items: center; background: white; padding: 16px 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.price-block .label { margin-bottom: 0; font-size: 15px; font-weight: 600; color: #64748b; text-align: left; }
.price-block .price { font-size: 24px; font-weight: 800; color: #f97316; }
.price-block .sub-price { font-size: 18px; font-weight: 700; color: #475569; }
.price-block .bidder { font-size: 18px; font-weight: 800; color: #4361ee; }

.quick-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 15px; margin-bottom: 15px; }
.quick-buttons button { background-color: #eff6ff; color: #3b82f6; border: 1px solid #bfdbfe; padding: 16px 5px; font-size: 15px; font-weight: 700; border-radius: 12px; }

.bottom-section { display: flex; gap: 25px; margin-top: 25px; }
.half { flex: 1; min-width: 0; }

/* 입찰 내역과 채팅창이 PC에서도 늘어나지 않게 고정 높이 적용 */
.log-list { 
    list-style: none; 
    height: 280px; /* 💡 PC에서 보여질 적당한 고정 높이 (원하시면 숫자를 조절하세요) */
    min-height: 0; 
    overflow-y: auto; 
    flex: none !important; /* 💡 핵심: 부모를 따라 강제로 늘어나는 현상 차단 */
    background: #f8fafc; 
    padding: 12px; 
    border-radius: 12px; 
    border: 1px solid #e2e8f0; 
    margin-top: 15px; 
    
    /* 모바일 스크롤 씹힘 방지 코드 유지 */
    -webkit-overflow-scrolling: touch; 
    touch-action: pan-y; 
    overscroll-behavior: contain; 
}
.log-list li { padding: 12px; border-bottom: 1px solid #f1f5f9; font-size: 14.5px; display: flex; justify-content: space-between; align-items: center; color: #334155; }
.admin-chat { background-color: #fffbeb !important; border-left: 4px solid #f59e0b; color: #b45309; font-weight: 700; border-radius: 4px; }

.modal { position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.9); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-content { max-width: 95%; max-height: 95%; object-fit: contain; border-radius: 12px; }
.close-modal { position: absolute; top: 25px; right: 35px; color: white; font-size: 45px; cursor: pointer; }

#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #ef4444; color: white; padding: 12px 24px; border-radius: 30px; font-weight: bold; font-size: 15px; box-shadow: 0 4px 12px rgba(239,68,68,0.4); opacity: 0; transform: translateY(-20px); transition: all 0.3s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) { .auction-layout { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    body { padding: 12px; }
    .auction-layout, .bottom-section { grid-template-columns: 1fr; display: flex; flex-direction: column; gap: 15px; height: auto; }
    .left-col, .right-col { height: auto; display: flex; flex-direction: column; gap: 15px; }
    .left-col .card, .right-col .card { flex: none !important; margin-bottom: 0; }
    .slider-container { height: 280px; border-radius: 12px; }
    .timer-box { font-size: 18px; padding: 14px; }
    .price-board { padding: 16px; border-radius: 12px; }
    .price-block { padding: 14px 16px; border-radius: 10px; }
    .price-block .label { font-size: 14px; }
    .price-block .price { font-size: 20px; }
    .price-block .sub-price, .price-block .bidder { font-size: 16px; }
    .quick-buttons { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .quick-buttons button { padding: 14px 0; font-size: 14px; border-radius: 10px; }
    .right-col .log-list { height: 200px; flex: none; }
}

/* =========================================================
   📱 [모바일 세팅] 갤럭시 S24 울트라 등 안드로이드 세로 화면(≤430px) 기준 튜닝
   - 펀치홀/커브드 엣지 화면의 상하 안전영역(safe-area) 확보
   - 입력창 글씨 16px 이상: 안드로이드/iOS 모두 포커스 시 자동 확대(줌) 방지
   - 입찰 버튼 영역을 화면 하단에 고정해 엄지로 바로 누르기 쉽게 구성
   ========================================================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    overscroll-behavior-y: contain; /* 실시간 시세 보는 중 당겨서 새로고침 오작동 방지 */
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}
input, textarea, select { font-size: 16px !important; } /* 자동 확대(줌) 방지 */

@media (max-width: 480px) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        /* 하단 고정 입찰바(제목+빠른입찰 버튼+직접입력) 높이만큼 본문이 가려지지 않도록 여유있게 확보 */
        padding-bottom: calc(210px + env(safe-area-inset-bottom));
    }
    h1 { font-size: 22px; }
    .subtitle { font-size: 13px; }
    .card { padding: 16px; border-radius: 16px; }
    .timer-box { font-size: 16px; padding: 12px; letter-spacing: -0.5px; }
    .price-block .price { font-size: 19px; }

    /* 💡 입찰 패널을 화면 하단에 고정해서, 한 손(엄지)으로 스크롤 없이 바로 입찰할 수 있게 함 */
    #bid-panel {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 500;
        margin: 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
        padding: 12px 14px max(12px, env(safe-area-inset-bottom));
        max-height: 45vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #bid-panel .quick-buttons { margin-top: 10px; margin-bottom: 10px; }
    #bid-panel button { padding: 16px 20px; font-size: 16px; } /* 터치 타깃 44px 이상 확보 */

    /* 🔥 [3차 조정] 모바일 종료 10초 카운트다운 — 1차(빨간 배경 화면 전체)는 뒤가 안 보인다는
       피드백으로 배경을 완전히 뺐었는데, 2차(완전 투명 + 그라디언트 텍스트)는 이번엔 배경이
       매번 달라져 숫자/현재가가 선명하지 않다는 피드백을 받았다. 그 중간으로: 화면 전체가 아닌
       위쪽 2/3만 반투명 어두운 배경을 깔아 대비를 확보하고(아래 1/3, 이미 불투명한 #bid-panel이
       차지하는 영역은 그대로 열어둠), 숫자는 그라디언트 텍스트 대신 흰색 단색 + 굵은 테두리로
       바꿔 선명도를 올렸다. 번쩍임도 부드러운 pulse 대신 급격한 on/off 플래시로 바꿨다. */
    .countdown-overlay {
        position: fixed;
        left: 0; right: 0; top: 0;
        height: 66vh;
        z-index: 499;
        margin: 0;
        border-radius: 0 0 32px 32px;
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        padding: 0 20px;
        background: radial-gradient(ellipse at 50% 45%, rgba(153,27,27,0.82), rgba(69,10,10,0.78) 65%, rgba(69,10,10,0) 100%);
        pointer-events: none;
        animation: countdownFlash 0.5s steps(1, end) infinite;
    }
    .countdown-overlay .countdown-number {
        font-size: min(34vw, 170px);
        color: #fff;
        -webkit-text-stroke: 3px #7f1d1d;
        text-stroke: 3px #7f1d1d;
        text-shadow: 0 0 14px rgba(255,255,255,0.9), 0 0 34px rgba(239,68,68,1), 0 3px 8px rgba(0,0,0,0.5);
    }
    .countdown-overlay .countdown-label {
        font-size: 20px;
        font-weight: 900;
        color: #fff;
        background: rgba(127,29,29,0.85);
        padding: 3px 12px;
        border-radius: 20px;
    }
    /* 💡 최고 입찰가는 재입찰 금액을 정하는 데 바로 필요한 정보라, 불투명도를 높이고 글씨도
       키워 배경이 어떻든 확실히 읽히게 한다 */
    .countdown-overlay .countdown-price-box {
        display: block;
        pointer-events: auto;
        margin-top: 6px;
        font-size: 16px;
        font-weight: 700;
        color: #fff;
        text-align: center;
        background: rgba(15,23,42,0.88);
        padding: 9px 18px;
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.15);
    }
    .countdown-overlay #countdown-price { font-size: 24px; font-weight: 900; color: #fff; }
    .countdown-overlay .countdown-bidder { margin-top: 2px; font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.9); }
    @keyframes countdownFlash {
        0%, 49% { filter: brightness(1); }
        50%, 100% { filter: brightness(1.35) saturate(1.2); }
    }
}

