/* =======================================
   AI 보육일지 전용 스타일
   ======================================= */



.main-layout {
    display: flex; gap: 20px; align-items: flex-start; flex-wrap: nowrap;
}


/* --- 콘텐츠 영역 --- */
.content-area { flex: 1; min-width: 0; }
.card { background: white; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); padding: 24px; }

/* --- 버튼 공통 --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: 2px solid #eee; border-radius: var(--radius);
    background: white; font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.btn:hover { border-color: var(--accent-green); background: rgba(168,224,99,0.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-green); color: white; border-color: var(--accent-green); }
.btn-primary:hover { background: #96d454; }
.btn-primary:disabled { background: #ccc; border-color: #ccc; }
.w-100 { width: 100%; }

/* --- API Key 영역 --- */
.diary-api-section {
    background: var(--bg-light); border-radius: var(--radius); padding: 20px;
    margin-bottom: 20px; border: 2px dashed var(--border-color); text-align: center;
}
.api-status {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
    border-radius: 20px; font-size: 0.9rem; font-weight: 600; margin-bottom: 12px;
}
.api-status.connected { background: rgba(168,224,99,0.2); color: #56ab2f; }
.api-status.disconnected { background: rgba(255,71,87,0.1); color: #ff4757; }
.diary-api-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.diary-api-buttons .btn { padding: 8px 16px; font-size: 0.9rem; border-radius: 20px; }

/* --- 데모 배너 --- */
.diary-demo-banner {
    background: linear-gradient(135deg, #fff9e6, #fff3cc); border: 2px solid #ffe082;
    border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
    text-align: center; cursor: pointer; transition: all 0.3s;
}
.diary-demo-banner:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,193,7,0.2); }
.demo-placeholder { background: #fff; border-radius: 12px; padding: 40px 20px; margin-bottom: 12px; color: #999; border: 1px dashed #ddd; }

/* --- 2단 에디터 레이아웃 --- */
.diary-editor-layout { display: flex; gap: 20px; align-items: stretch; min-height: 500px; }

/* --- 채팅 영역 --- */
.diary-chat-section {
    flex: 1; min-width: 280px; display: flex; flex-direction: column;
    background: white; border-radius: 20px; border: 2px solid #eee; overflow: hidden;
}
.diary-chat-header {
    background: linear-gradient(135deg, #a8e063, #56ab2f); color: white;
    padding: 14px 20px; font-weight: 700; font-size: 1rem;
    display: flex; align-items: center; gap: 8px;
}
.diary-chat-messages {
    flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column;
    gap: 12px; min-height: 200px; max-height: 400px; background: #fafafa;
}

/* 말풍선 */
.chat-bubble {
    max-width: 85%; padding: 12px 16px; border-radius: 18px;
    font-size: 0.95rem; line-height: 1.5; word-break: break-word;
    animation: bubbleIn 0.3s ease;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-bubble.user { background: var(--accent-green); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-bubble.ai { background: white; color: var(--text-dark); align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid #eee; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.chat-bubble.ai .ai-label { font-size: 0.75rem; color: #999; margin-bottom: 4px; font-weight: 600; }

/* 타이핑 인디케이터 */
.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; align-self: flex-start; }
.typing-indicator span { width: 8px; height: 8px; border-radius: 50%; background: #ccc; animation: typingBounce 1.4s infinite ease-in-out; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,80%,100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* --- 마법의 버튼 --- */
.diary-magic-buttons { padding: 12px 16px; border-top: 1px solid #eee; border-bottom: 1px solid #eee; background: #fff; display: flex; flex-wrap: wrap; gap: 6px; }
.magic-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px;
    border-radius: 20px; border: 1.5px solid #e0e0e0; background: white;
    font-size: 0.82rem; font-weight: 600; color: #555; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.magic-btn:hover { border-color: var(--accent-green); background: rgba(168,224,99,0.1); color: #333; transform: translateY(-1px); }
.magic-btn.active { border-color: var(--accent-green); background: rgba(168,224,99,0.2); color: #2d7a0e; }

/* --- 입력 영역 --- */
.diary-chat-input { display: flex; gap: 8px; padding: 12px 16px; background: white; align-items: flex-end; }
.diary-chat-input textarea {
    flex: 1; border: 2px solid #eee; border-radius: 16px; padding: 10px 14px;
    font-size: 0.95rem; font-family: inherit; resize: none;
    min-height: 42px; max-height: 120px; outline: none; transition: border-color 0.2s; line-height: 1.4;
}
.diary-chat-input textarea:focus { border-color: var(--accent-green); }
.send-btn, .voice-btn {
    width: 42px; height: 42px; border-radius: 50%; border: none;
    font-size: 1.2rem; cursor: pointer; transition: all 0.2s; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.send-btn { background: var(--accent-green); color: white; }
.send-btn:hover { background: #56ab2f; transform: scale(1.05); }
.send-btn:disabled { background: #ddd !important; cursor: not-allowed; }
.voice-btn { background: white; border: 2px solid #eee !important; }
.voice-btn:hover { border-color: #ff6b6b !important; }
.voice-btn.recording { border-color: #ff4757 !important; background: rgba(255,71,87,0.1); animation: voicePulse 1s infinite; }
@keyframes voicePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,71,87,0.4); } 50% { box-shadow: 0 0 0 8px rgba(255,71,87,0); } }

/* --- 문서 영역 --- */
.diary-doc-section {
    flex: 1.2; min-width: 300px; display: flex; flex-direction: column;
    background: white; border-radius: 20px; border: 2px solid #eee; overflow: hidden;
}
.diary-doc-header {
    background: linear-gradient(135deg, #667eea, #764ba2); color: white;
    padding: 14px 20px; font-weight: 700; font-size: 1rem;
    display: flex; align-items: center; justify-content: space-between;
}
.diary-category-tabs {
    display: flex; border-bottom: 2px solid #eee; background: var(--bg-light);
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.diary-category-tabs::-webkit-scrollbar { display: none; }
.diary-cat-btn {
    flex: 0 0 auto; padding: 10px 12px; border: none; background: transparent;
    font-size: 0.82rem; font-weight: 600; color: #999; cursor: pointer;
    transition: all 0.2s; white-space: nowrap; border-bottom: 3px solid transparent;
}
.diary-cat-btn:hover { color: #555; background: rgba(102,126,234,0.05); }
.diary-cat-btn.active { color: var(--accent-purple); border-bottom-color: var(--accent-purple); background: white; }

.diary-doc-body { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 10px; }
.diary-doc-body textarea {
    flex: 1; width: 100%; min-height: 250px; border: 2px solid #eee; border-radius: 12px;
    padding: 14px; font-size: 0.95rem; font-family: inherit; line-height: 1.7;
    resize: vertical; outline: none; transition: border-color 0.2s;
}
.diary-doc-body textarea:focus { border-color: var(--accent-purple); }
.diary-autosave-note { font-size: 0.75rem; color: #bbb; text-align: right; padding: 0 4px; font-style: italic; }
.diary-doc-actions { padding: 12px 16px; border-top: 1px solid #eee; background: var(--bg-light); }

/* --- 모달 --- */
.diary-modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 10000;
    justify-content: center; align-items: center;
}
.diary-modal-overlay.show { display: flex; }
.diary-modal {
    background: white; border-radius: 20px; padding: 30px; max-width: 500px; width: 90%;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalSlideUp 0.3s ease;
}
@keyframes modalSlideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.diary-modal h3 { font-size: 1.3rem; margin-bottom: 20px; text-align: center; }
.modal-close { float: right; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #999; padding: 0; line-height: 1; }
.modal-close:hover { color: #333; }

.activity-category { margin-bottom: 16px; }
.activity-category h4 { font-size: 0.95rem; color: var(--accent-purple); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #eee; }
.activity-list { display: flex; flex-wrap: wrap; gap: 6px; }
.activity-chip { padding: 6px 12px; border-radius: 20px; border: 1.5px solid #e0e0e0; background: white; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; }
.activity-chip:hover { border-color: var(--accent-purple); background: rgba(102,126,234,0.1); }
.activity-chip.selected { border-color: var(--accent-purple); background: var(--accent-purple); color: white; }

.tutorial-step { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; padding: 12px; background: var(--bg-light); border-radius: 12px; }
.tutorial-step .step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-green); color: white; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.9rem; }
.tutorial-step .step-text { font-size: 0.9rem; line-height: 1.5; color: #444; }

/* --- Toast --- */
.toast-notification {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0,0,0,0.8); color: white; padding: 14px 28px;
    border-radius: 12px; font-size: 1rem; font-weight: 600; z-index: 99999;
    pointer-events: none; opacity: 0; transition: all 0.2s ease;
}
.toast-notification.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* --- TEST 배너 --- */
@keyframes testPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.01); box-shadow: 0 6px 20px rgba(255,107,107,0.6); } }

/* --- 체크리스트 테이블 --- */
#checklist-table th, #checklist-table td { border: 1px solid #e0e0e0; }
#checklist-table td { padding: 8px; text-align: center; vertical-align: middle; }
.name-input {
    width: 100%; max-width: 80px; padding: 6px; border: 1px solid transparent; border-radius: 6px; 
    text-align: center; outline: none; transition: all 0.2s; background: transparent; font-weight: 600;
}
.name-input:focus, .name-input:not(:placeholder-shown) { border-color: #ddd; background: white; }
.name-input:focus { border-color: var(--accent-green); }
.remark-input {
    width: 100%; padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; 
    outline: none; transition: all 0.2s; text-align: left; background: transparent;
}
.remark-input:focus, .remark-input:not(:placeholder-shown) { border-color: #ddd; background: white; }
.remark-input:focus { border-color: var(--accent-green); }
.check-cell { width: 80px; }
.activity-cb { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent-green); }


/* --- 반응형 --- */
@media (max-width: 1200px) {
    .main-layout { flex-wrap: wrap; }
}
@media (max-width: 992px) {
    .diary-editor-layout { flex-direction: column; }
    .diary-chat-section, .diary-doc-section { min-width: 0; width: 100%; }
    .diary-chat-messages { max-height: 300px; }
}
@media (max-width: 600px) {
    .diary-magic-buttons { gap: 4px; }
    .magic-btn { font-size: 0.78rem; padding: 5px 10px; }
    .diary-cat-btn { font-size: 0.78rem; padding: 8px 6px; }
    .diary-api-buttons { flex-direction: column; align-items: stretch; }
    .header-section h1 { font-size: 1.4rem; }
}
