/* AITalk - 커스텀 CSS */

/* 기본 스타일 */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* 토스트 알림 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 360px;
}
.toast-success { background: #10B981; }
.toast-error { background: #EF4444; }
.toast-info { background: #6366F1; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 마이크 녹음 인디케이터 */
.recording-indicator {
    width: 12px;
    height: 12px;
    background: #EF4444;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* 마이크 버튼 */
.mic-button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}
.mic-button:active,
.mic-button.recording {
    background: linear-gradient(135deg, #EF4444, #F97316);
    transform: scale(0.95);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* 채팅 메시지 */
.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    margin-bottom: 8px;
    word-break: break-word;
    font-size: 15px;
    line-height: 1.5;
}
.chat-message.user {
    background: #6366F1;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.chat-message.ai {
    background: #F3F4F6;
    color: #1F2937;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}
.chat-message.system {
    background: #FEF3C7;
    color: #92400E;
    margin: 0 auto;
    text-align: center;
    font-size: 13px;
    max-width: 90%;
}

/* 아바타 컨테이너 */
.avatar-container {
    width: 100%;
    aspect-ratio: 3/4;
    max-height: 400px;
    background: linear-gradient(180deg, #E0E7FF 0%, #C7D2FE 100%);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-container .avatar-placeholder {
    font-size: 80px;
    opacity: 0.6;
}

/* 타이핑 인디케이터 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-4px); }
}

/* 캐릭터 카드 */
.character-card {
    transition: all 0.3s;
    cursor: pointer;
}
.character-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}
.character-card.locked {
    opacity: 0.6;
    filter: grayscale(0.3);
}
.character-card.selected {
    ring: 3px;
    ring-color: #6366F1;
    border-color: #6366F1;
}

/* 시나리오 카드 */
.scenario-card {
    transition: all 0.3s;
    cursor: pointer;
}
.scenario-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

/* 스트릭 불꽃 */
.streak-fire {
    animation: flicker 0.5s infinite alternate;
}
@keyframes flicker {
    from { transform: scale(1) rotate(-2deg); }
    to { transform: scale(1.1) rotate(2deg); }
}

/* 프로그레스 바 */
.progress-bar {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366F1, #8B5CF6);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* 로딩 스피너 */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E5E7EB;
    border-top-color: #6366F1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 학습 힌트 배지 */
.hint-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #FEF3C7;
    color: #92400E;
    border-radius: 12px;
    font-size: 12px;
}

/* 모바일 하단 탭 네비 */
.safe-area-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 모바일 전용 */
@media (max-width: 768px) {
    .mic-button {
        width: 64px;
        height: 64px;
    }
    .chat-message {
        max-width: 90%;
        font-size: 14px;
    }
    .avatar-container {
        max-height: 280px;
    }

    /* 하단 탭 바 터치 타겟 최적화 */
    .safe-area-bottom-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 참여자 바 (그룹 채팅) */
.participant-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}
.participant-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
}
.participant-avatar.speaking {
    border: 3px solid #10B981;
    animation: pulse 1s infinite;
}
.participant-avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    background: #10B981;
}
