/**
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * ⚡ NanoBanana APC - Generate Tab CSS
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * 📁 파일명: _acc/css/generate_tab.css
 * 📌 버전: v2.95
 * 📅 작성일: 2025-12-25
 * 📝 설명: ★ [v2.15] result-placeholder width/height 100% 추가 (이미지 박스 가득 채우기)
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Generate 탭 컨테이너
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* ★★★ [v2.2] display:none 제거 + 배경색 통일 ★★★ */
#generateTabContent {
    padding: 24px;
    background: var(--bg, #fffbeb);  /* ★ Prompt 탭과 동일한 배경색 */
}

/* ★★★ [v2.1] ID 우선순위로 active 상태 명시 ★★★ */
#generateTabContent.active {
    display: block;
}

/* 2열 그리드 레이아웃 */
.generate-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;        /* ★★★ [v2.5] 좌우 열 독립 높이 ★★★ */
}

/* 좌측: 옵션 영역 */
.generate-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 우측: 결과 + AI Tip */
.generate-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;          /* ★★★ [v2.5] 스크롤 시 고정 ★★★ */
    top: 0;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   모델 선택
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.model-select,
.model-btn-group {
    display: flex;
    gap: 12px;
	margin-top: -18px;  /* 추가 */
}

.model-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    font-size: 0.9rem;
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.model-btn:hover {
    background: #fef3c7;
}

.model-btn.active {
    background: #fef3c7;
}

.model-btn .model-credits {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Edit/Create 서브탭
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.sub-tabs {
    display: flex;
    gap: 12px;
}

.sub-tab {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    font-size: 0.9rem;
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sub-tab:hover {
    background: #fef3c7;
}

/* 선택된 버튼 - 배경색만 변경 */
.sub-tab.active {
    background: #fef3c7;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   옵션 섹션 공통
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.option-section {
    background: var(--banana-light, #fef3c7);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--banana-border, #fde68a);
    box-sizing: border-box;            /* ★★★ [v2.4] 오버플로우 방지 ★★★ */
    overflow: hidden;                  /* ★★★ [v2.4] 내부 오버플로우 방지 ★★★ */
}

.option-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--banana-dark, #92400e);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.option-label .hint {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    font-weight: 400;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Reference Images (Edit 모드)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.reference-images,
.ref-slots {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.ref-slot {
    width: 60px;
    height: 60px;
    border: 2px dashed var(--banana-border, #fde68a);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--surface, #fffbeb);
    transition: all 0.2s;
    position: relative;  /* ★ 삭제 버튼 위치용 */
}

.ref-slot:hover {
    border-color: var(--primary, #FF6B35);
    background: var(--banana-light, #fef3c7);
}

.ref-slot i {
    color: var(--text-secondary, #6b7280);
}

.ref-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* ★★★ 삭제 버튼 스타일 ★★★ */
.ref-slot .delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #1f2937;
    border: 2px solid #374151;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.ref-slot .delete-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.ref-slot .delete-btn svg {
    width: 12px;
    height: 12px;
    color: white;
}

/* ★★★ 드래그 앤 드롭 스타일 ★★★ */
.ref-section.drag-over,
#refImageSection.drag-over {
    background: rgba(255, 107, 53, 0.1);
    border: 2px dashed var(--primary, #FF6B35);
    border-radius: 12px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Prompt 입력 영역
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.describe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.describe-header .option-label {
    margin-bottom: 0;
}

.copy-btn {
    padding: 5px 12px;
    border: 1px solid var(--banana-border, #fde68a);
    border-radius: 8px;
    background: var(--surface, #fffbeb);
    font-size: 0.75rem;
    color: var(--banana-dark, #92400e);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.copy-btn:hover {
    border-color: var(--primary, #FF6B35);
    color: var(--primary, #FF6B35);
    background: var(--banana-light, #fef3c7);
}

.prompt-textarea {
    width: 100%;
    max-width: 100%;                   /* ★★★ [v2.4] 오버플로우 방지 ★★★ */
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--banana-border, #fde68a);
    border-radius: 10px;
    font-size: 0.9rem;
    resize: vertical;
    font-family: inherit;
    background: var(--surface, #fffbeb);
    color: var(--text, #1f2937);
    box-sizing: border-box;            /* ★★★ [v2.4] 오버플로우 방지 ★★★ */
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary, #FF6B35);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Pro 전용 옵션 (Aspect Ratio, Resolution)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.pro-options {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.pro-options.visible {
    display: flex;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.opt-btn {
    flex: 1;
    padding: 10px 0;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    color: #1f2937;
}

.opt-btn:hover {
    background: #fef3c7;
}

/* 선택된 버튼 - 배경색만 변경 */
.opt-btn.active {
    background: #fef3c7;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Generate 버튼
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.generate-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent, #f59e0b), var(--primary, #FF6B35));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: auto;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.credit-cost {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   결과 영역 (바나나 아이콘 placeholder)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.result-area {
    flex: 1;
    background: linear-gradient(135deg, var(--banana-light, #fef3c7) 0%, #fff7ed 100%);
    border: 2px dashed var(--banana-border, #fde68a);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    position: relative;
    overflow: hidden;
}

.result-placeholder {
    text-align: center;
    color: var(--banana-dark, #92400e);
    /* ★★★ 중앙 정렬 - flexbox 방식 ★★★ */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.banana-icon-wrapper {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent, #f59e0b), var(--primary, #FF6B35));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.banana-icon-wrapper .banana-emoji {
    font-size: 2.5rem;
}

.result-placeholder p {
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
}

/* 생성된 이미지 */
.result-area.has-image {
    border-style: solid;
}

.result-area.has-image .result-placeholder {
    width: 100%;               /* ★★★ [v2.15] 박스 가득 채우기 ★★★ */
    height: 100%;              /* ★★★ [v2.15] 박스 가득 채우기 ★★★ */
    padding: 0;                /* ★★★ [v2.5] 패딩 제거 ★★★ */
}

.result-area .generated-image,
.result-placeholder .generated-image {
    width: 100%;
    height: 100%;
    max-height: 400px;         /* ★★★ [v2.5] 최대 높이 ★★★ */
    object-fit: cover;         /* ★★★ [v2.5] 박스 채우기 ★★★ */
    border-radius: 14px;
}

/* ★★★ [v2.2] 결과 액션 버튼 - 이미지 아래 배치 ★★★ */
.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 16px 0 8px 0;
    width: 100%;
}

/* ★★★ [v2.6] 결과 버튼 컨테이너 - 이미지 박스와 동일 넓이 ★★★ */
.result-actions-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 8px 0;
    width: 100%;
    box-sizing: border-box;
}

/* ★★★ [v2.6] 버튼 넓이 균등 분배 ★★★ */
.result-action-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ★★★ [v2.6] Edit 버튼 ★★★ */
.result-action-btn.edit {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.result-action-btn.edit:hover {
    background: #fde68a;
    border-color: #d97706;
}

.result-action-btn.download {
    background: #FF6B35;
    color: white;
    border: none;
}

.result-action-btn.download:hover {
    background: #e55a2b;
}

/* ★★★ [v2.6] My Creations 버튼 ★★★ */
.result-action-btn.mycreations {
    background: #fffbeb;
    color: #1f2937;
    border: 1px solid #fde68a;
}

.result-action-btn.mycreations:hover {
    background: #fef3c7;
    border-color: var(--banana-border, #fde68a);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   AI Tip 섹션
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.ai-tip-section {
    background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    padding: 16px;
}

.ai-tip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #059669;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.tip-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: var(--text, #1f2937);
}

.tip-row:last-child {
    margin-bottom: 0;
}

.tip-label {
    font-weight: 600;
    color: #047857;
    min-width: 70px;
}

.tip-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tip-tag {
    background: #d1fae5;
    color: #065f46;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   로딩 오버레이
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.generate-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 251, 235, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 14px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--banana-border, #fde68a);
    border-top-color: var(--primary, #FF6B35);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.generate-loading p {
    color: var(--text, #1f2937);
    font-weight: 600;
    margin: 4px 0;
}

.loading-tip {
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   비회원 안내
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.guest-notice {
    background: var(--banana-light, #fef3c7);
    border: 1px solid var(--banana-border, #fde68a);
    border-radius: 10px;
    padding: 12px 16px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
}

.guest-notice a {
    color: var(--primary, #FF6B35);
    font-weight: 600;
    text-decoration: underline;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   다크 모드
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
[data-theme="dark"] #generateTabContent {
    background: var(--bg-dark, #1f2937);
}

[data-theme="dark"] .model-btn,
[data-theme="dark"] .sub-tab,
[data-theme="dark"] .opt-btn,
[data-theme="dark"] .option-section {
    background: var(--surface-dark, #374151);
    border-color: var(--border-dark, #4b5563);
    color: var(--text-dark, #f9fafb);
}

[data-theme="dark"] .model-btn:hover,
[data-theme="dark"] .sub-tab:hover,
[data-theme="dark"] .opt-btn:hover {
    background: var(--surface-dark, #4b5563);
}

[data-theme="dark"] .model-btn.active {
    background: #fef3c7;
    color: #92400e;
}

[data-theme="dark"] .sub-tab.active {
    background: #fef3c7;
    color: #92400e;
}

[data-theme="dark"] .prompt-textarea {
    background: var(--surface-dark, #374151);
    border-color: var(--border-dark, #4b5563);
    color: var(--text-dark, #f9fafb);
}

[data-theme="dark"] .result-area {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.1), rgba(255, 247, 237, 0.05));
    border-color: var(--border-dark, #4b5563);
}

[data-theme="dark"] .generate-loading {
    background: rgba(31, 41, 55, 0.95);
}

[data-theme="dark"] .option-label {
    color: var(--accent, #f59e0b);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ★★★ [v2.12] 다크모드 AI Tip 섹션 ★★★
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
[data-theme="dark"] .ai-tip-section {
    background: linear-gradient(135deg, #ecfdf5, #f0fdf4) !important;
    border-color: #a7f3d0 !important;
}

[data-theme="dark"] .ai-tip-section .ai-tip-header {
    color: #34d399 !important;
}

[data-theme="dark"] .ai-tip-section .tip-row {
    color: #e5e7eb !important;
}

[data-theme="dark"] .ai-tip-section .tip-label {
    color: #34d399 !important;
}

[data-theme="dark"] .ai-tip-section .tip-row > span:not(.tip-label):not(.tip-tag) {
    color: #d1d5db !important;
}

[data-theme="dark"] .ai-tip-section #aiTipText {
    color: #FF6B35 !important;
}

[data-theme="dark"] .ai-tip-section .tip-tag {
    background: #2d5a45 !important;
    color: #a7f3d0 !important;
}

[data-theme="dark"] .ai-tip-section .tip-tag:hover {
    background: #34d399 !important;
    color: #1f2937 !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ★★★ [v2.9.4] 모바일 반응형 - 이미지 및 버튼 이탈 강력 수정 ★★★
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 768px) {
    #generateTabContent {
        padding: 16px;
        max-height: 80vh;
        overflow-y: auto;
        overflow-x: hidden; /* 가로 스크롤 강제 차단 */
        -webkit-overflow-scrolling: touch;
    }

    /* ⭐ [핵심1] Grid가 콘텐츠 크기에 의해 늘어나는 것을 방지 (minmax 사용) */
    .generate-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr); /* 1fr 대신 minmax(0, 1fr) 필수 */
        gap: 24px;
        width: 100%;
        box-sizing: border-box;
    }

    /* 옵션 및 결과 영역 너비 100% 강제 */
    .generate-options,
    .generate-right,
    .result-area {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0; /* Flex/Grid 아이템 축소 허용 */
        box-sizing: border-box;
    }

    .model-select {
        flex-direction: column;
        gap: 8px;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .opt-btn {
        min-width: calc(33.33% - 6px);
    }

    /* ⭐ [핵심2] 이미지가 박스를 뚫고 나가지 않도록 !important로 강제 */
    .result-area img,
    .generated-image,
    .result-placeholder .generated-image {
        width: 100% !important;      /* 가로 꽉 채우기 */
        max-width: 100% !important;  /* 한계선 설정 */
        height: auto !important;     /* 비율 유지 */
        object-fit: contain;
    }

    .reference-images {
        flex-wrap: wrap;
    }

    .ref-slot {
        width: 50px;
        height: 50px;
    }

    /* ⭐ [핵심3] 하단 버튼들이 화면 밖으로 나가는 현상 수정 */
    .result-actions,
    .result-actions-container {
        display: flex;
        flex-wrap: wrap !important; /* 공간 부족 시 줄바꿈 강제 */
        width: 100% !important;
        box-sizing: border-box;
        gap: 8px;
        justify-content: center;
    }

    /* 버튼 개별 스타일: 너무 작아지지 않으면서 공간 차지 */
    .result-action-btn {
        flex: 1 1 45%; /* 한 줄에 2개 정도 배치되도록 설정 (공간 없으면 100%) */
        min-width: 120px; /* 최소 너비 확보 */
        white-space: nowrap;
        box-sizing: border-box;
    }
}