/* ========================================
   CHATLY AI 페이지 전용 CSS
   Quiz, Life, MBTI AI 생성 페이지용
   ======================================== */

/* ========================================
   AI 페이지 전용 변수
   ======================================== */
:root {
    /* AI 페이지 전용 색상
    --ai-primary: #667eea;
    --ai-secondary: #764ba2;
    --ai-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ai-light: #f0f4ff;
    --ai-accent: #3498db; */
    /* common/chatly_ai.css */

    --ai-primary: #667eea;
    --ai-secondary: #764ba2;
    --ai-light: #f0f4ff;

    .main-layout { /* 3열 레이아웃 */ }
    .stats-section { /* 통계 섹션 */ }
    .prompt-suggestions { /* 프롬프트 제안 */ }
    }

/* ========================================
   AI 페이지 body 스타일 (기존 body 오버라이드)
   ======================================== */
body {
    background: var(--ai-gradient);
    min-height: 100vh;
    padding: 20px;
}

/* ========================================
   AI 페이지 컨테이너
   ======================================== */
.container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 1600px;
    margin: 0 auto;
}

.container h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
}

/* ========================================
   3컬럼 레이아웃
   ======================================== */
.main-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.left-column {
    width: 380px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.center-column {
    flex: 1;
    min-width: 500px;
}

.right-column {
    width: 400px;
}

/* ========================================
   통계 카드
   ======================================== */
.stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-card .stat-number {
    font-size: 2em;
    font-weight: bold;
    color: var(--ai-accent);
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* ========================================
   카테고리별 통계 (왼쪽 컬럼)
   ======================================== */
.stats-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #2c3e50;
    border-bottom: 2px solid var(--ai-accent);
    padding-bottom: 10px;
}

.category-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 5px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 5px;
}

.category-stat:hover {
    background: #e3f2fd;
    padding-left: 10px;
}

.category-stat.active {
    background: #bbdefb;
    font-weight: bold;
}

.stat-number {
    color: var(--ai-accent);
    font-weight: bold;
}

.stat-need {
    color: #e74c3c;
    font-size: 12px;
}

.stat-warning {
    color: #f39c12;
    font-size: 12px;
}

.stat-good {
    color: #27ae60;
    font-size: 12px;
}

/* ========================================
   폼 섹션
   ======================================== */
.form-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid var(--ai-accent);
    padding-bottom: 10px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.form-row label {
    font-weight: 600;
    min-width: 100px;
    color: #2c3e50;
    font-size: 14px;
}

.form-row input, .form-row select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-row input:focus, .form-row select:focus {
    outline: none;
    border-color: var(--ai-accent);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-row textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* ========================================
   키워드 입력 및 프롬프트 제안
   ======================================== */
.keyword-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.keyword-input input {
    flex: 1;
}

.prompt-suggestions {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.prompt-suggestions h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.suggestion-item {
    background: white;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestion-item:hover {
    border-color: var(--ai-accent);
    transform: translateX(5px);
}

.suggestion-item button {
    padding: 5px 10px;
    font-size: 12px;
    background: var(--ai-accent);
    color: rgb(59, 71, 109);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* ========================================
   퀴즈/콘텐츠 타입 선택
   ======================================== */
.quiz-types {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.quiz-type-option {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.3s;
}

.quiz-type-option:hover {
    border-color: var(--ai-accent);
    background: #e3f2fd;
}

.quiz-type-option input:checked + label {
    color: var(--ai-accent);
    font-weight: 600;
}

/* ========================================
   결과 섹션 (오른쪽 컬럼)
   ======================================== */
.result-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.result-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid var(--ai-accent);
    padding-bottom: 10px;
}

/* ========================================
   퀴즈/에피소드 미리보기
   ======================================== */
.quiz-preview, .episode-preview {
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
}

.quiz-header, .episode-header {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.quiz-content, .episode-content {
    line-height: 1.6;
}

.quiz-content p, .episode-content p {
    margin: 8px 0;
}

.quiz-content strong, .episode-content strong {
    color: #2c3e50;
}

.quiz-content pre, .episode-content pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
}

/* ========================================
   레벨 탭
   ======================================== */
.level-tabs {
    display: flex;
    margin-bottom: 15px;
    gap: 5px;
}

.level-tab {
    padding: 8px 15px;
    background: #ecf0f1;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.level-tab.active {
    background: var(--ai-accent);
    color: white;
}

.level-content {
    display: none;
    line-height: 1.6;
}

.level-content.active {
    display: block;
}

/* ========================================
   상태 메시지
   ======================================== */
.status-message {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.status-success {
    background: #d4edda;
    border-left: 4px solid #27ae60;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    border-left: 4px solid #e74c3c;
    color: #721c24;
}

.status-info {
    background: #d1ecf1;
    border-left: 4px solid var(--ai-accent);
    color: #0c5460;
}

/* ========================================
   로딩 인디케이터
   ======================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--ai-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   버튼 스타일 (AI 페이지 전용)
   ======================================== */
button {
    background: linear-gradient(135deg, var(--ai-accent), #2980b9);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.btn-primary {
    background: linear-gradient(135deg, #2f2b5d, #5f5b69);
}

button.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
}

button.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

button.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

/* ========================================
   반응형 디자인
   ======================================== */
@media (max-width: 1200px) {
    .main-layout {
        flex-wrap: wrap;
    }
    
    .left-column {
        width: 100%;
        position: static;
    }
    
    .right-column {
        width: 100%;
    }
    
    .center-column {
        min-width: auto;
    }
}

/* chatly_ai.css에 추가 */
.quick-generate-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.template-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.template-btn {
    background: linear-gradient(135deg, var(--ai-accent), #2980b9);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.template-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .container h1 {
        font-size: 2em;
    }
    
    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-row label {
        min-width: auto;
    }
    
    .quiz-types {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-card {
        width: 100%;
        max-width: 200px;
    }
    
    .keyword-input {
        flex-direction: column;
    }
    
    .level-tabs {
        flex-wrap: wrap;
    }
}