/* ===== AI 圖片生成器樣式 ===== */

/* 隱藏上傳區域相關元素（已改為由 AI 陪伴按鈕預填） */
.ai-form-section:has(#ai-file-upload-area),
#ai-upload-section,
#ai-file-upload-area,
.file-upload-area,
.upload-prompt,
.photo-preview,
.btn-change-photo {
    display: none !important;
}

/* Modal 容器 */
.ai-generate-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100001;
    display: none;
}

.ai-generate-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.ai-generate-container {
    background: var(--white);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.3s ease-out;
}

/* Header */
.ai-generate-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    flex-shrink: 0;
}

.ai-generate-header .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-close-ai-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-close-ai-modal:hover {
    background: var(--primary);
    color: var(--white);
}

.header-title {
    flex: 1;
    text-align: center;
}

.header-title h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-subtitle i {
    color: var(--primary);
}

.header-spacer {
    width: 36px;
}

/* Content */
.ai-generate-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Form Section */
.ai-form-section {
    margin-bottom: 1.5rem;
}

/* 簡化版面：提示詞區塊不需要額外上邊距 */
.ai-form-section .prompt-input-wrapper {
    margin-top: 0;
}

/* 測試限制提示橫幅 */
.ai-limit-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.1));
    border-left: 3px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.ai-limit-notice .notice-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 193, 7, 0.15);
}

.ai-limit-notice .notice-icon i {
    color: #ffc107;
    font-size: 1rem;
}

.ai-limit-notice .notice-content {
    flex: 1;
}

.ai-limit-notice .notice-content strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #f57c00;
    margin-bottom: 0.2rem;
}

.ai-limit-notice .notice-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* 使用統計樣式 */
.ai-limit-notice .notice-content #ai-usage-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.ai-limit-notice .notice-content #ai-usage-count {
    font-weight: 600;
}

/* 限制提示的動態樣式會在 JavaScript 中根據狀態設置 */
.ai-limit-notice {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ai-form-section .section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-form-section .section-header i {
    color: var(--primary);
    font-size: 1.1rem;
}

.ai-form-section .section-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.required-mark {
    color: var(--error);
    font-weight: bold;
}

.hint-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: normal;
}

/* 檔案上傳區域 - 已註釋，因已移除上傳功能 */
/*
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-primary);
}

.upload-prompt {
    display: block;
}

.upload-prompt i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.upload-prompt p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.upload-prompt span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: block;
}

.photo-preview {
    display: none;
    flex-direction: column;
    align-items: center;
}

.photo-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.btn-change-photo {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-change-photo:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
*/

/* 風格選項（替換原有的模板樣式） */
/* 舊的大型風格選項（已棄用） */
.ai-style-options {
    display: none !important;
}

.style-option {
    display: none !important;
}

/* 快速風格選項（罐頭訊息樣式） */
.quick-style-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.quick-style-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-style-btn:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.15);
}

.quick-style-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.quick-style-btn i {
    font-size: 0.9rem;
}

.quick-style-btn.selected i {
    color: var(--white);
}

/* Prompt Input */
.prompt-input-wrapper {
    position: relative;
}

.prompt-input-wrapper textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
}

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

/* AI Modal 中的字數計數器 - 透明背景靠右 */
.ai-generate-modal .char-counter,
.ai-form-section .char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    background: transparent !important;
    display: flex;
    justify-content: flex-end;
    padding: 0.25rem 0;
    border-radius: 0;
    box-shadow: none;
}

/* Generate Button */
.btn-generate {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn-generate:active {
    transform: translateY(0);
}

/* Loading State for Generate Button */
.btn-generate.btn-loading {
    cursor: not-allowed;
    opacity: 0.8;
    pointer-events: none;
    background: var(--text-secondary);
}

.btn-generate.btn-loading:hover {
    transform: none;
    box-shadow: 0 4px 16px rgba(108, 117, 125, 0.3);
}

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

/* Loading State */
.ai-loading-state {
    display: none;
    text-align: center;
    padding: 3rem 1rem;
    position: relative;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
}

.spinner-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 5px solid transparent;
    border-radius: 50%;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #667eea 0%, #FF6B6B 25%, #764ba2 50%, #4facfe 75%, #667eea 100%) border-box;
    animation: spin 1.5s linear infinite;
}

.pet-image-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 66px;
    height: 66px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: var(--white);
}

#loading-pet-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.loading-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--primary);
    animation: pulse 1.5s ease-in-out infinite;
    z-index: 1;
}

.loading-text {
    max-width: 400px;
    margin: 0 auto;
}

.loading-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.loading-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(
        90deg,
        #667eea 0%,
        #FF6B6B 25%,
        #764ba2 50%,
        #667eea 75%,
        #FF6B6B 100%
    );
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-flow 3s linear infinite;
}

.loading-title.gradient-text {
    font-weight: 700;
}

.loading-subtitle.gradient-text {
    opacity: 0.9;
}

/* Loading Particles */
.loading-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.8), rgba(102, 126, 234, 0));
    border-radius: 50%;
    animation: float 5s ease-in-out infinite, twinkle 2s ease-in-out infinite;
}

/* 為每個粒子設置不同的位置、大小、延遲和持續時間 */
.particle:nth-child(1) {
    left: 10%;
    top: 20%;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.9), rgba(102, 126, 234, 0));
    animation-duration: 6s, 2.5s;
    animation-delay: 0s, 0.2s;
}

.particle:nth-child(2) {
    left: 25%;
    top: 60%;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.8), rgba(255, 107, 107, 0));
    animation-duration: 7s, 3s;
    animation-delay: 0.5s, 0.8s;
}

.particle:nth-child(3) {
    left: 70%;
    top: 30%;
    width: 3px;
    height: 3px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.9), rgba(118, 75, 162, 0));
    animation-duration: 5.5s, 2.2s;
    animation-delay: 1s, 0.5s;
}

.particle:nth-child(4) {
    left: 85%;
    top: 70%;
    width: 7px;
    height: 7px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.7), rgba(102, 126, 234, 0));
    animation-duration: 8s, 3.5s;
    animation-delay: 0.3s, 1s;
}

.particle:nth-child(5) {
    left: 15%;
    top: 80%;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.9), rgba(255, 107, 107, 0));
    animation-duration: 6.5s, 2.8s;
    animation-delay: 1.5s, 0.3s;
}

.particle:nth-child(6) {
    left: 50%;
    top: 15%;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.8), rgba(118, 75, 162, 0));
    animation-duration: 7.5s, 2.6s;
    animation-delay: 0.8s, 1.2s;
}

.particle:nth-child(7) {
    left: 40%;
    top: 85%;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.8), rgba(102, 126, 234, 0));
    animation-duration: 5.8s, 3.2s;
    animation-delay: 2s, 0.6s;
}

.particle:nth-child(8) {
    left: 90%;
    top: 40%;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.8), rgba(255, 107, 107, 0));
    animation-duration: 6.8s, 2.4s;
    animation-delay: 0.2s, 1.5s;
}

.particle:nth-child(9) {
    left: 60%;
    top: 75%;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.9), rgba(118, 75, 162, 0));
    animation-duration: 7.2s, 2.9s;
    animation-delay: 1.2s, 0.4s;
}

.particle:nth-child(10) {
    left: 30%;
    top: 35%;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.85), rgba(102, 126, 234, 0));
    animation-duration: 6.3s, 3.1s;
    animation-delay: 1.8s, 0.9s;
}

/* Preview Section */
.ai-preview-section {
    display: none;
}

.ai-preview-container {
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.ai-preview-container img {
    width: 100%;
    height: auto;
    display: block;
}

.preview-actions {
    display: flex;
    gap: 1rem;
}

.preview-actions .btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-regenerate {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-regenerate:hover {
    background: var(--text-secondary);
    color: var(--white);
}

.btn-regenerate:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.btn-use-image {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

.btn-use-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn-use-image:active {
    transform: translateY(0);
}

/* Upload Options Container (for form.blade.php) */
.upload-options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.upload-option {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-option .upload-placeholder {
    padding: 2rem 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-option:hover .upload-placeholder {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

/* AI 生成觸發按鈕樣式 - 已註釋，因已移除觸發按鈕 */
/*
.ai-generate-option .ai-placeholder {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.05), rgba(255, 107, 107, 0.1));
}

.ai-generate-option:hover .ai-placeholder {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 107, 107, 0.2));
}

.upload-placeholder i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-placeholder p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}
*/

.upload-placeholder span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-20px) translateX(10px);
    }
    50% {
        transform: translateY(-40px) translateX(-5px);
    }
    75% {
        transform: translateY(-20px) translateX(-10px);
    }
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

@keyframes gradient-flow {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-generate-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .quick-style-options {
        gap: 0.4rem;
    }
    
    .quick-style-btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
    }
    
    .upload-options-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ai-generate-content {
        padding: 1rem;
    }
    
    .ai-form-section {
        margin-bottom: 1.5rem;
    }
    
    .quick-style-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .quick-style-btn i {
        font-size: 0.8rem;
    }
    
    .preview-actions {
        flex-direction: column;
    }
    
    .file-upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-prompt i {
        font-size: 2.5rem;
    }
}

