/**
 * 컨택그 로그인 CSS v2.0 (통합 버튼 디자인)
 *
 * @version 2.0
 * @created 2025-11-08
 * @updated 2025-11-08
 *
 * 주요 변경사항:
 * - SMS 버튼 내부에 상태 통합 (스피너, 메시지, 카운트다운, 프로그레스 바)
 * - 색상 전략: 초록색(대기) → 분홍색(만료 임박 10초)
 * - 버튼 크기 증가 (안정감)
 */

/* ========================================
   탭 네비게이션
   ======================================== */
.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
}

.tab-button {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #4DB6AC;
    background-color: #f9fafb;
}

.tab-button.active {
    color: #4DB6AC;
    border-bottom-color: #4DB6AC;
}

/* ========================================
   탭 콘텐츠
   ======================================== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   컨택그 로그인 영역
   ======================================== */
.contag-login-wrapper {
    text-align: center;
    padding: 2rem 0;
}

.contag-description {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* ========================================
   QR 코드 (Desktop)
   ======================================== */
.contag-qr-section {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#qrcode {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

#qrcode canvas,
#qrcode img {
    display: block;
    margin: 0 auto;
}

.contag-qr-section p {
    color: #6b7280;
    font-size: 0.9rem;
}

/* ========================================
   통합 SMS 버튼 (Mobile)
   ======================================== */
.contag-sms-section {
    display: none;
}

/* 버튼 기본 스타일 */
#sendSmsButton {
    position: relative;
    width: 100%;
    min-height: 120px;  /* 증가된 높이 */
    padding: 1.5rem 1.5rem;
    font-size: 1.1rem;
    background: #4DB6AC;  /* 초록색 기본 */
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(77, 182, 172, 0.3);
}

#sendSmsButton:hover:not(:disabled) {
    background: #00897B;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(77, 182, 172, 0.4);
}

#sendSmsButton:active:not(:disabled) {
    transform: translateY(0);
}

#sendSmsButton:disabled {
    cursor: not-allowed;
}

/* 버튼 상태별 색상 */
#sendSmsButton.waiting {
    background: #4DB6AC;  /* 초록색 - 안정적 대기 */
    box-shadow: 0 4px 12px rgba(77, 182, 172, 0.3);
}

#sendSmsButton.urgent {
    background: #ec4899;  /* 분홍색 - 만료 임박 */
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
    animation: urgentPulse 1.5s ease-in-out infinite;
}

@keyframes urgentPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
    }
    50% {
        box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
    }
}

/* 버튼 내부 컨텐츠 */
.sms-button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

/* 메인 타이틀 (문자발송) */
.sms-button-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

/* 아이콘 + 메시지 행 */
.sms-button-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 400;
}

/* 서브타이틀 (인증을 기다리는 중) */
.sms-button-subtitle {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.95;
}

/* 스피너 */
.sms-button-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 카운트다운 텍스트 */
.sms-button-countdown {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 0.25rem;
}

/* 프로그레스 바 컨테이너 */
.sms-button-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.25rem;
}

/* 프로그레스 바 내부 */
.sms-button-progress-bar {
    height: 100%;
    background: white;
    border-radius: 3px;
    transition: width 1s linear;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ========================================
   별도 상태 표시 (Desktop QR용으로만 유지)
   ======================================== */
.contag-status {
    margin-top: 2rem;
    display: none;
}

.contag-status.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #e5e7eb;
    border-top-color: #4DB6AC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.contag-status p {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.countdown {
    font-size: 0.9rem;
    color: #ef4444;
    margin-top: 0.5rem;
    font-weight: 600;
}

/* ========================================
   에러 메시지
   ======================================== */
.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    white-space: pre-line;
}

.error-message.hidden {
    display: none;
}

/* ========================================
   성공 메시지
   ======================================== */
.success-message {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #16a34a;
}

.success-message.hidden {
    display: none;
}

/* ========================================
   반응형: Mobile (< 768px)
   ======================================== */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .contag-sms-section {
        display: block !important;
    }

    .login-tabs {
        margin-bottom: 1.5rem;
    }

    .tab-button {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    #sendSmsButton {
        min-height: 140px;  /* 모바일에서 더 크게 */
        font-size: 1rem;
    }

    .sms-button-title {
        font-size: 1.8rem;  /* 모바일에서 타이틀 더 크게 */
    }

    .sms-button-subtitle {
        font-size: 1.05rem;  /* 모바일에서 약간 크게 */
    }
}

/* ========================================
   반응형: Desktop (>= 768px)
   ======================================== */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: flex !important;
    }

    .contag-qr-section {
        display: flex !important;
    }
}

/* ========================================
   접근성 개선
   ======================================== */
.tab-button:focus {
    outline: 2px solid #4DB6AC;
    outline-offset: 2px;
}

#sendSmsButton:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 4px;
}

/* 스크린 리더 전용 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   애니메이션 효과
   ======================================== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 버튼 전환 애니메이션 */
#sendSmsButton {
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

/* ========================================
   다크 모드 대응 (선택사항)
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* 필요시 다크 모드 스타일 추가 */
}
