/* Custom Styles for AI + GGB Fusion */

/* Background gradient - Dark theme */
body {
    background: #0D2B35;
    background-attachment: fixed;
}

.admin-page {
    background: #f9fafb;
    color: #111827;
}

.admin-page input,
.admin-page textarea,
.admin-page select {
    color: #111827;
    background-color: #ffffff;
}

.admin-page input::placeholder,
.admin-page textarea::placeholder {
    color: #9ca3af;
}

.bg-slate-900 {
    background-color: #0D2B35 !important;
}

.bg-slate-800,
.bg-slate-700,
.bg-slate-700\/50 {
    background-color: #174050 !important;
}

.writing-vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

#ggb-beautify-panel .ggb-reset-btn {
    background: #0ea5e9;
    border: 1px solid #38bdf8;
}

#ggb-beautify-panel .ggb-reset-btn:hover {
    background: #0284c7;
    border-color: #7dd3fc;
}

#ggb-beautify-panel .ggb-reset-btn:active {
    transform: scale(0.98);
}

#ggb-beautify-panel input[type="range"] {
    background: #0D2B35;
}

#ggb-beautify-panel input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #0D2B35;
    border: 1px solid #2b5a6a;
    border-radius: 999px;
}

#ggb-beautify-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 999px;
    background: #38bdf8;
    border: 2px solid #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

#ggb-beautify-panel input[type="range"]::-moz-range-track {
    height: 6px;
    background: #0D2B35;
    border: 1px solid #2b5a6a;
    border-radius: 999px;
}

#ggb-beautify-panel input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #38bdf8;
    border: 2px solid #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

/* GGB Container Styles */
#ggb-container {
    min-height: 400px;
    background-color: rgba(30, 41, 59, 0.8);
    position: relative;
    width: 100% !important;
    height: 100% !important;
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.app-nav-item {
    color: #ffffff;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.app-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.6s ease;
}

.app-nav-item:hover::before {
    left: 100%;
}

.app-nav-item:hover {
    background-color: rgba(148, 163, 184, 0.1);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.app-nav-item.active {
    background-color: rgba(59, 130, 246, 0.2);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.app-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: #3b82f6;
    border-radius: 1px;
}

/* Chat Styles */
#chat-messages {
    background-color: #174050;
}

.message-appear {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Scrollbar Styles */
#chat-messages::-webkit-scrollbar {
    width: 4px;
}
#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
#chat-messages::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 10px;
}
#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Model Dropdown Scrollbar Styles */
#model-dropdown::-webkit-scrollbar {
    width: 6px;
}
#model-dropdown::-webkit-scrollbar-track {
    background:#174050;
    border-radius: 0 8px 8px 0;
}
#model-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #0D2B35, #0D2B35);
    border-radius: 3px;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}
#model-dropdown::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #0D2B35, #0D2B35);
}

/* Code Editor Scrollbar Styles */
.code-editor::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.code-editor::-webkit-scrollbar-track {
    background: #0D2B35;
    border-radius: 3px;
}
.code-editor::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-radius: 3px;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}
.code-editor::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #60a5fa, #3b82f6);
}
.code-editor::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
}
#model-dropdown::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
}

/* History Modal Scrollbar */
#history-list-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
#history-list-container::-webkit-scrollbar-track {
    background: #ffffff;
    border-radius: 10px;
}
#history-list-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-radius: 10px;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}
#history-list-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #60a5fa, #3b82f6);
}
#history-list-container::-webkit-scrollbar-corner {
    background: #174050;
}

/* Helper classes for layout fixing */
.min-width-0 {
    min-width: 0;
}

/* Smooth transition utilities */
.transition-all-300 {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.transition-transform-300 {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.transition-shadow-300 {
    transition: box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.transition-colors-300 {
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Micro-interactions */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.animate-pulse-slow {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Bounce animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.animate-bounce-slow {
    animation: bounce 2s infinite;
}

/* Fade in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.assistant-content pre {
    max-width: 100%;
    overflow-x: auto;
}

.assistant-content code {
    white-space: pre-wrap;
    word-break: break-all;
}


/* GGB specific overrides */
canvas {
    outline: none !important;
}

#ggb-container iframe {
    border: none !important;
}

/* Custom Modal Animation */
#confirm-modal.active #confirm-modal-content {
    transform: scale(1);
    opacity: 1;
}

#confirm-modal.active .bg-gray-900\/40 {
    opacity: 1;
}

/* Login & Activation Modal Animation */
#login-modal-content, #activation-modal-content, #square-upload-modal-content {
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#login-modal-content.scale-100, #activation-modal-content.scale-100, #square-upload-modal-content.scale-100 {
    transform: scale(1);
    opacity: 1;
}

/* Membership Card Hover & Select */
.membership-card {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.12), 0 1px 3px -1px rgba(15, 23, 42, 0.08);
    background-color: #f8fafc;
    border-color: #e2e8f0 !important;
}

.membership-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 18px -8px rgba(59, 130, 246, 0.2), 0 4px 8px -4px rgba(15, 23, 42, 0.12);
}

.membership-card.active-type {
    border-color: #a855f7 !important;
    background-color: rgba(168, 85, 247, 0.08);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.18), 0 8px 14px -8px rgba(168, 85, 247, 0.2);
}

/* Enhanced card shadows */
.card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    background-color: #174050;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* Panel shadows */
.panel {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.3s ease;
    background-color: #174050;
}

.panel:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

/* Gradient utility classes */
.gradient-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.gradient-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.gradient-pink {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.gradient-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gradient-amber {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.gradient-cyan {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.gradient-indigo {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

/* Toast Notification */
#toast-container {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.toast {
    margin-top: 16px;
    padding: 8px 16px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.toast-success {
    color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bcf0da;
}

.toast-error {
    color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
}

.toast-info {
    color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #dbeafe;
}

.toast-warning {
    color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
}

.toast.hiding {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-100%); }
}

/* Modern input styles */
.input-modern {
    position: relative;
    transition: all 0.3s ease;
}

.input-modern input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #475569;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #334155;
    color: #f8fafc;
}

.input-modern input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background-color: #1e293b;
}

.input-modern input:hover {
    border-color: #64748b;
}

/* Modern button styles */
.btn-modern {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-modern:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn-modern:hover::before {
    left: 100%;
}

/* Sidebar Styles */
.sidebar-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border-left: 3px solid #3b82f6;
}

/* WeChat Callback Page Styles */
.wechat-card { background: white; padding: 2rem; border-radius: 1rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); text-align: center; max-width: 90%; width: 400px; transition: all 0.3s ease; }

/* WeChat QR Container - Ensure no white text inheritance */
#wechat-qr-container,
#bind-wechat-qr-container {
    color: #1f2937 !important;
}

#wechat-qr-container *,
#bind-wechat-qr-container * {
    color: inherit !important;
}

.wechat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.wechat-icon { width: 64px; height: 64px; background: linear-gradient(135deg, #4caf50 0%, #45a049 100%); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; font-size: 32px; box-shadow: 0 4px 6px -1px rgba(76, 175, 80, 0.2); }

.wechat-title { font-size: 1.5rem; color: #333; margin-bottom: 0.5rem; }

.wechat-desc { color: #666; line-height: 1.5; }

/* Responsive design optimizations */
@media (max-width: 768px) {
    /* Mobile optimizations */
    .app-nav-item {
        padding: 12px 8px;
        font-size: 12px;
    }
    
    .app-nav-item i {
        width: 16px;
        height: 16px;
    }
    
    #chat-messages {
        padding: 16px;
    }
    
    #chat-form {
        padding: 0;
    }
    
    .membership-card {
        padding: 12px;
    }
    
    .wechat-card {
        padding: 1.5rem;
        width: 95%;
    }
    
    .wechat-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    .wechat-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    /* Small mobile optimizations */
    .app-nav-item span {
        display: none;
    }
    
    #ggb-container {
        margin: 5px;
        border-radius: 8px;
    }
    
    .membership-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .membership-card .text-right {
        align-self: flex-end;
    }
}

/* ========== AI 进度条动画 ========== */
@keyframes progressShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

@keyframes progressDotPulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.ai-progress-wrap .h-full {
    animation: progressShimmer 2s linear infinite;
}

.ai-progress-wrap .h-full::after {
    content: '';
    position: absolute;
    top: -2px;
    right: 0;
    width: 20px;
    height: 8px;
    background: radial-gradient(ellipse, rgba(103, 232, 249, 0.6), transparent);
    filter: blur(2px);
    animation: progressGlowPulse 1.5s ease-in-out infinite;
    border-radius: 50%;
}
