/**
 * HrdFlex AI Theme CSS
 * AI 과정 추천 페이지 전용 스타일
 * Date: 2025-12-11
 */

/* ========================================
   AI 검색 섹션
   ======================================== */
.ai-search-section {
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    border: 1px solid var(--border-light);
}

.ai-search-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.ai-search-header .ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1d4ed8 100%);
    color: #fff;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.ai-search-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.ai-search-header p {
    font-size: 0.875rem;
    color: var(--text-gray);
}

/* ========================================
   Rate Limit 정보
   ======================================== */
.ai-rate-info {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-gray);
    margin-bottom: var(--spacing-md);
}

.ai-rate-info .rate-count {
    font-weight: 600;
    color: var(--primary-blue);
}

.ai-rate-info.admin-mode {
    color: #059669;
}

.ai-rate-info.admin-mode .rate-count {
    color: #059669;
}

/* ========================================
   검색 폼
   ======================================== */
.ai-search-form {
    display: flex;
    align-items: stretch;
    gap: var(--spacing-sm);
    max-width: 700px;
    margin: 0 auto var(--spacing-md);
}

.ai-search-input,
.ai-search-btn {
    box-sizing: border-box;
    height: 48px;
}

.ai-search-input {
    flex: 1;
    padding: 0 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    background: #fff;
    color: rgb(33, 37, 41);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.ai-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.ai-search-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.ai-search-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   예시 태그 버튼
   ======================================== */
.ai-example-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai-example-tag {
    padding: 0.375rem 0.75rem;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 9999px;
    font-size: 0.8125rem;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.2s;
}

.ai-example-tag:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background: rgba(0, 102, 255, 0.05);
}

/* ========================================
   로딩 박스
   ======================================== */
.ai-loading-box {
    display: none;
    text-align: center;
    padding: var(--spacing-xl) 0;
}

.ai-loading-box.active {
    display: block;
}

.ai-loading-spinner {
    display: inline-flex;
    gap: 6px;
}

.ai-loading-spinner span {
    width: 8px;
    height: 8px;
    background: var(--primary-blue);
    border-radius: 50%;
    animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-loading-spinner span:nth-child(1) { animation-delay: -0.32s; }
.ai-loading-spinner span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.ai-loading-text {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-gray);
}

/* ========================================
   알림 박스 (에러/경고)
   ======================================== */
.ai-alert {
    display: none;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.ai-alert.active {
    display: block;
}

.ai-alert.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.ai-alert.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #d97706;
}

/* ========================================
   AI 결과 섹션
   ======================================== */
.ai-result-section {
    display: none;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.ai-result-section.active {
    display: block;
    animation: ai-fadeIn 0.3s ease-out;
}

@keyframes ai-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-result-label {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.ai-result-text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-dark);
    white-space: pre-wrap;
}

/* ========================================
   로그인 필요 박스
   ======================================== */
.ai-login-box {
    text-align: center;
    padding: var(--spacing-2xl);
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.ai-login-box i {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
}

.ai-login-box h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.ai-login-box p {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: var(--spacing-lg);
}

.ai-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.ai-login-btn:hover {
    background: #0052cc;
    transform: translateY(-2px);
}

/* ========================================
   AI 추천 순위 배지
   ======================================== */
.ai-rank-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-blue);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    z-index: 2;
}

/* ========================================
   과정 카드 play-button
   ======================================== */
.lecture-list .lec-img {
    position: relative;
    overflow: hidden;
}

.lecture-list .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.lecture-list:hover .play-button {
    opacity: 1;
}

.lecture-list .play-icon {
    width: 24px;
    height: 24px;
    fill: #fff;
}

/* ========================================
   과정 카드 애니메이션
   ======================================== */
.lecture-list {
    animation: ai-fadeInUp 0.4s ease-out backwards;
}

.lecture-list:nth-child(1) { animation-delay: 0.05s; }
.lecture-list:nth-child(2) { animation-delay: 0.1s; }
.lecture-list:nth-child(3) { animation-delay: 0.15s; }
.lecture-list:nth-child(4) { animation-delay: 0.2s; }
.lecture-list:nth-child(5) { animation-delay: 0.25s; }

@keyframes ai-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   좋아요/찜하기 애니메이션
   ======================================== */
.like-animation, .favorite-animation {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #ef4444;
    animation: ai-floatUp 0.8s ease-out forwards;
}

@keyframes ai-floatUp {
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* ========================================
   폼 요소 색상 오버라이드
   ======================================== */
.ai-search-section input,
.ai-search-section textarea,
.ai-search-section select {
    color: rgb(33, 37, 41);
}

/* ========================================
   반응형 디자인
   ======================================== */
@media (max-width: 768px) {
    .ai-search-form {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0 var(--spacing-sm);
    }

    .ai-search-input {
        width: auto;
        flex: 1;
        font-size: 0.875rem;
    }

    .ai-search-btn {
        width: auto;
        padding: 0 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .ai-search-header h2 {
        font-size: 1.25rem;
    }

    .ai-example-tags {
        justify-content: center;
        padding: 0 var(--spacing-sm);
    }
}

/* ========================================
   AI 도움말 모달
   ======================================== */

/* 도움말 버튼 */
.ai-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 8px;
    background: transparent;
    border: 2px solid #6c757d;
    border-radius: 50%;
    color: #6c757d;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    vertical-align: middle;
}

.ai-help-btn:hover {
    background: #0066ff;
    border-color: #0066ff;
    color: white;
    transform: scale(1.1);
}

/* 모달 오버레이 */
.ai-help-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ai-help-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* 모달 컨테이너 */
.ai-help-modal {
    background: white;
    border-radius: 20px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: aiModalSlideIn 0.3s ease;
}

@keyframes aiModalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 닫기 버튼 */
.ai-help-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    color: #495057;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.ai-help-modal-close:hover {
    background: #fff;
    color: #212529;
}

/* 모달 헤더 */
.ai-help-modal-header {
    text-align: center;
    padding: 1.5rem 1.5rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.ai-help-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #0066ff;
    border-radius: 50%;
    font-size: 24px;
    margin-bottom: 0.75rem;
    color: white;
}

.ai-help-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

.ai-help-modal-body {
    padding: 1.5rem;
}

/* 슬라이더 */
.ai-step-slider {
    position: relative;
    min-height: 280px;
}

.ai-step-slide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s ease;
    pointer-events: none;
    text-align: center;
}

.ai-step-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.ai-step-slide.prev {
    opacity: 0;
    transform: translateX(-30px);
}

.ai-step-slide > p {
    font-size: 0.95rem;
    color: #6c757d;
    margin: 0 0 1rem 0;
}

/* 슬라이드 예시 */
.ai-step-example {
    display: inline-block;
    background: #f8f9fa;
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    font-size: 1rem;
    color: #495057;
    border: 2px dashed #dee2e6;
}

/* 슬라이드 키워드 */
.ai-step-visual {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-step-visual span {
    background: #0066ff;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 슬라이드 이미지 */
.ai-step-image {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ai-step-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    max-height: 200px;
    object-fit: contain;
}

.ai-step-caption {
    font-size: 0.85rem;
    color: #868e96;
    margin: 0;
}

/* 슬라이드 결과 */
.ai-step-result {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #28a745;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
}

.ai-step-result i {
    font-size: 1.1rem;
}

/* 인디케이터 */
.ai-step-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 1.25rem 0;
}

.ai-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #dee2e6;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.ai-step-dot.active {
    background: #0066ff;
    transform: scale(1.2);
}

.ai-step-dot:hover:not(.active) {
    background: #adb5bd;
}

/* 네비게이션 버튼 */
.ai-step-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.ai-step-prev,
.ai-step-next {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ai-step-prev {
    background: #f1f3f5;
    color: #495057;
}

.ai-step-prev:hover:not(:disabled) {
    background: #e9ecef;
}

.ai-step-prev:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-step-next {
    background: #0066ff;
    color: white;
}

.ai-step-next:hover {
    background: #0052cc;
}

/* 모달 반응형 */
@media (max-width: 576px) {
    .ai-help-modal {
        max-width: 100%;
        border-radius: 16px;
    }

    .ai-step-slider {
        min-height: 260px;
    }

    .ai-step-image img {
        max-height: 160px;
    }
}