* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary: #9333ea;
            --primary-dark: #7c3aed;
            --secondary: #ec4899;
            --background: #0f0f0f;
            --surface: #1a1a1a;
            --surface-light: #262626;
            --text: #ffffff;
            --text-secondary: #a1a1aa;
            --border: #404040;
            --success: #10b981;
            --warning: #f59e0b;
            --error: #ef4444;
        }

        body {
            font-family: 'Kanit', sans-serif;
            background: var(--background);
            color: var(--text);
            min-height: 100vh;
            zoom: 1.05;
            background-image: 
                radial-gradient(circle at 20% 50%, rgba(147, 51, 234, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
        }

        .container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh; /* เพิ่มบรรทัดนี้ */
    display: flex;
    flex-direction: column;
}

        /* Header */
        .header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 24px; /* ลดจาก 24px */
    margin-bottom: 16px; /* ลดจาก 24px */
    backdrop-filter: blur(10px);
}

        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .logo-icon {
            width: 48px;
            height: 48px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
        }

        .logo-text h1 {
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;  /* เพิ่มบรรทัดนี้หลัง webkit */
    -webkit-text-fill-color: transparent;
}

        .logo-text p {
            font-size: 14px;
            color: var(--text-secondary);
            font-weight: 300;
        }

        /* Mode Selector */
.mode-selector {
    display: flex;
    gap: 12px;
    background: var(--surface-light);
    padding: 6px;
    border-radius: 12px;
    justify-content: center;
    flex-wrap: wrap; /* 👈 เพิ่มบรรทัดนี้ */
}

        .mode-btn {
            padding: 10px 20px;
            border: none;
            background: transparent;
            color: var(--text-secondary);
            border-radius: 8px;
            cursor: pointer;
            font-family: 'Kanit', sans-serif;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* Simple hover effect */
.mode-btn:hover {
    background: rgba(147, 51, 234, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.2);
}

/* Active state with soft glow effect */
.mode-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    position: relative;
    z-index: 1;
    animation: soft-pulse 3s ease-in-out infinite;
    box-shadow: 
        0 0 15px rgba(147, 51, 234, 0.3),
        0 0 25px rgba(147, 51, 234, 0.2),
        inset 0 0 10px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(147, 51, 234, 0.5);
    transform: translateY(-1px);
}

/* Soft glow border effect */
.mode-btn.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(147, 51, 234, 0.4), 
        rgba(236, 72, 153, 0.4), 
        rgba(147, 51, 234, 0.4), 
        rgba(236, 72, 153, 0.4)
    );
    border-radius: 10px;
    opacity: 0.5;
    z-index: -1;
    animation: soft-rotate 4s linear infinite;
    filter: blur(3px);
}

/* Subtle inner glow */
.mode-btn.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.05) 100%
    );
    border-radius: 8px;
    pointer-events: none;
}

/* Softer animation for pulsing glow */
@keyframes soft-pulse {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(147, 51, 234, 0.3),
            0 0 25px rgba(147, 51, 234, 0.2),
            inset 0 0 10px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(147, 51, 234, 0.4),
            0 0 35px rgba(147, 51, 234, 0.3),
            inset 0 0 15px rgba(255, 255, 255, 0.15);
    }
}

/* Slower rotation */
@keyframes soft-rotate {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* Softer red for Image Gen */
.mode-btn.active[data-mode="image"] {
    animation: soft-pulse-red 3s ease-in-out infinite;
}

.mode-btn.active[data-mode="image"]::before {
    background: linear-gradient(45deg, 
        rgba(255, 71, 87, 0.3), 
        rgba(255, 107, 107, 0.3), 
        rgba(255, 71, 87, 0.3), 
        rgba(255, 107, 107, 0.3)
    );
}

@keyframes soft-pulse-red {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(255, 71, 87, 0.25),
            0 0 25px rgba(255, 71, 87, 0.15),
            inset 0 0 10px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(255, 71, 87, 0.35),
            0 0 30px rgba(255, 71, 87, 0.25),
            inset 0 0 15px rgba(255, 255, 255, 0.15);
    }
}

/* Softer blue for AI Chat */
.mode-btn.active[data-mode="chat"] {
    animation: soft-pulse-blue 3s ease-in-out infinite;
}

.mode-btn.active[data-mode="chat"]::before {
    background: linear-gradient(45deg, 
        rgba(59, 130, 246, 0.3), 
        rgba(96, 165, 250, 0.3), 
        rgba(59, 130, 246, 0.3), 
        rgba(96, 165, 250, 0.3)
    );
}

@keyframes soft-pulse-blue {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(59, 130, 246, 0.25),
            0 0 25px rgba(59, 130, 246, 0.15),
            inset 0 0 10px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 20px rgba(59, 130, 246, 0.35),
            0 0 30px rgba(59, 130, 246, 0.25),
            inset 0 0 15px rgba(255, 255, 255, 0.15);
    }
}

/* Subtle hover effect */
.mode-btn:not(.active):hover {
    box-shadow: 
        0 4px 10px rgba(147, 51, 234, 0.15),
        0 0 20px rgba(147, 51, 234, 0.08);
}

/* Enhanced hover effect */
.mode-btn:not(.active):hover {
    box-shadow: 
        0 4px 15px rgba(147, 51, 234, 0.3),
        0 0 30px rgba(147, 51, 234, 0.15);
}

/* Active state */
.mode-btn:active {
    transform: translateY(0);
}

        .mode-icon {
            font-size: 18px;
        }

        /* Usage Display */
        .usage-display {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .user-info {
            text-align: right;
        }

        .user-id {
            font-size: 14px;
            color: var(--text-secondary);
        }

        .usage-info {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 4px;
        }

        .usage-bar {
            width: 120px;
            height: 6px;
            background: var(--surface-light);
            border-radius: 3px;
            overflow: hidden;
        }

        .usage-progress {
            height: 100%;
            background: linear-gradient(90deg, var(--success) 0%, #34d399 100%);
            transition: all 0.3s ease;
        }

        .usage-text {
            font-size: 14px;
            color: var(--text);
        }
        
        /* Mobile Credit Button - Hidden by default */
        .mobile-credit-btn {
            display: none;
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            border: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            color: white;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
            margin-left: 4px;
            flex-shrink: 0;
        }
        
        .mobile-credit-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(147, 51, 234, 0.5);
        }
        
        .mobile-credit-btn:active {
            transform: scale(0.95);
        }
        
        /* Mobile Login Button */
        .mobile-login-btn {
            background: #2563eb;
            color: white;
            border: none;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-left: 8px;
            box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
        }
        
        .mobile-login-btn:hover {
            background: #1d4ed8;
            transform: scale(1.1);
            box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
        }
        
        .mobile-login-btn:active {
            transform: scale(0.95);
        }
        
        /* Mobile Login Container - Hidden by default */
        .mobile-login-container {
            display: none;
        }
        
        .credit-plus {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
            line-height: 1;
        }
        
        /* Mobile Total Credits Display */
        .mobile-total-credits {
            display: none;
            margin-top: 8px;
            padding: 6px 12px;
            background: rgba(59, 130, 246, 0.1);
            border: 1px solid rgba(59, 130, 246, 0.3);
            border-radius: 20px;
            font-size: 13px;
            color: #3b82f6;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-weight: 500;
        }
        
        .mobile-total-credits .credit-icon {
            font-size: 14px;
        }
        
        .mobile-total-credits .credit-text {
            font-weight: 500;
        }
        
        #mobileCreditsBalance {
            font-weight: 600;
            color: #3b82f6;
            font-size: 14px;
        }

        /* Main Content */
        .main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    height: calc(100vh - 280px); /* เปลี่ยนจาก calc(100vh - 200px) */
    flex: 1; /* เพิ่มบรรทัดนี้ */
}

        /* Info Panel */
        .info-panel {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 24px;
            overflow-y: auto;
        }

        .info-section {
            margin-bottom: 24px;
        }

        .info-section h3 {
            font-size: 18px;
            font-weight: 500;
            margin-bottom: 12px;
            color: var(--primary);
        }

        .tip-card {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 12px; /* ลดจาก 16px */
    margin-bottom: 8px; /* ลดจาก 12px */
}

.tip-card h4 {
    font-size: 15px; /* ลดจาก 16px */
    font-weight: 500;
    margin-bottom: 6px; /* ลดจาก 8px */
}

.tip-card p {
    font-size: 13px; /* ลดจาก 14px */
    color: var(--text-secondary);
    line-height: 1.4; /* ลดจาก 1.5 */
}

        /* Character Library Panel */
        .character-library {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 24px;
            overflow-y: auto;
            display: none;
        }

        .character-library.active {
            display: block;
        }

        .library-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .library-header h3 {
            font-size: 18px;
            font-weight: 500;
            color: var(--primary);
        }

        .character-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .character-card {
            background: var(--surface-light);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .character-card:hover {
            border-color: var(--primary);
            transform: translateY(-2px);
        }

        .character-name {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 8px;
        }

        .character-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;  /* เพิ่มบรรทัดนี้ */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

        .character-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 8px;
            font-size: 12px;
            color: var(--text-secondary);
        }
        
        .character-actions {
            display: flex;
            gap: 5px;
            align-items: center;
        }

        .empty-library {
            text-align: center;
            padding: 40px;
            color: var(--text-secondary);
        }

        /* Chat Panel */
        .chat-panel {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .message {
            display: flex;
            gap: 12px;
            animation: messageSlide 0.3s ease;
        }

        @keyframes messageSlide {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .message.user {
            flex-direction: row-reverse;
        }

        .message-avatar {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            flex-shrink: 0;
        }

        .message.assistant .message-avatar {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
        }

        .message.user .message-avatar {
            background: var(--surface-light);
        }

        .message-content {
            max-width: 70%;
            padding: 16px;
            border-radius: 16px;
            background: var(--surface-light);
        }
        
        /* Markdown styles for chat messages */
        .message-content h1, 
        .message-content h2, 
        .message-content h3 {
            margin: 16px 0 8px 0;
            font-weight: 600;
            line-height: 1.2;
        }
        
        .message-content h1 { font-size: 1.5rem; }
        .message-content h2 { font-size: 1.3rem; }
        .message-content h3 { font-size: 1.1rem; }
        
        .message-content p {
            margin: 8px 0;
            line-height: 1.6;
        }
        
        .message-content ul {
            margin: 8px 0;
            padding-left: 24px;
        }
        
        .message-content li {
            margin: 4px 0;
            line-height: 1.6;
        }
        
        .message-content strong {
            font-weight: 600;
            color: var(--text-primary);
        }

        .message.user .message-content {
            background: var(--primary);
        }
        
        /* Message Timestamp */
        .message-timestamp {
            font-size: 11px;
            color: var(--text-secondary);
            opacity: 0.7;
            margin-top: 8px;
            text-align: right;
        }
        
        .message.user .message-timestamp {
            color: rgba(255, 255, 255, 0.8);
        }

        /* Veo3 Prompt Style */
        .veo3-prompt {
            background: linear-gradient(135deg, rgba(147, 51, 234, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
            border: 1px solid rgba(147, 51, 234, 0.3);
            padding: 20px;
            border-radius: 12px;
            margin-top: 12px;
        }

        .prompt-header {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 12px;
            color: var(--primary);
        }

        .prompt-content {
            background: rgba(0, 0, 0, 0.3);
            padding: 16px;
            border-radius: 8px;
            line-height: 1.6;
            font-size: 15px;
            margin-bottom: 16px;
            font-family: 'Kanit', sans-serif;
            white-space: pre-wrap;
            word-wrap: break-word;
            text-align: left;
        }

        /* Character Profile Style */
        .character-profile {
            background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(147, 51, 234, 0.2) 100%);
            border: 1px solid rgba(236, 72, 153, 0.3);
            padding: 20px;
            border-radius: 12px;
            margin-top: 12px;
        }

        .profile-actions {
            display: flex;
            gap: 12px;
            margin-top: 16px;
        }

        .copy-btn, .save-btn {
            background: var(--primary);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.3s ease;
            font-family: 'Kanit', sans-serif;
        }

        .save-btn {
            background: var(--success);
        }

        .copy-btn:hover, .save-btn:hover {
            transform: translateY(-1px);
        }

        /* Loading Animation */
        .loading-spinner {
            width: 40px;
            height: 40px;
            border: 3px solid rgba(147, 51, 234, 0.3);
            border-top: 3px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 10px;
        }

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

        /* Input Area */
        .chat-input-area {
            padding: 20px;
            border-top: 1px solid var(--border);
        }

        .mode-notice {
            background: var(--surface-light);
            border-radius: 8px;
            padding: 12px 16px;
            margin-bottom: 12px;
            font-size: 14px;
            color: var(--text-secondary);
            display: none;
        }

        .mode-notice.active {
            display: block;
        }

        .upload-section {
            display: flex;
            gap: 12px;
            margin-bottom: 12px;
            flex-wrap: wrap;
            align-items: center;
        }

        .upload-btn {
            background: var(--surface-light);
            color: var(--text);
            border: 1px solid var(--border);
            padding: 8px 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .upload-btn:hover {
            background: var(--primary);
            border-color: var(--primary);
        }
        
        /* New upload button style */
        .upload-local-btn {
            background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%) !important;
            color: white !important;
            border: none !important;
        }
        
        .upload-local-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
        }

        .image-preview {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .image-preview-item {
            position: relative;
            width: 60px;
            height: 60px;
        }

        .image-preview-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 8px;
            border: 1px solid var(--border);
        }

        .remove-btn {
            position: absolute;
            top: -6px;
            right: -6px;
            background: var(--error);
            color: white;
            border: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .input-wrapper {
            display: flex;
            gap: 12px;
            position: relative;
            
        }
        /* ปุ่มขยาย */
.expand-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: var(--primary);
    color: white;
}

/* Image Mode Styles */
.model-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.model-option {
    cursor: pointer;
}

.model-option input[type="radio"] {
    display: none;
}

.model-card {
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}

.model-option input[type="radio"]:checked + .model-card {
    border-color: var(--primary);
    background: rgba(147, 51, 234, 0.1);
}

.model-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.model-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.model-price {
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.model-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.ratio-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.ratio-btn {
    padding: 8px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.ratio-btn:hover {
    border-color: var(--primary);
}

.ratio-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Generated Image in Chat */
.generated-image {
    margin-top: 16px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
}

.generated-image img {
    width: 100%;
    height: auto;
    display: block;
}

.image-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.download-btn, .retry-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.retry-btn {
    background: var(--surface-light);
    color: var(--text);
}

.download-btn:hover, .retry-btn:hover {
    transform: translateY(-1px);
}

/* Image Loading Animation */
.image-loading {
    text-align: center;
    padding: 40px;
}

.image-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(147, 51, 234, 0.3);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .model-selector {
        gap: 8px;
    }
    
    .model-card {
        padding: 12px;
    }
}

/* Expanded state */
.message-input.expanded {
    height: 300px !important;
    max-height: 60vh !important;
}

        .message-input {
            flex: 1;
            background: var(--surface-light);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 12px 20px;
            color: var(--text);
            font-size: 16px;
            resize: none;
            font-family: 'Kanit', sans-serif;
            transition: all 0.3s ease;
        }

        .message-input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .send-btn {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 12px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: 'Kanit', sans-serif;
        }

        .send-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(147, 51, 234, 0.3);
        }

        .send-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .upload-tip {
            font-size: 12px;
            color: var(--text-secondary);
            margin-left: 10px;
        }

        .upload-tip a {
            color: var(--primary);
            text-decoration: none;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .upload-tip a:hover {
            text-decoration: underline;
            color: var(--secondary);
        }

        /* Enhance Button */
.enhance-section {
    margin-bottom: 12px;
}

.enhance-btn {
    background: var(--surface-light);  /* เปลี่ยนเป็นสีเทา */
    color: var(--text);
    border: 2px solid var(--primary);  /* ขอบสีม่วง */
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;  /* ไม่ให้ขยายเต็มความกว้าง */
}

.enhance-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.3);
}

/* จัด layout ของ enhance section */
.enhance-section {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.enhance-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.enhance-status {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

        /* Status Bar */
        .status-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    margin-top: 12px; /* ลดจาก 24px */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    flex-shrink: 0; /* เพิ่มบรรทัดนี้ */
}

        .status-item {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--success);
        }

        /* Loading Animation */
        .typing-indicator {
            display: flex;
            gap: 4px;
            padding: 12px;
        }

        .typing-indicator span {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--text-secondary);
            animation: typing 1.4s infinite;
        }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes typing {
            0%, 60%, 100% {
                opacity: 0.3;
                transform: translateY(0);
            }
            30% {
                opacity: 1;
                transform: translateY(-10px);
            }
        }

        /* Dialog */
        .url-dialog {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .url-dialog-content {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 24px;
            max-width: 500px;
            width: 90%;
        }

        .url-dialog h3 {
            color: var(--primary);
            margin-bottom: 16px;
        }

        .dialog-tip {
            font-size: 14px;
            color: var(--text-secondary);
            margin-bottom: 20px;
            line-height: 1.5;
        }

        .dialog-tip a {
            color: var(--primary);
            text-decoration: none;
        }

        .dialog-tip a:hover {
            text-decoration: underline;
        }

        .url-input {
            width: 100%;
            background: var(--surface-light);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 12px;
            color: var(--text);
            font-size: 14px;
            margin-bottom: 20px;
        }

        .dialog-buttons {
            display: flex;
            gap: 12px;
            justify-content: flex-end;
        }

        .dialog-buttons button {
            background: var(--primary);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-family: 'Kanit', sans-serif;
        }

        .dialog-buttons button:last-child {
            background: var(--surface-light);
        }

        /* Save Character Dialog */
        .save-dialog {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .save-dialog-content {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 24px;
            max-width: 500px;
            width: 90%;
        }

        .save-dialog h3 {
            color: var(--primary);
            margin-bottom: 16px;
        }

        .character-name-input {
            width: 100%;
            background: var(--surface-light);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 12px;
            color: var(--text);
            font-size: 14px;
            margin-bottom: 20px;
            font-family: 'Kanit', sans-serif;
        }

        /* Desktop-specific compact sizes */
        @media (min-width: 769px) {
            /* ลดขนาดทุกอย่างบน Desktop เพื่อให้กระชับขึ้น */
            .message {
                padding: 8px 0 !important;
            }
            
            .message-content {
                line-height: 1.5 !important;
            }
            
            .message-content h1 { font-size: 22px !important; }
            .message-content h2 { font-size: 18px !important; }
            .message-content h3 { font-size: 16px !important; }
            .message-content p { font-size: 14px !important; }
            
            .rating-section {
                padding: 10px !important;
                margin-top: 6px !important;
            }
            
            .action-buttons {
                gap: 6px !important;
                margin-top: 6px !important;
            }
            
            .message-avatar {
                width: 36px !important;
                height: 36px !important;
                font-size: 18px !important;
            }
            
            .veo3-prompt, .character-profile {
                padding: 14px !important;
                margin-top: 8px !important;
            }
            
            .prompt-content {
                padding: 10px !important;
                font-size: 13px !important;
            }
            
            .prompt-header {
                font-size: 14px !important;
                margin-bottom: 8px !important;
            }
        }

        /* Dark Scrollbar */
        ::-webkit-scrollbar {
            width: 12px;
        }

        ::-webkit-scrollbar-track {
            background: #1a1a1a;
        }

        ::-webkit-scrollbar-thumb {
            background: #404040;
            border-radius: 6px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #555555;
        }

        /* Firefox */
        * {
            scrollbar-width: thin;
            scrollbar-color: #404040 #1a1a1a;
        }

        /* Responsive */
        @media (max-width: 968px) {
            .container {
                padding: 12px;
            }
            
            .main-content {
                grid-template-columns: 1fr;
                height: auto;
                gap: 16px;
            }
            
            .info-panel, .character-library {
                display: none !important;
            }
            
            .chat-panel {
                width: 100% !important;
            }

            .header {
                padding: 16px;
            }

            .header-top {
        flex-direction: column;
        gap: 12px;
        align-items: center; /* เพิ่มบรรทัดนี้ */
    }
    
    .logo {
        flex-direction: column;
        text-align: center;
    }
    
    .usage-display {
        width: auto; /* เปลี่ยนจาก 100% */
        text-align: center; /* เพิ่มบรรทัดนี้ */
    }
    
    .user-info {
        text-align: center; /* เปลี่ยนจาก right */
    }
    
    /* Fix overlap issue for free credits label on mobile */
    .usage-info {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    
    .usage-info > div:first-child {
        margin-bottom: 2px;
    }
            
            .chat-panel {
                height: calc(100vh - 250px);
            }
            
            .chat-messages {
                padding: 16px;
            }
            
            .message-content {
                max-width: 85%;
                font-size: 14px;
            }
            
            .veo3-prompt, .character-profile {
                padding: 16px;
            }
            
            .prompt-content {
                font-size: 13px;
                padding: 12px;
            }
            
            .chat-input-area {
                padding: 16px;
            }
            
            .message-input {
                font-size: 14px;
                padding: 10px 16px;
            }
            
            .send-btn {
                padding: 10px 20px;
                font-size: 14px;
            }
            
            .status-bar {
                font-size: 12px;
                padding: 10px 16px;
            }
            
            body {
                zoom: 1;
            }
        }

        @media (max-width: 480px) {
            .logo-text h1 {
                font-size: 20px;
            }
            
            .logo-icon {
                width: 40px;
                height: 40px;
            }
            
            .message-content {
                max-width: 90%;
            }

            .mode-selector {
                width: 100%;
                justify-content: center;
            }

            .mode-btn {
                font-size: 12px;
                padding: 8px 12px;
            }

            .mode-btn .mode-text {
                display: none;
            }
        }
/* ========== RATING STYLES ========== */
        .rating-section {
            background: var(--surface-light);
            border-radius: 12px;
            padding: 16px;
            margin-top: 16px;
        }

        .rating-header {
            font-size: 14px;
            color: var(--text-secondary);
            margin-bottom: 8px;
        }

        .star-rating {
            display: flex;
            gap: 6px;
            font-size: 20px;
            margin-bottom: 8px;
        }
        .star-rating {
    display: flex;
    gap: 6px;
    font-size: 20px;
    margin-bottom: 6px;
    justify-content: center;
}

.star {
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.star:hover {
    transform: scale(1.1);
}

.star.preview {
    color: #f59e0b;
}

.star.selected {
    color: #f59e0b;
}

.rating-labels {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    justify-content: center;
}

.rating-labels span {
    flex: 1;
    text-align: center;
    max-width: 40px;
}

        .star {
            cursor: pointer;
            color: #666;
            transition: all 0.2s ease;
            user-select: none;
        }

        .star:hover {
            color: #f59e0b;
            transform: scale(1.1);
        }

        .rating-feedback {
            width: 100%;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 8px 12px;
            color: var(--text);
            font-family: 'Kanit', sans-serif;
            font-size: 14px;
            resize: none;
        }

        .submit-rating {
            background: var(--primary);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            margin-top: 8px;
            font-family: 'Kanit', sans-serif;
        }

        .submit-rating:hover {
            background: var(--primary-dark);
        }

        .rating-thanks {
            text-align: center;
            padding: 12px;
            color: var(--success);
            font-size: 14px;
        }
    /* ========== MOBILE QUICK ACTIONS ========== */
        .mobile-quick-actions {
            display: none;
            gap: 10px;
            margin-bottom: 12px;
        }

        @media (max-width: 968px) {
            .mobile-quick-actions {
                display: flex;
                flex-wrap: wrap;
            }
            
            .quick-action-btn {
                flex: 1;
                min-width: 150px;
                background: var(--surface-light);
                border: 1px solid var(--border);
                color: var(--text);
                padding: 10px 16px;
                border-radius: 8px;
                font-size: 14px;
                font-family: 'Kanit', sans-serif;
                cursor: pointer;
                transition: all 0.3s ease;
            }
            
            .quick-action-btn:hover {
                background: var(--primary);
                border-color: var(--primary);
                color: white;
            }
        }
        /* ========== VOICE INPUT STYLES ========== */
.voice-btn {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Kanit', sans-serif;
}

.voice-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.voice-btn.listening {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.voice-status {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.voice-animation {
    display: flex;
    gap: 4px;
}

.voice-animation span {
    width: 4px;
    height: 20px;
    background: #ef4444;
    border-radius: 2px;
    animation: voice-wave 1s infinite ease-in-out;
}

.voice-animation span:nth-child(1) {
    animation-delay: 0s;
}

.voice-animation span:nth-child(2) {
    animation-delay: 0.1s;
    height: 30px;
}

.voice-animation span:nth-child(3) {
    animation-delay: 0.2s;
    height: 15px;
}

@keyframes voice-wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

.voice-text {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

/* Voice permission dialog */
.voice-permission-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    z-index: 1000;
    text-align: center;
}

.voice-permission-dialog h3 {
    color: var(--primary);
    margin-bottom: 16px;
}

.voice-permission-dialog p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.voice-permission-dialog button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Kanit', sans-serif;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .upload-section {
        flex-wrap: wrap;
    }
    
    .voice-btn {
        flex: 1;
        min-width: 120px;
    }
}
@media (max-width: 968px) {
    .mobile-back-btn {
        display: block !important;
    }
}
/* ซ่อนปุ่มสร้างตัวละครใน library บนมือถือ */
@media (max-width: 968px) {
    .character-library .library-header .mode-btn {
        display: none !important;
    }
}
/* Force textarea size */
.message-input {
    height: 80px !important;
    max-height: 150px !important;
    min-height: 60px !important;
    resize: vertical;
    display: block !important; /* เพิ่มบรรทัดนี้ */
    visibility: visible !important; /* เพิ่มบรรทัดนี้ */
    opacity: 1 !important; /* เพิ่มบรรทัดนี้ */
}

@media (max-width: 768px) {
    .message-input {
        height: 50px !important;        /* ลดจาก 60px */
        max-height: 100px !important;   /* ลดจาก 120px */
        min-height: 45px !important;    /* ลดจาก 50px */
        font-size: 14px !important;     /* เพิ่มใหม่ */
        padding: 8px 12px !important;   /* เพิ่มใหม่ */
    }
}
.stop-voice-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    margin-left: auto;
    transition: all 0.2s ease;
}

.stop-voice-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.voice-status {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .voice-status {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .stop-voice-btn {
        width: 100%;
        padding: 10px;
        font-size: 16px;
    }
}
@media (max-width: 768px) {
    .quick-action-btn.voice-quick {
        background: linear-gradient(135deg, #ef4444, #dc2626);
        color: white;
        border-color: #ef4444;
    }
    
    .quick-action-btn.voice-quick:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }
}

/* ========== CREDIT SYSTEM STYLES ========== */
.credit-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: 20px;
}

.credit-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-light);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.credit-icon {
    font-size: 20px;
}

.credit-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

.credit-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.add-credit-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.add-credit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Credit Modal */
.credit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.credit-modal-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 24px;
    max-width: 720px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.modal-header h2 {
    font-size: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
}

.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    padding: 0 8px;
}

.package-card {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 20px;
    padding: 20px 16px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.package-card.popular {
    border-color: var(--primary);
    transform: scale(1.05);
}

.package-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(147, 51, 234, 0.2);
    border-color: var(--primary);
}

.popular-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--secondary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.credits-amount {
    margin: 16px 0;
}

.credits-amount .number {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
}

.credits-amount .label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.credits-amount .bonus {
    display: block;
    color: var(--success);
    font-size: 14px;
    margin-top: 4px;
}

.price {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.select-package-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Credit Required Message */
.credit-required-message {
    background: var(--surface-light);
    border: 2px solid var(--error);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.credit-required-message h3 {
    color: var(--error);
    margin-bottom: 12px;
}

.credit-info-box {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 16px 0;
}

.credit-info-box span {
    font-size: 16px;
}

/* Payment Info */
.payment-info {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 24px;
}

.payment-methods {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.payment-method {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.payment-method img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

/* Slip Upload Styles */
.upload-slip-section {
    margin-top: 24px;
    padding: 24px;
    background: rgba(147, 51, 234, 0.05);
    border: 2px dashed rgba(147, 51, 234, 0.3);
    border-radius: 16px;
    text-align: center;
}

.upload-area {
    padding: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    background: rgba(147, 51, 234, 0.1);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.upload-text {
    font-size: 18px;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.slip-preview {
    margin-top: 20px;
}

.slip-preview img {
    max-width: 300px;
    max-height: 400px;
    border-radius: 8px;
}

.upload-status {
    margin-top: 20px;
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
}

.upload-status.checking {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.upload-status.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.upload-status.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.qr-section {
    margin: 24px 0;
    padding: 24px;
    background: var(--surface-light);
    border-radius: 12px;
    text-align: center;
}

.qr-code {
    margin: 16px auto;
}

.qr-code img {
    border: 4px solid white;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .credit-info {
        margin-left: 0;
        margin-top: 12px;
    }
    
    .packages-grid {
        grid-template-columns: 1fr;
    }
    
    .package-card.popular {
        transform: scale(1);
    }
}
.packages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

@media (max-width: 968px) {
    .packages-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    #creditDisplay {
        display: none !important;
    }
}

/* Tutorial Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--border);
    width: 90%;
    max-width: 900px;
    border-radius: 20px;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal .close {
    color: var(--text-secondary);
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 10;
}

.modal .close:hover,
.modal .close:focus {
    color: var(--text);
}

.tutorial-modal {
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 20px;
    padding: 32px;
}

.tutorial-title {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    color: var(--text);
}

.tutorial-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 24px;
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: var(--text);
}

.tab-button.active {
    color: var(--primary);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

.technique-section {
    margin-bottom: 32px;
}

.technique-section h3 {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 20px;
}

.technique-card {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.technique-card h4 {
    color: var(--text);
    margin-bottom: 12px;
    font-size: 18px;
}

.technique-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.example-box {
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    font-family: monospace;
}

.tip {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.technique-list {
    list-style: none;
    padding-left: 20px;
}

.technique-list li {
    color: var(--text-secondary);
    margin-bottom: 8px;
    position: relative;
}

.technique-list li::before {
    content: '•';
    color: var(--primary);
    position: absolute;
    left: -20px;
    font-weight: bold;
}

.warning-card {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.warning-card h4 {
    color: #ef4444;
    margin-bottom: 16px;
}

.problem-list {
    padding-left: 20px;
    color: var(--text-secondary);
}

.problem-list li {
    margin-bottom: 16px;
}

.problem-list li strong {
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}

.solution-card {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 20px;
}

.solution-card h4 {
    color: #10b981;
    margin-bottom: 12px;
}

.solution-list {
    list-style: none;
    padding-left: 20px;
}

.solution-list li {
    color: var(--text-secondary);
    margin-bottom: 8px;
    position: relative;
}

.solution-list li::before {
    content: '✓';
    color: #10b981;
    position: absolute;
    left: -20px;
    font-weight: bold;
}

/* Video Tab Styles */
.video-list {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.video-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-item:hover {
    background: rgba(147, 51, 234, 0.1);
    border-color: var(--primary);
    transform: translateX(4px);
}

.video-thumbnail {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 8px;
}

.video-info h4 {
    color: var(--text);
    margin-bottom: 4px;
    font-size: 16px;
}

.video-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.video-player-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 24px;
}

/* Tutorial Button Animation */
.tutorial-button {
    animation: pulse 2s infinite;
}

.tutorial-button .fab-icon svg {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

/* Desktop Tutorial Button */
.desktop-tutorial-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    font-family: 'Kanit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.25);
}

.desktop-tutorial-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.35);
}

.desktop-tutorial-btn svg {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
}

/* Hide desktop button on mobile */
@media (max-width: 768px) {
    .desktop-tutorial-btn {
        display: none;
    }
}

/* Hide FAB tutorial button on desktop */
@media (min-width: 769px) {
    .fab-item.tutorial-button {
        display: none;
    }
}

/* Desktop FAB Buttons Container */
.desktop-fab-buttons {
    display: none;
}

/* Show desktop FAB buttons only on desktop */
@media (min-width: 769px) {
    .desktop-fab-buttons {
        display: block;
    }
}

/* Hide desktop FAB buttons on mobile */
@media (max-width: 768px) {
    .desktop-fab-buttons {
        display: none;
    }
}
/* Quick Actions Bar */
.quick-actions-bar {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    background: var(--surface-light);
    border-radius: 12px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.action-icon {
        font-size: 14px;
    }

.favorites-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--secondary);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none;
}

.favorites-count:not(:empty) {
    display: block;
}

/* Templates Modal */
.templates-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.templates-content {
    background: var(--surface);
    border-radius: 20px;
    padding: 32px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.templates-header h2 {
    font-size: 24px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.template-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.category-btn {
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.category-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.template-card {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

.template-emoji {
    font-size: 32px;
    margin-bottom: 8px;
}

.template-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

.template-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Favorites Section */
.favorites-grid {
    display: grid;
    gap: 12px;
}

.favorite-item {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    position: relative;
}

.favorite-content {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    padding-right: 40px;
}

.favorite-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.favorite-actions {
    display: flex;
    gap: 8px;
}

.fav-action-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    font-family: 'Kanit', sans-serif;
}

.fav-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.remove-fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 20px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.remove-fav-btn:hover {
    opacity: 1;
}

/* Share Button in Prompt */
.prompt-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.share-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.share-btn:hover {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.continue-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* JSON Button Style */
.json-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.json-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

@media (max-width: 768px) {
    .json-btn {
        padding: 5px 8px !important;
        font-size: 10px !important;
    }
    
    /* ลดขนาดดาวและซ่อนข้อความคะแนน */
    .star-rating {
        font-size: 16px !important;
        gap: 4px !important;
        margin-bottom: 6px !important;
    }
    
    .rating-labels {
        display: none !important;
    }
    
    /* ลดขนาดส่วนให้คะแนน */
    .rating-section {
        padding: 8px !important;
        margin-top: 8px !important;
    }
    
    .rating-header {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }
    
    /* ลดขนาดปุ่มทั้งหมดในมือถือ */
    .prompt-actions button,
    .copy-btn,
    .save-btn,
    .share-btn,
    .continue-btn,
    .json-btn,
    .favorite-btn {
        padding: 5px 8px !important;
        font-size: 10px !important;
        gap: 4px !important;
        min-height: 30px !important;
    }
    
    /* Timestamp บนมือถือ */
    .message-timestamp {
        font-size: 10px !important;
        margin-top: 6px !important;
    }
}

.continue-btn:hover {
    background: #9333ea;
    border-color: #9333ea;
    color: white;
}

.favorite-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.favorite-btn:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}

.favorite-btn.favorited {
    background: #f59e0b;
    color: white;
}

/* Editor Modal */
.editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    padding: 20px;
}

.editor-content {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    width: 90%;
    max-width: 900px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.editor-header h3 {
    color: var(--primary);
    margin: 0;
}

.full-editor {
    flex: 1;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    color: var(--text);
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
    line-height: 1.6;
    resize: none;
}

.full-editor:focus {
    outline: none;
    border-color: var(--primary);
}

.editor-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.apply-btn {
    flex: 1;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
}

.cancel-btn {
    padding: 14px 24px;
    background: var(--surface-light);
    color: var(--text);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .quick-actions-bar {
        padding: 8px;
        gap: 8px;
    }
    
    .action-btn {
        padding: 8px 12px;  /* ลดจาก 10px 16px */
        font-size: 12px;    /* ลดจาก 14px */
        border-radius: 6px; /* เพิ่มใหม่ */
    }
    
    .action-text {
        display: none;
    }
    
    .templates-content {
        padding: 20px;
        margin: 10px;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .category-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    /* เพิ่มใหม่ */
    .favorites-count {
        font-size: 10px;
        padding: 1px 4px;
        min-width: 16px;
    }
}


/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
}
/* Announcement Popup */
.announcement-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

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

.announcement-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.4s ease;
    border: 2px solid var(--primary);
    box-shadow: 0 20px 60px rgba(147, 51, 234, 0.3);
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.announcement-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.announcement-close:hover {
    background: var(--surface-light);
    color: var(--error);
}

.announcement-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.announcement-icon {
    font-size: 48px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.announcement-header h2 {
    font-size: 28px;
    color: var(--primary);
    margin: 0;
}

.announcement-body {
    margin-bottom: 24px;
}

.announcement-item {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.announcement-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.announcement-item h3 {
    font-size: 18px;
    margin: 0 0 12px 0;
    color: var(--text);
}

.announcement-item p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.6;
}

.announcement-item ul {
    margin: 0;
    padding-left: 20px;
}

.announcement-item li {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.announcement-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.announcement-badge.new {
    background: var(--success);
    color: white;
}

.announcement-badge.update {
    background: var(--primary);
    color: white;
}

.announcement-badge.tip {
    background: var(--warning);
    color: white;
}

.announcement-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.dont-show-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.dont-show-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.announcement-ok-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.announcement-ok-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(147, 51, 234, 0.3);
}

/* Desktop Login Button */
.desktop-login-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.desktop-login-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

/* Hide desktop login button on mobile */
@media (max-width: 768px) {
    .desktop-login-btn {
        display: none;
    }
}

/* Mobile Login Button in FAB */
.fab-action-btn[onclick*="showLoginModal"] {
    background: #404040;
}

.fab-action-btn[onclick*="showLoginModal"]:hover {
    background: #505050;
}

/* Free Credits Label Styling */
.credits-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #22c55e;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    white-space: nowrap;
    z-index: 10;
    font-family: 'Kanit', sans-serif;
}

/* Free Credits Label Mobile Styling */
@media (max-width: 768px) {
    .credits-label {
        font-size: 10px;
        padding: 2px 6px;
        top: -22px;
    }
    
    /* Adjust usage display on mobile when login button is present */
    .usage-display {
        gap: 5px;
    }
    
    /* Ensure proper spacing in mobile FAB menu */
    .fab-menu .fab-action-btn {
        margin: 5px 0;
    }
}
.mode-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1; /* เพิ่มบรรทัดนี้ให้ปุ่มขนาดเท่ากัน */
    justify-content: center; /* จัดข้อความกึ่งกลาง */
    min-width: 130px; /* ขนาดขั้นต่ำ */
    overflow: visible;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .announcement-content {
        padding: 24px 20px;
        margin: 20px;
    }
    
    .announcement-header h2 {
        font-size: 22px;
    }
    
    .announcement-icon {
        font-size: 36px;
    }
    
    .announcement-item {
        padding: 16px;
    }
    
    .announcement-item h3 {
        font-size: 16px;
    }
    
    .announcement-footer {
        flex-direction: column;
        gap: 16px;
    }
    
    .announcement-ok-btn {
        width: 100%;
    }
}

/* Quick Edit Bar */
.quick-edit-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px;
    background: var(--surface-light);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.quick-edit-bar button {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.2s ease;
}

.quick-edit-bar button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Dark theme adjustments */
.announcement-content {
    background: linear-gradient(135deg, var(--surface) 0%, rgba(147, 51, 234, 0.05) 100%);
}

/* Entrance animation for items */
.announcement-popup.show .announcement-item {
    animation: itemSlideIn 0.5s ease forwards;
    opacity: 0;
}

.announcement-popup.show .announcement-item:nth-child(1) {
    animation-delay: 0.1s;
}

.announcement-popup.show .announcement-item:nth-child(2) {
    animation-delay: 0.2s;
}

.announcement-popup.show .announcement-item:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes itemSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
/* Floating Action Button */
.fab-announcement {
    position: fixed;
    bottom: 20px !important;
    right: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    animation: fabEntrance 0.5s ease;
}

@keyframes fabEntrance {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.fab-announcement:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(147, 51, 234, 0.5);
    padding: 16px 32px;
}

.fab-icon {
    font-size: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.fab-text {
    font-size: 14px;
    font-weight: 500;
}

/* Course Package Hover Effects */
.course-package {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 20px;
    position: relative;
    transition: all 0.4s ease;
    overflow: hidden;
}

/* Hover overlay effect */
.course-package::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.course-package:hover::before {
    opacity: 1;
}

/* Hover animation */
.course-package:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(147, 51, 234, 0.3);
}

/* Different colors for each package */
.course-package.group {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(79, 70, 229, 0.05) 100%);
}

.course-package.group:hover {
    border-color: #6366f1;
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
}

.course-package.online {
    border-color: rgba(16, 185, 129, 0.3);
}

.course-package.online:hover {
    border-color: #10b981;
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.3);
}

.course-package.onsite {
    border-color: rgba(245, 158, 11, 0.3);
}

.course-package.onsite:hover {
    border-color: #f59e0b;
    box-shadow: 0 20px 40px rgba(245, 158, 11, 0.3);
}

/* Make content above overlay */
.course-package > * {
    position: relative;
    z-index: 2;
}

/* Badge fix */
.package-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;  /* ให้อยู่บนสุด */
}

/* New Course Badge */
.package-badge.new-course {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    animation: glow-badge 2s ease-in-out infinite;
}

@keyframes glow-badge {
    0%, 100% { box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(99, 102, 241, 0.8); }
}

/* Contact Course Button */
.contact-course-btn {
    width: 100%;
    margin-top: 20px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.contact-course-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.4);
}

/* Add glow effect on hover */
.course-package:hover .package-icon {
    animation: pulse 1s infinite;
}

.course-package:hover .price-number {
    filter: brightness(1.2);
    transform: scale(1.05);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Notification dot */
.fab-announcement::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    border-radius: 50%;
    border: 3px solid var(--background);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Hide notification dot if already viewed */
.fab-announcement.viewed::after {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .fab-announcement {
        bottom: 20px;
        right: 20px;
        padding: 12px;
        border-radius: 50%;
        min-width: 56px;
        height: 56px;
        justify-content: center;
    }
    
    .fab-announcement:hover {
        padding: 12px;
    }
    
    .fab-text {
        display: none;
    }
    
    .fab-icon {
        font-size: 24px;
    }
    
    .fab-announcement::after {
        top: -2px;
        right: -2px;
        width: 14px;
        height: 14px;
        border-width: 2px;
    }
}

/* Floating Course Button - ขนาดเล็กลงเหมือนข่าวสาร */
.fab-course {
    position: fixed;
    bottom: 90px !important;
    right: 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    animation: float 3s ease-in-out infinite;
}

/* Hover effect - ขยายเหมือนข่าวสาร */
.fab-course:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.5);
    padding: 16px 32px; /* ขยาย padding เหมือนข่าวสาร */
}

/* Icon */
.fab-course .fab-icon {
    font-size: 20px;
}

/* Mobile */
@media (max-width: 768px) {
    .fab-course {
        bottom: 90px;
        right: 20px;
        padding: 12px;
        border-radius: 50%;
        min-width: 56px;
        width: 56px;
        height: 56px;
        justify-content: center;
    }
    
    .fab-course:hover {
        padding: 12px; /* ไม่ขยายบนมือถือ */
    }
    
    .fab-course .fab-text {
        display: none;
    }
    
    .fab-course .fab-icon {
        font-size: 24px;
    }
}

/* เพิ่ม Glow effect */
.fab-course::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Course Modal - Hi-Tech Style (Compact) */
.course-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(20px);
}

.course-modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-radius: 20px;
    padding: 24px;  /* ลดจาก 40px */
    max-width: 750px;  /* ลดจาก 900px */
    width: 90%;
    max-height: 85vh;  /* ลดจาก 90vh */
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(147, 51, 234, 0.3);
    box-shadow: 0 0 60px rgba(147, 51, 234, 0.2);
}

.course-header {
    text-align: center;
    margin-bottom: 20px;  /* ลดจาก 32px */
}

.course-icon {
    font-size: 40px;  /* ลดจาก 60px */
    display: block;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

.course-header h2 {
    font-size: 26px;  /* ลดจาก 36px */
    background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 6px 0;
}

.course-tagline {
    color: #a1a1aa;
    font-size: 14px;  /* ลดจาก 16px */
}

.course-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));  /* ลดจาก 350px */
    gap: 20px;  /* ลดจาก 32px */
    margin-bottom: 24px;  /* ลดจาก 40px */
}

.course-package {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border: 2px solid transparent;
    border-radius: 16px;  /* ลดจาก 20px */
    padding: 20px;  /* ลดจาก 32px */
    position: relative;
    transition: all 0.4s ease;
    overflow: hidden;
}

.package-badge {
    position: absolute;
    top: 12px;  /* ลดจาก 20px */
    right: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 4px 12px;  /* ลดจาก 6px 20px */
    border-radius: 20px;
    font-size: 12px;  /* ลดจาก 14px */
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

.package-icon {
    font-size: 32px;  /* ลดจาก 48px */
    margin-bottom: 12px;
    display: block;
}

.course-package h3 {
    font-size: 18px;  /* ลดจาก 24px */
    margin-bottom: 16px;  /* ลดจาก 24px */
    color: white;
}

/* Price Style - แจ่มแต่เล็กลง */
.price-container {
    display: flex;
    align-items: baseline;
    margin-bottom: 20px;  /* ลดจาก 32px */
    position: relative;
}

.currency {
    font-size: 24px;  /* ลดจาก 32px */
    color: #a1a1aa;
    margin-right: 2px;
}

.price-number {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
    /* animation: glow 2s ease-in-out infinite; */ /* ปิดไว้ */
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    padding: 8px 0;  /* ลดจาก 12px */
    display: flex;
    align-items: flex-start;
    gap: 10px;  /* ลดจาก 12px */
    color: #e5e5e5;
    font-size: 13px;  /* ลดจาก 15px */
    line-height: 1.5;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.feature-list .icon {
    font-size: 16px;  /* ลดจาก 20px */
    flex-shrink: 0;
}

/* Calendar Section */
.calendar-section {
    background: rgba(147, 51, 234, 0.05);
    border-radius: 16px;  /* ลดจาก 20px */
    padding: 20px;  /* ลดจาก 32px */
    margin-bottom: 20px;  /* ลดจาก 32px */
    border: 1px solid rgba(147, 51, 234, 0.2);
}

.calendar-section h3 {
    text-align: center;
    font-size: 18px;  /* ลดจาก 24px */
    margin-bottom: 16px;  /* ลดจาก 24px */
    color: #9333ea;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;  /* ลดจาก 8px */
    max-width: 400px;  /* ลดจาก 500px */
    margin: 0 auto 16px;
}

.calendar-header,
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;  /* ลดจาก 14px */
    border-radius: 8px;  /* ลดจาก 12px */
    position: relative;
    transition: all 0.3s ease;
}

.calendar-day.busy::after {
    content: '×';
    position: absolute;
    font-size: 18px;  /* ลดจาก 24px */
    opacity: 0.3;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 24px;  /* ลดจาก 32px */
    font-size: 12px;  /* ลดจาก 14px */
    color: #a1a1aa;
}

.dot {
    width: 10px;  /* ลดจาก 12px */
    height: 10px;
}

/* Contact Footer */
.course-footer {
    text-align: center;
    padding-top: 16px;  /* ลดจาก 24px */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-info {
    font-size: 16px;  /* ลดจาก 20px */
    color: #e5e5e5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .course-modal-content {
        padding: 20px;
        margin: 12px;
    }
    
    .price-number {
        font-size: 40px;  /* ลดจาก 56px */
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .fab-announcement {
        bottom: 25px;
        right: 25px;
        padding: 14px 20px;
    }
}

/* Animation when FAB is clicked */
.fab-announcement:active {
    transform: scale(0.95);
}

/* Subtle floating animation */
.fab-announcement {
    animation: fabEntrance 0.5s ease, float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

/* Dark mode enhancement */
@media (prefers-color-scheme: dark) {
    .fab-announcement {
        box-shadow: 0 4px 20px rgba(147, 51, 234, 0.6);
    }
}

/* Calendar Colors - เพิ่มส่วนนี้ */
.calendar-day.available {
    background: rgba(16, 185, 129, 0.3) !important;
    border: 1px solid #10b981 !important;
    color: #10b981 !important;
    font-weight: 600;
}

.calendar-day.available:hover {
    background: rgba(16, 185, 129, 0.5) !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.calendar-day.busy {
    background: rgba(239, 68, 68, 0.3) !important;
    border: 1px solid #ef4444 !important;
    color: #ef4444 !important;
    position: relative;
}

.calendar-day.busy:hover {
    background: rgba(239, 68, 68, 0.5) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Legend dots */
.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.available {
    background: #10b981 !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.dot.busy {
    background: #ef4444 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* Position adjustment if there's a status bar */
@media (max-width: 768px) {
    .status-bar + .fab-announcement {
        bottom: 80px; /* ขยับขึ้นถ้ามี status bar */
    }
}
.rating-labels {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    justify-content: center;
}

.rating-labels span {
    flex: 1;
    text-align: center;
    max-width: 40px;
}

.star.preview {
    color: #f59e0b;
}

.star.selected {
    color: #f59e0b;
}
.scene-builder-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #9333ea, #ec4899);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.scene-builder-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.3);
}

/* Course Modal */
.course-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(10px);
}

.course-modal-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.course-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.course-icon {
    font-size: 48px;
}

.course-header h2 {
    font-size: 28px;
    color: var(--primary);
    margin: 0;
}

.course-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.course-package {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
}

.package-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.course-package h3 {
    font-size: 22px;
    margin-bottom: 16px;
    color: var(--text);
}

.price-tag {
    font-size: 36px;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 20px;
}

.course-package ul {
    list-style: none;
    padding: 0;
}

.course-package li {
    padding: 8px 0;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.contact-info {
    text-align: center;
    font-size: 18px;
    color: var(--text-secondary);
}

.contact-link {
    color: #10b981;
    text-decoration: none;
    font-weight: 600;
}

.contact-link:hover {
    text-decoration: underline;
}

/* Responsive adjustments *
@media (max-width: 968px) {
    .mode-selector {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .mode-btn {
        flex: 1 1 45%;
        min-width: 140px;
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Emergency fix for textarea */
#messageInput {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999 !important;
    position: relative !important;
    width: calc(100% - 150px) !important;
    background: #262626 !important;
    color: white !important;
}

.chat-input-area {
    display: block !important;
    visibility: visible !important;
}

.input-wrapper {
    display: flex !important;
    visibility: visible !important;
}

/* Image Modal Viewer */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    cursor: zoom-out;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 12px;
    cursor: default;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 5001;
}

.image-modal-close:hover {
    color: #ff4444;
}

/* Make generated image clickable */
.generated-image img {
    cursor: zoom-in;
    transition: transform 0.2s;
}

.generated-image img:hover {
    transform: scale(1.02);
}

/* Ultra Mode Special Style */
.model-option:has(input[value="flux-pro"]) .model-card {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    border: 2px solid #ff4757;
}

.model-option:has(input[value="flux-pro"]) .model-card .model-name {
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.model-option:has(input[value="flux-pro"]) .model-card .model-price,
.model-option:has(input[value="flux-pro"]) .model-card .model-desc {
    color: #ffe0e0;
}
    
/* ========== MOBILE FIX BY ASSISTANT ========== */
/* แก้ไขสำหรับมือถือโดยเฉพาะ */

/* Fix 1: Mode Selector */
@media (max-width: 968px) {
    .mode-selector {
        flex-wrap: wrap !important;
        justify-content: center !important;
        padding: 4px !important;
    }
    
    .mode-btn {
        flex: 0 0 calc(50% - 6px) !important;
        min-width: unset !important;
        font-size: 12px !important;
        padding: 8px 4px !important;
        min-height: 44px !important;
    }
}

/* Fix 2: ปุ่มใหญ่ขึ้น */
@media (max-width: 768px) {
    /* ปุ่มทั้งหมด */
    .upload-btn,
    .voice-btn,
    .send-btn,
    .action-btn,
    .quick-action-btn,
    .copy-btn,
    .save-btn,
    .share-btn,
    .favorite-btn,
    .continue-btn {
        min-height: 40px !important;    /* ลดจาก 44px */
        padding: 10px 14px !important;  /* ลดจาก 12px 16px */
        font-size: 13px !important;     /* ลดจาก 14px */
    }
    
    /* Star Rating */
    .star-rating {
        gap: 12px !important;
    }
    
    .star {
        font-size: 36px !important;
        padding: 4px !important;
    }
    
    /* Input */
    .message-input {
        font-size: 16px !important;
        min-height: 60px !important;
    }
    
    /* Character Library Full Screen */
    .character-library.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 9999 !important;
        display: block !important;
    }
}

/* Fix 3: Image Mode Panel */
@media (max-width: 768px) {
    #imageInfo {
        display: none !important;
    }
    
    .main-content {
        display: block !important;
    }
    
    .chat-panel {
        height: calc(100vh - 200px) !important;
    }
}
/* ========== END MOBILE FIX ========== */

/* ========== MOBILE DROPDOWN MODE SELECTOR ========== */
@media (max-width: 768px) {
    /* ซ่อน mode selector เดิม */
    .mode-selector {
        display: none !important;
    }
    
    /* แสดง dropdown แทน */
    .mobile-mode-dropdown {
        display: block !important;
        width: 100%;
        padding: 10px 14px;         /* ลดจาก 12px 16px */
        background: var(--surface-light);
        border: 1px solid var(--border);
        border-radius: 10px;        /* ลดจาก 12px */
        color: white;
        font-size: 14px;            /* ลดจาก 16px */
        font-family: 'Kanit', sans-serif;
        margin-bottom: 8px;         /* ลดจาก 12px */
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;      /* ลดจาก 20px */
        padding-right: 36px;        /* ลดจาก 40px */
    }

    
    
    /* Mobile info collapsed */
    .mobile-info-toggle {
        display: block !important;
        width: 100%;
        padding: 12px;
        background: var(--surface-light);
        border: none;
        border-radius: 8px;
        color: var(--text);
        text-align: left;
        cursor: pointer;
        margin-bottom: 12px;
        font-family: 'Kanit', sans-serif;
    }
    
    .mobile-info-content {
        display: none;
        background: var(--surface);
        padding: 16px;
        border-radius: 8px;
        margin-bottom: 12px;
    }
    
    .mobile-info-content.show {
        display: block;
    }
}

/* Desktop - ซ่อน dropdown */
.mobile-mode-dropdown,
.mobile-fab-menu,
.mobile-info-toggle {
    display: none;
}
/* ========== END MOBILE DROPDOWN ========== */

/* Image Gen Button - Special Style */
.mode-btn.new-feature {
    position: relative;
    /* ใช้สีปกติเหมือนปุ่มอื่น */
    background: transparent;
    border: none;
    color: var(--text-secondary) !important;
}

/* เมื่อ active */
.mode-btn.new-feature.active {
    background: var(--primary);
    color: white !important;
}

.mode-btn.new-feature:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(255, 71, 87, 0.4);
}

/* NEW Badge */
.new-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #00ff00;
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Active state สำหรับ Image Gen */
.mode-btn.new-feature.active {
    background: linear-gradient(135deg, #ff4757 0%, #ee5a6f 100%);
    box-shadow: 0 0 30px rgba(255, 71, 87, 0.5);
}

.mode-btn.new-feature::after {
    content: 'สร้างภาพด้วย AI!';
    position: absolute;
    top: 100%;
    margin-top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.mode-btn.new-feature:hover::after {
    opacity: 1;
}

/* FAB Tools - อยู่เหนือคอร์ส */
.fab-tools {
    position: fixed;
    bottom: 160px !important;
    right: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    animation: float 3s ease-in-out infinite;  /* เพิ่มบรรทัดนี้ */
}

/* Hover effect - ขยายเหมือนปุ่มอื่น */
.fab-tools:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
    padding: 16px 32px;
}

/* Icon animation */
.fab-tools .fab-icon {
    font-size: 20px;
    animation: pulse 2s infinite;  /* เพิ่มบรรทัดนี้ */
}

/* Mobile */
@media (max-width: 768px) {
    .fab-tools {
        bottom: 150px;
        right: 20px;
        padding: 12px;
        border-radius: 50%;
        min-width: 56px;
        width: 56px;
        height: 56px;
        justify-content: center;
    }
    
    .fab-tools:hover {
        padding: 12px; /* ไม่ขยายบนมือถือ */
    }
    
    .fab-tools .fab-text {
        display: none;
    }
    
    .fab-tools .fab-icon {
        font-size: 24px;
    }
}

/* เพิ่ม Glow effect เหมือนปุ่มคอร์ส */
.fab-tools::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: glow 2s ease-in-out infinite;
}

/* ซ่อนใน mobile ถ้าต้องการ */
@media (max-width: 968px) {
    .fab-tools,
    .fab-tools-menu {
        display: none !important;
        visibility: hidden !important;
    }
}
.fab-tools-menu {
    position: fixed !important;
    bottom: 160px !important;  /* ปรับให้อยู่ระดับเดียวกับปุ่ม Tools */
    right: 85px !important;    /* ขยับไปทางซ้าย */
    display: none;
    flex-direction: column !important;
    gap: 10px !important;
    z-index: 9999 !important;
}

.mini-fab {
    background: #1a1a1a !important;
    color: white !important;
    border: 2px solid #9333ea !important;
    border-radius: 50% !important;  /* ทำให้กลม */
    width: 48px !important;         /* ขนาดคงที่ */
    height: 48px !important;        /* ขนาดคงที่ */
    padding: 0 !important;          /* ลบ padding */
    cursor: pointer !important;
    font-family: 'Kanit', sans-serif !important;
    font-size: 20px !important;     /* ขนาด icon */
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;  /* จัดกึ่งกลาง */
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3) !important;
}

.mini-fab:hover {
    background: #9333ea !important;
    border-color: #9333ea !important;
    transform: translateX(-10px) scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.5) !important;
}

/* ทำให้ปุ่ม FAB หลักทั้งหมดเป็นแบบกลม */
.fab-tools,
.fab-course,
.fab-announcement {
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    justify-content: center !important;
    align-items: center !important;
}

/* ซ่อนข้อความ แสดงแค่ icon */
.fab-tools .fab-text,
.fab-course .fab-text,
.fab-announcement .fab-text {
    display: none !important;
}

/* ขนาด icon */
.fab-tools .fab-icon,
.fab-course .fab-icon,
.fab-announcement .fab-icon {
    font-size: 24px !important;
    margin: 0 !important;
}

/* ยกเลิก hover ที่ขยาย padding */
.fab-tools:hover,
.fab-course:hover,
.fab-announcement:hover {
    padding: 0 !important;
    transform: translateY(-3px) scale(1.1) !important;
}

/* ปรับตำแหน่งให้พอดี */
.fab-announcement {
    bottom: 20px !important;
}

.fab-course {
    bottom: 90px !important;
}

.fab-tools {
    bottom: 160px !important;
}

/* Mini fab ให้เล็กลงหน่อย */
.mini-fab {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
}

/* Notification */
.notification {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Confirmation Modal */
.confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.confirmation-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 2px solid var(--warning);
}

.confirmation-content h3 {
    color: var(--warning);
    margin-bottom: 16px;
}

.confirmation-content p {
    margin-bottom: 12px;
    color: var(--text);
}

.confirmation-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.confirm-btn, .cancel-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.confirm-btn {
    background: var(--success);
    color: white;
}

.confirm-btn:hover {
    background: #059669;
}

.cancel-btn {
    background: var(--surface-light);
    color: var(--text);
}

.cancel-btn:hover {
    background: var(--error);
    color: white;
}

/* AI Chat Styles */
.message-content pre {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content code {
    background: var(--surface-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.chat-model-info {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Chat Model Select */
#chatModelSelect {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
}

#chatModelSelect:focus {
    outline: none;
    border-color: var(--primary);
}

#chatModelSelect optgroup {
    background: var(--surface);
    color: var(--text-secondary);
}

#chatModelSelect option {
    background: var(--surface-light);
    color: var(--text);
    padding: 8px;
}

/* Chat model info style */
.chat-model-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.message:hover .chat-model-info {
    opacity: 0.8;
}

/* แก้ไขปุ่ม FAB หาย */
.fab-announcement,
.fab-course,
.fab-tools {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999 !important;
}

/* AI Chat NEW Badge */
.mode-btn.new-feature-chat {
    position: relative;
}

/* ปรับ NEW Badge ให้เหมือนกันทั้งหมด */
.new-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #00ff00;
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    animation: blink 1s infinite;
}

/* Force hide FAB Tools on all mobile */
@media screen and (max-width: 968px) {
    .fab-tools,
    #fabToolsMenu,
    .fab-tools-menu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* Music Video Template Styles */
.music-template-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
    overflow-y: auto;
}

.music-template-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 2px solid var(--primary);
}

.template-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
    text-align: center;
}

.template-form .form-group {
    margin-bottom: 24px;
}

/* Camera Angle Styles */
.camera-angle-item {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
}

.camera-angle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.camera-angle-header h5 {
    margin: 0;
    color: var(--primary);
    font-size: 16px;
}

.remove-camera-angle-btn {
    background: var(--error);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.remove-camera-angle-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.add-camera-angle-container {
    text-align: center;
    margin: 20px 0;
}

.add-camera-angle-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-camera-angle-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.add-camera-angle-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.camera-angle-hint {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.template-form label {
    display: block;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 16px;
}

.template-form textarea,
.template-form input {
    width: 100%;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text);
    font-family: 'Kanit', sans-serif;
    font-size: 15px;
    transition: all 0.3s ease;
}

.template-form textarea:focus,
.template-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.template-form small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.advanced-options {
    margin: 24px 0;
    padding: 20px;
    background: rgba(147, 51, 234, 0.05);
    border-radius: 12px;
}

.toggle-advanced {
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    width: 100%;
    transition: all 0.3s ease;
}

.toggle-advanced:hover {
    background: var(--primary);
    color: white;
}

.advanced-fields {
    margin-top: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.form-actions .generate-btn {
    flex: 1;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.form-actions .generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.4);
}

.template-tips {
    margin-top: 32px;
    padding: 20px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.template-tips h4 {
    color: #10b981;
    margin-bottom: 12px;
}

.template-tips ul {
    margin: 0;
    padding-left: 20px;
}

.template-tips li {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .music-template-content {
        padding: 24px 20px;
        margin: 20px 0;
    }
    
    .template-form textarea {
        min-height: 60px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
}

/* Special style for music video button */
#musicVideoBtn {
    background: linear-gradient(135deg, #f59e0b, #dc2626);
    border-color: #f59e0b;
    color: white;
}

#musicVideoBtn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

.fab-music {
    position: fixed;
    bottom: 300px;
    right: 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
    color: white;
    border: none;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    animation: float 3s ease-in-out infinite;
}

.fab-music:hover {
    transform: translateY(-3px) scale(1.1) !important;
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.5);
}

.fab-music .fab-icon {
    font-size: 24px !important;
    margin: 0 !important;
}

.fab-music .fab-text {
    display: none !important;
}

/* BYOK Button */
.byok-btn {
    background: var(--surface-light);
    color: var(--primary);
    border: 2px solid var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.byok-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.byok-btn.active {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* BYOK Modal */
.byok-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.byok-modal-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.byok-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    margin-bottom: 24px;
}

.byok-status.inactive {
    background: rgba(147, 51, 234, 0.1);
    border-color: rgba(147, 51, 234, 0.3);
}

.api-key-input-group {
    margin: 24px 0;
}

.api-key-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--primary);
}

.api-tutorial {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.tutorial-steps {
    list-style: none;
    padding: 0;
    margin: 16px 0 0 0;
}

.tutorial-steps li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tutorial-steps li:last-child {
    border-bottom: none;
}

.step-number {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* FAB Video Analyzer */
.fab-video-analyzer {
    position: fixed;
    bottom: 230px;  /* เปลี่ยนจาก 90px */
    right: 20px;
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);  /* เปลี่ยนเป็นสีม่วง */
    color: white;
    border: none;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);  /* เปลี่ยนเป็นแสงสีม่วง */
    transition: all 0.3s ease;
    z-index: 999;
    animation: float 3s ease-in-out infinite;
}

.fab-video-analyzer:hover {
    transform: translateY(-3px) scale(1.1) !important;
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.5);  /* เปลี่ยนเป็นแสงสีม่วง */
}

.fab-video-analyzer .fab-icon {
    font-size: 24px !important;
    margin: 0 !important;
}

/* Template Button Section - Smaller */
.template-button-section {
    margin-bottom: 12px;
    text-align: center;
}

.template-form-btn {
    padding: 10px 20px;
    background: var(--surface-light);
    color: var(--text);
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.template-form-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.template-info {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Template Form Modal */
.template-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
    overflow-y: auto;
}

.template-form-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.template-form-content h2 {
    color: var(--primary);
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 16px;
}

.template-select,
.template-input,
.template-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.template-select:focus,
.template-input:focus,
.template-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.template-textarea {
    min-height: 100px;
    resize: vertical;
}

.character-count-select {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.char-count-btn {
    padding: 10px 20px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.char-count-btn:hover {
    border-color: var(--primary);
}

.char-count-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.template-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.generate-template-btn {
    flex: 1;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.generate-template-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.4);
}

.cancel-template-btn {
    padding: 16px 32px;
    background: var(--surface-light);
    color: var(--text);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .template-form-content {
        padding: 24px 20px;
    }
    
    .character-count-select {
        justify-content: space-between;
    }
    
    .char-count-btn {
        flex: 1;
        min-width: 60px;
    }
    
    .template-form-actions {
        flex-direction: column;
    }
    
    .cancel-template-btn {
        width: 100%;
    }
}

/* Template Form Button Orange Style - สีเหลืองส้มสวยๆ */
.template-button-inline {
    display: inline-flex !important;
}

.template-form-btn-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Kanit', sans-serif;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.template-form-btn-orange:hover {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.template-form-btn-orange:active {
    transform: translateY(0);
}

/* ปรับ upload-section ให้ปุ่มจัดเรียงสวยงาม */
.upload-section {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ปรับขนาด upload-tip บนมือถือ */
@media (max-width: 768px) {
    .upload-section {
        gap: 8px;
    }
    
    .template-form-btn-orange {
        flex: 1;
        min-width: 140px;
        justify-content: center;
    }
    
    .upload-tip {
        width: 100%;
        margin-top: 8px;
        font-size: 11px;
        text-align: center;
    }
}
/* Mic Button for Template Form */
.mic-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.mic-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mic-btn.listening {
    color: #ff0000;
    animation: pulse 1s infinite;
    background: rgba(255, 0, 0, 0.1);
}

/* ปรับ label ให้เป็น flex */
.template-form .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-presets {
    margin: 20px 0;
    padding: 16px;
    background: rgba(147, 51, 234, 0.05);
    border-radius: 12px;
}

.quick-presets h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #9333ea;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.preset-btn {
    padding: 10px;
    background: #262626;
    border: 1px solid #404040;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: #9333ea;
    border-color: #9333ea;
    transform: translateY(-2px);
}

/* Effects Checkboxes */
.effects-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    background: #262626;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    background: #363636;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
}

/* Preview Box */
.template-preview-section {
    margin-top: 24px;
    padding: 16px;
    background: #1a1a1a;
    border-radius: 12px;
    border: 1px solid #363636;
}

.template-preview-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #10b981;
}

.preview-box {
    padding: 16px;
    background: #0a0a0a;
    border-radius: 8px;
    min-height: 100px;
    font-size: 14px;
    line-height: 1.6;
    color: #e0e0e0;
}

/* Form Actions Update */
.template-form-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.reset-template-btn,
.save-preset-btn {
    padding: 14px;
    background: #262626;
    color: white;
    border: 1px solid #404040;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.reset-template-btn:hover {
    background: #f59e0b;
    border-color: #f59e0b;
}

.save-preset-btn:hover {
    background: #10b981;
    border-color: #10b981;
}

/* Tooltips */
.form-group label {
    position: relative;
}

.tooltip {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #262626;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.form-group:hover .tooltip {
    opacity: 1;
}

/* Improved Form Layout */
.template-form-body {
    display: grid;
    gap: 20px;
}

.form-section {
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #9333ea;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .template-form-actions {
        grid-template-columns: 1fr;
    }
    
    .effects-checkboxes {
        grid-template-columns: 1fr;
    }
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Character Template Modal Styles */
.character-template-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: flex-start; /* Changed from center to flex-start for mobile */
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
}

.character-template-content {
    background: #1a1a1a;
    border-radius: 24px;
    padding: 32px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.character-template-form {
    margin-top: 20px;
}

.template-section {
    background: #262626;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #404040;
}

.template-section h3 {
    font-size: 18px;
    color: #9333ea;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.template-section input,
.template-section select {
    width: 100%;
    padding: 12px 16px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-family: 'Kanit', sans-serif;
}

.template-section input:focus,
.template-section select:focus {
    outline: none;
    border-color: #9333ea;
}

.template-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    justify-content: center; /* เพิ่มบรรทัดนี้ */
}

.generate-from-template-btn {
    flex: none; /* เปลี่ยนจาก flex: 1 */
    min-width: 250px; /* กำหนดความกว้างขั้นต่ำ */
    padding: 16px 32px;
    background: linear-gradient(135deg, #9333ea, #ec4899);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    pointer-events: auto !important;
    position: relative;
    z-index: 10002;
}

.save-template-btn,
.load-template-btn {
    padding: 16px 24px;
    background: #262626;
    color: white;
    border: 1px solid #404040;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .character-template-content {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .template-actions {
        flex-direction: column;
    }
    
    .template-actions button {
        width: 100%;
    }
}

.character-template-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #9333ea, #ec4899);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.character-template-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.4);
}

/* Character Template Button Inline Style */
.character-template-button-inline {
    display: inline-block;
}

.character-template-btn-inline {
    padding: 10px 20px;
    background: linear-gradient(135deg, #9333ea, #ec4899);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.character-template-btn-inline:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(147, 51, 234, 0.3);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .upload-section {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .character-template-btn-inline {
        width: 100%;
        margin-top: 8px;
    }
}

/* Hide template buttons based on body class */
body.mode-chat #templateButtonSection,
body.mode-character #templateButtonSection,
body.mode-image #templateButtonSection,
body.mode-library #templateButtonSection {
    display: none !important;
}

body.mode-promptmaster #characterTemplateButtonSection,
body.mode-multichar #characterTemplateButtonSection,
body.mode-chat #characterTemplateButtonSection,
body.mode-image #characterTemplateButtonSection,
body.mode-library #characterTemplateButtonSection {
    display: none !important;
}

/* Show only in correct modes */
body.mode-promptmaster #templateButtonSection,
body.mode-multichar #templateButtonSection {
    display: inline-block !important;
}

body.mode-character #characterTemplateButtonSection {
    display: inline-block !important;
}

/* Image Prompt Form Styles */
.image-prompt-form {
    padding: 0;
}

.image-prompt-form .form-section {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.image-prompt-form .form-section h4 {
    color: var(--primary);
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.image-prompt-form .form-group {
    margin-bottom: 16px;
}

.image-prompt-form .form-group label {
    display: block;
    color: var(--text);
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.image-prompt-form .form-input,
.image-prompt-form .form-select,
.image-prompt-form .form-textarea {
    width: 100%;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Kanit', sans-serif;
}

.image-prompt-form .form-textarea {
    resize: vertical;
    min-height: 80px;
}

.image-prompt-form .form-input:focus,
.image-prompt-form .form-select:focus,
.image-prompt-form .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.image-prompt-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.image-prompt-form .radio-group {
    display: flex;
    gap: 16px;
    padding: 8px 0;
}

.image-prompt-form .radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
}

.image-prompt-form .radio-group input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Quick Template Buttons */
.quick-template-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.quick-template-btn {
    padding: 10px 16px;
    background: var(--surface-light);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.quick-template-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Form Action Buttons */
.image-prompt-form .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

.generate-prompt-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #0891b2, #06b6d4);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.generate-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(8, 145, 178, 0.3);
}

.clear-form-btn {
    padding: 14px 24px;
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.clear-form-btn:hover {
    background: var(--surface);
    border-color: var(--primary);
}

/* Mobile Responsive for Image Form */
@media (max-width: 768px) {
    .image-prompt-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .quick-template-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .image-prompt-form .form-actions {
        flex-direction: column;
    }
    
    .image-prompt-form .form-actions button {
        width: 100%;
    }
}

/* Ensure info panels are visible on desktop */
@media (min-width: 969px) {
    body.mode-promptmaster .main-content,
    body.mode-image .main-content,
    body.mode-character .main-content,
    body.mode-chat .main-content,
    body.mode-imagegen .main-content,
    body.mode-library .main-content {
        grid-template-columns: 380px 1fr !important;
    }
    
    body.mode-promptmaster #multicharInfo,
    body.mode-image #imageInfo,
    body.mode-character #characterInfo,
    body.mode-chat #chatInfo,
    body.mode-imagegen #imageGenInfo {
        display: block !important;
    }
    
    /* Show character library for library mode */
    body.mode-library #characterLibrary {
        display: block !important;
    }
    
    /* Desktop styling for image generation buttons */
    .image-gen-internal-btn,
    .image-gen-external-btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        border-radius: 8px !important;
        border: none !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        font-family: 'Kanit', sans-serif !important;
    }
    
    .image-gen-internal-btn {
        background: linear-gradient(135deg, #9333ea, #7c3aed) !important;
        color: white !important;
    }
    
    .image-gen-internal-btn:hover {
        background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3) !important;
    }
    
    .image-gen-external-btn {
        background: linear-gradient(135deg, #06b6d4, #0891b2) !important;
        color: white !important;
    }
    
    .image-gen-external-btn:hover {
        background: linear-gradient(135deg, #0891b2, #0e7490) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3) !important;
    }
}

/* ปุ่ม My Character */
.my-char-btn {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

.my-char-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-1px);
}

.my-char-btn-small {
    background: #9333ea;
    color: white;
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.3s ease;
}

.my-char-btn-small:hover {
    background: #7c3aed;
}

/* Character Picker Modal */
.character-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    padding: 20px;
}

.character-picker-content {
    background: #1a1a1a;
    border-radius: 24px;
    padding: 32px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.picker-header h3 {
    margin: 0;
    color: #9333ea;
}

.picker-body {
    flex: 1;
    overflow-y: auto;
}

.character-picker-list {
    display: grid;
    gap: 16px;
}

.character-picker-item {
    background: #262626;
    border: 2px solid #404040;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.character-picker-item:hover {
    border-color: #9333ea;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(147, 51, 234, 0.3);
}

.picker-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.picker-item-header h4 {
    margin: 0;
    color: white;
}

.select-indicator {
    background: #9333ea;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.character-picker-item:hover .select-indicator {
    opacity: 1;
}

.picker-item-preview {
    color: #a1a1aa;
    font-size: 14px;
    line-height: 1.5;
}

.empty-picker {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .character-picker-content {
        padding: 24px 16px;
        margin: 16px;
    }
    
    .my-char-btn {
        display: block;
        margin: 8px 0;
        width: 100%;
    }
}
/* ========== MOBILE BUTTON SIZE OPTIMIZATION ========== */
@media (max-width: 768px) {
    /* Scene Builder Button */
    .scene-builder-btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
        margin-top: 12px !important;
        border-radius: 10px !important;
    }
    
    /* Model Cards in Image Mode */
    .model-card {
        padding: 12px !important;
        border-radius: 10px !important;
    }
    
    .model-name {
        font-size: 14px !important;
        margin-bottom: 2px !important;
    }
    
    .model-price {
        font-size: 13px !important;
    }
    
    .model-desc {
        font-size: 12px !important;
        margin-top: 2px !important;
    }
    
    /* Aspect Ratio Buttons */
    .ratio-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
    }
    
    .ratio-selector {
        gap: 6px !important;
        margin-top: 8px !important;
    }
    
    /* Upload Section */
    .upload-section {
        gap: 8px !important;
        margin-bottom: 8px !important;
    }
    
    /* Send Button */
    .send-btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }
    
    /* Chat Input Area */
    .chat-input-area {
        padding: 12px !important;
    }
    
    /* Mode Notice */
    .mode-notice {
        padding: 8px 12px !important;
        font-size: 12px !important;
        margin-bottom: 8px !important;
        border-radius: 6px !important;
    }
    
    /* Mobile Info */
    .mobile-info-toggle {
        padding: 10px !important;
        font-size: 13px !important;
        margin-bottom: 8px !important;
        border-radius: 6px !important;
    }
    
    .mobile-info-content {
        padding: 12px !important;
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }
    
    .mobile-info-content h4 {
        font-size: 15px !important;
        margin-bottom: 8px !important;
    }
    
    .mobile-info-content p {
        font-size: 12px !important;
        margin-bottom: 6px !important;
        line-height: 1.4 !important;
    }
    
    /* Container and Header */
    .container {
        padding: 10px !important;
    }
    
    .header {
        padding: 12px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }
    
    /* Logo */
    .logo-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
    }
    
    .logo-text h1 {
        font-size: 20px !important;
    }
    
    .logo-text p {
        font-size: 12px !important;
    }
    
    /* Status Bar */
    .status-bar {
        padding: 8px 12px !important;
        font-size: 11px !important;
        margin-top: 8px !important;
        border-radius: 10px !important;
    }
    
    /* Chat Messages */
    .chat-messages {
        padding: 12px !important;
        gap: 12px !important;
    }
    
    .message-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
        border-radius: 10px !important;
    }
    
    .message-content {
        padding: 12px !important;
        border-radius: 12px !important;
        font-size: 13px !important;
    }
    
    /* Prompt Actions */
    .prompt-actions {
        gap: 6px !important;
        margin-top: 12px !important;
    }
    
    .prompt-actions button {
        padding: 8px 12px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
    }
    
    /* Image generation buttons */
    .image-gen-internal-btn {
        background: linear-gradient(135deg, #ec4899, #8b5cf6) !important;
        color: white !important;
    }
    
    .image-gen-external-btn {
        background: linear-gradient(135deg, #3b82f6, #10b981) !important;
        color: white !important;
    }
    
    /* VEO3 Prompt Box */
    .veo3-prompt {
        padding: 16px !important;
        border-radius: 10px !important;
        margin-top: 8px !important;
    }
    
    .prompt-header {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    .prompt-content {
        padding: 12px !important;
        font-size: 13px !important;
        margin-bottom: 12px !important;
    }
    
    /* Image Actions */
    .image-actions {
        gap: 8px !important;
        margin-top: 8px !important;
    }
    
    .download-btn, .retry-btn {
        padding: 8px 14px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
    }
    
    /* Template Buttons */
    .template-form-btn,
    .template-form-btn-orange {
        padding: 8px 14px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
    }
    
    /* Character Template Button */
    .character-template-btn-inline {
        padding: 8px 14px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
    }
    
    /* Enhance Button */
    .enhance-btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
    }
    
    /* Input Wrapper */
    .input-wrapper {
        gap: 8px !important;
    }
    
    /* Expand Button */
    .expand-btn {
        padding: 3px 6px !important;
        font-size: 11px !important;
        top: 6px !important;
        right: 6px !important;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    /* Even smaller adjustments */
    .action-btn {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
    
    .model-card {
        padding: 10px !important;
    }
    
    .ratio-btn {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }
    
    .message-input {
        height: 45px !important;
        min-height: 40px !important;
    }
}

/* ========== แก้ไขปุ่ม FAB ให้เล็กลงและเรียงสวยงาม ========== */
@media (max-width: 768px) {
    /* ลดขนาดปุ่ม FAB ทั้งหมด */
    .fab-announcement,
    .fab-course,
    .fab-tools,
    .fab-music,
    .fab-video-analyzer {
        width: 48px !important;      /* ลดจาก 56px */
        height: 48px !important;     /* ลดจาก 56px */
        right: 15px !important;      /* ขยับเข้ามาหน่อย */
    }
    
    /* ลดขนาด icon */
    .fab-announcement .fab-icon,
    .fab-course .fab-icon,
    .fab-tools .fab-icon,
    .fab-music .fab-icon,
    .fab-video-analyzer .fab-icon {
        font-size: 20px !important;  /* ลดจาก 24px */
    }
    
    /* จัดระยะห่างใหม่ให้สวยงาม */
    .fab-announcement {
        bottom: 15px !important;     /* ล่างสุด */
    }
    
    .fab-course {
        bottom: 70px !important;     /* ห่างจากล่าง 70px */
    }
    
    .fab-tools {
        bottom: 125px !important;    /* ห่างจากล่าง 125px */
    }
    
    .fab-music {
        bottom: 180px !important;    /* ห่างจากล่าง 180px */
    }
    
    .fab-video-analyzer {
        bottom: 235px !important;    /* ห่างจากล่าง 235px */
    }
    
    /* ลด shadow และ effect */
    .fab-announcement,
    .fab-course,
    .fab-tools,
    .fab-music,
    .fab-video-analyzer {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* ลด animation */
    .fab-announcement:hover,
    .fab-course:hover,
    .fab-tools:hover,
    .fab-music:hover,
    .fab-video-analyzer:hover {
        transform: translateY(-2px) scale(1.05) !important;
    }
    
    /* ซ่อน glow effect บนมือถือ */
    .fab-announcement::after,
    .fab-course::after,
    .fab-tools::after,
    .fab-music::after,
    .fab-video-analyzer::after {
        display: none !important;
    }
    
    /* ปุ่ม Reset ด้านล่าง */
    #resetBtn {
        padding: 8px 16px !important;
        font-size: 13px !important;
        bottom: 10px !important;
        right: 10px !important;
    }
}

/* สำหรับจอเล็กมาก */
@media (max-width: 480px) {
    /* ทำให้ปุ่ม FAB เล็กลงอีก */
    .fab-announcement,
    .fab-course,
    .fab-tools,
    .fab-music,
    .fab-video-analyzer {
        width: 44px !important;
        height: 44px !important;
        right: 12px !important;
    }
    
    .fab-announcement .fab-icon,
    .fab-course .fab-icon,
    .fab-tools .fab-icon,
    .fab-music .fab-icon,
    .fab-video-analyzer .fab-icon {
        font-size: 18px !important;
    }
    
    /* ลดระยะห่าง */
    .fab-announcement {
        bottom: 12px !important;
    }
    
    .fab-course {
        bottom: 62px !important;
    }
    
    .fab-tools {
        bottom: 112px !important;
    }
    
    .fab-music {
        bottom: 162px !important;
    }
    
    .fab-video-analyzer {
        bottom: 212px !important;
    }
}

/* ========== แก้ไขปุ่มอื่นๆ เพิ่มเติม ========== */
@media (max-width: 768px) {
    /* ปุ่ม Template Form สีส้ม */
    #templateButtonSection .template-form-btn-orange {
        padding: 8px 14px !important;
        font-size: 13px !important;
        margin: 4px !important;
    }
    
    /* ปุ่ม เพิ่ม URL และ พูดเลย */
    .upload-section {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }
    
    .upload-btn,
    .voice-btn {
        flex: 1 !important;
        min-width: 120px !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
    
    /* ปุ่ม สร้าง Prompt */
    .send-btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
        min-height: 40px !important;
    }
    
    /* Status bar ด้านล่าง */
    .status-bar {
        padding: 8px 12px !important;
        font-size: 11px !important;
        gap: 8px !important;
    }
    
    .status-item {
        font-size: 11px !important;
    }
    
    /* ช่องพิมพ์ข้อความ */
    .message-input {
        font-size: 14px !important;
        padding: 10px 14px !important;
        min-height: 45px !important;
        height: 50px !important;
    }
    
    /* Upload tip */
    .upload-tip {
        font-size: 11px !important;
        margin-left: 8px !important;
    }
}
/* ========== จัดปุ่ม 3 ปุ่มให้อยู่บรรทัดเดียว ========== */
@media (max-width: 768px) {
    /* จัด layout ปุ่มทั้ง 3 */
    .upload-section {
        display: flex !important;
        flex-wrap: nowrap !important;  /* บังคับให้อยู่บรรทัดเดียว */
        gap: 4px !important;
        margin-bottom: 10px !important;
        width: 100% !important;
    }
    
    /* ทำให้ปุ่มเล็กลงและเท่ากันทั้ง 3 ปุ่ม */
    .upload-btn,
    .voice-btn,
    #templateButtonSection {
        flex: 1 !important;
        min-width: auto !important;
        max-width: 33.33% !important;
    }
    
    .upload-btn,
    .voice-btn,
    .template-form-btn-orange {
        width: 100% !important;
        padding: 8px 4px !important;  /* ลด padding ซ้ายขวา */
        font-size: 11px !important;   /* ลดขนาดตัวอักษร */
        border-radius: 6px !important;
        margin: 0 !important;
        white-space: nowrap !important;  /* ไม่ให้ข้อความขึ้นบรรทัดใหม่ */
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* ซ่อน icon ใน template button เพื่อประหยัดพื้นที่ */
    .template-form-btn-orange::before {
        display: none !important;
    }
    
    /* ซ่อน upload tip */
    .upload-tip {
        display: none !important;
    }
}

/* ========== ทำให้ช่องกรอกข้อความเด่นและใหญ่ขึ้น ========== */
@media (max-width: 768px) {
    /* ช่องกรอกข้อความหลัก */
    .message-input {
        width: 100% !important;
        min-height: 80px !important;   /* ใหญ่ขึ้น */
        height: 80px !important;
        font-size: 16px !important;    /* ตัวอักษรใหญ่ขึ้น */
        padding: 14px 16px !important;
        background: #1a1a1a !important;
        border: 2px solid #9333ea !important;  /* ขอบสีม่วงเด่นชัด */
        box-shadow: 0 0 10px rgba(147, 51, 234, 0.2) !important;
        transition: all 0.3s ease !important;
    }
    
    /* เมื่อ focus */
    .message-input:focus {
        border-color: #ec4899 !important;
        box-shadow: 0 0 20px rgba(236, 72, 153, 0.3) !important;
        background: #262626 !important;
    }
    
    /* Placeholder text */
    .message-input::placeholder {
        color: #9333ea !important;
        opacity: 0.8 !important;
        font-size: 14px !important;
    }
    
    /* Input wrapper */
    .input-wrapper {
        margin-bottom: 10px !important;
        position: relative !important;
    }
    
    /* เพิ่ม label บอกว่าให้พิมพ์ตรงนี้ */
    .input-wrapper::before {
        content: "👇 พิมพ์ข้อความตรงนี้" !important;
        position: absolute !important;
        top: -20px !important;
        left: 10px !important;
        font-size: 12px !important;
        color: #9333ea !important;
        font-weight: 600 !important;
        background: #0f0f0f !important;
        padding: 0 8px !important;
        border-radius: 4px !important;
    }
    
    /* ปุ่ม Send */
    .send-btn {
        padding: 12px 20px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        min-height: 45px !important;
        background: linear-gradient(135deg, #9333ea, #ec4899) !important;
        box-shadow: 0 4px 15px rgba(147, 51, 234, 0.3) !important;
    }
    
    .send-btn:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 6px 20px rgba(147, 51, 234, 0.4) !important;
    }
}

/* ========== จัด Layout ใหม่สำหรับมือถือ ========== */
@media (max-width: 768px) {
    /* Chat input area */
    .chat-input-area {
        padding: 10px !important;
        background: rgba(147, 51, 234, 0.05) !important;
        border-top: 2px solid #9333ea !important;
    }
    
    /* Mode notice */
    .mode-notice {
        margin-bottom: 8px !important;
        padding: 8px !important;
        font-size: 12px !important;
        background: rgba(147, 51, 234, 0.1) !important;
        border: 1px solid rgba(147, 51, 234, 0.3) !important;
    }
}

/* ========== สำหรับจอเล็กมาก ========== */
@media (max-width: 480px) {
    /* ปุ่มเล็กลงอีก */
    .upload-btn,
    .voice-btn,
    .template-form-btn-orange {
        font-size: 10px !important;
        padding: 8px 2px !important;
    }
    
    /* ช่องกรอกข้อความ */
    .message-input {
        min-height: 70px !important;
        height: 70px !important;
        font-size: 15px !important;
    }
}

/* ========== Animation เพื่อดึงดูดความสนใจ ========== */
@keyframes glowPulse {
    0% { box-shadow: 0 0 10px rgba(147, 51, 234, 0.2); }
    50% { box-shadow: 0 0 20px rgba(147, 51, 234, 0.4); }
    100% { box-shadow: 0 0 10px rgba(147, 51, 234, 0.2); }
}

@media (max-width: 768px) {
    /* ทำให้ช่องกรอกข้อความมี animation เบาๆ */
    .message-input {
        animation: glowPulse 3s ease-in-out infinite !important;
    }
    
    .message-input:focus {
        animation: none !important;
    }
}
/* ========== ปรับขนาดปุ่มใน Info Panel บนมือถือ ========== */
@media (max-width: 768px) {
    /* ปุ่ม Templates และ Favorites ในทุกโหมด */
    .quick-actions-bar {
        padding: 6px !important;
        gap: 6px !important;
        margin-top: 8px !important;
        margin-bottom: 12px !important;
    }
    
    .quick-actions-bar .action-btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
        min-height: 36px !important;
    }
    
    .action-icon {
        font-size: 14px !important;
    }
    
    .action-text {
        font-size: 12px !important;
    }
    
    /* ปุ่ม สร้าง Prompt Master สีม่วง */
    .scene-builder-btn {
        width: 100% !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        margin-top: 12px !important;
        margin-bottom: 12px !important;
        border-radius: 8px !important;
        min-height: 40px !important;
    }
    
    /* ข้อความ bullet points */
    #multicharInfo ul,
    #generalInfo ul,
    #characterInfo ul {
        margin: 8px 0 !important;
        padding-left: 20px !important;
    }
    
    #multicharInfo li,
    #generalInfo li,
    #characterInfo li {
        font-size: 12px !important;
        margin-bottom: 4px !important;
        line-height: 1.4 !important;
    }
    
    /* หัวข้อ Prompt Master */
    #multicharInfo h3,
    #generalInfo h3,
    #characterInfo h3 {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }
    
    /* ปรับ info section */
    .info-section {
        margin-bottom: 16px !important;
        padding: 12px !important;
    }
    
    /* Tip cards */
    .tip-card {
        padding: 10px !important;
        margin-bottom: 6px !important;
    }
    
    .tip-card h4 {
        font-size: 14px !important;
        margin-bottom: 4px !important;
    }
    
    .tip-card p {
        font-size: 12px !important;
        line-height: 1.3 !important;
    }
}

/* ========== ปรับ Mobile Info Toggle ========== */
@media (max-width: 768px) {
    /* ปุ่ม ดูข้อมูล/วิธีใช้ */
    .mobile-info-toggle {
        padding: 8px 12px !important;
        font-size: 13px !important;
        margin-bottom: 8px !important;
        border-radius: 6px !important;
        background: var(--surface-light) !important;
        border: 1px solid var(--border) !important;
    }
    
    /* เนื้อหาเมื่อขยาย */
    .mobile-info-content {
        padding: 10px !important;
        font-size: 12px !important;
        background: var(--surface) !important;
        border-radius: 6px !important;
        margin-bottom: 8px !important;
    }
    
    .mobile-info-content h4 {
        font-size: 14px !important;
        margin-bottom: 6px !important;
        color: var(--primary) !important;
    }
    
    .mobile-info-content p {
        font-size: 12px !important;
        margin-bottom: 4px !important;
        line-height: 1.3 !important;
    }
    
    /* ปุ่มใน mobile info */
    .mobile-info-content button {
        padding: 8px 14px !important;
        font-size: 12px !important;
        margin: 4px !important;
    }
}

/* ========== Character Template Button ========== */
@media (max-width: 768px) {
    /* ปุ่ม Character Template สีม่วง */
    .character-template-btn {
        width: 100% !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        margin-top: 12px !important;
        margin-bottom: 12px !important;
        border-radius: 8px !important;
        min-height: 40px !important;
    }
}

/* ========== ปรับ Layout Info Panel ========== */
@media (max-width: 768px) {
    /* Info panel container */
    .info-panel {
        padding: 16px !important;
        border-radius: 12px !important;
    }
    
    /* ลดระยะห่างทั่วไป */
    #generalInfo,
    #characterInfo,
    #multicharInfo,
    #imageInfo,
    #chatInfo {
        padding: 0 !important;
    }
    
    /* Icon ใน info */
    .info-section .info-icon {
        font-size: 20px !important;
        margin-bottom: 8px !important;
    }
}

/* ========== Quick Actions ใน Mobile Info ========== */
@media (max-width: 768px) {
    /* ปุ่ม Templates/Favorites ใน mobile info */
    .mobile-info-content .quick-actions-bar {
        display: flex !important;
        gap: 6px !important;
        margin: 8px 0 !important;
        padding: 0 !important;
    }
    
    .mobile-info-content .action-btn {
        flex: 1 !important;
        padding: 8px 10px !important;
        font-size: 12px !important;
        min-height: 34px !important;
    }
}

/* ========== สำหรับจอเล็กมาก ========== */
@media (max-width: 480px) {
    /* ทำให้ทุกอย่างเล็กลงอีกนิด */
    .scene-builder-btn,
    .character-template-btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
        min-height: 36px !important;
    }
    
    .quick-actions-bar .action-btn {
        padding: 6px 10px !important;
        font-size: 11px !important;
        min-height: 32px !important;
    }
    
    .action-icon {
        font-size: 12px !important;
    }
}

/* ========== FAB MENU SYSTEM ========== */
/* ซ่อน FAB เดิมทั้งหมดบนมือถือ */
@media (max-width: 768px) {
    .fab-announcement,
    .fab-course,
    .fab-tools,
    .fab-music,
    .fab-video-analyzer {
        display: none !important;
    }
}

/* FAB Menu Container */
.fab-menu-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: none; /* ซ่อนเป็นค่าเริ่มต้น */
}

/* แสดงเฉพาะบนมือถือ */
@media (max-width: 768px) {
    .fab-menu-container {
        display: block;
    }
}

/* Backdrop */
.fab-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: -1;
}

.fab-menu-container.active .fab-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Main FAB Button - สีฟ้าเทอร์ควอยซ์ */
.fab-main {
    position: relative;
    width: 48px;  /* ลดจาก 56px */
    height: 48px; /* ลดจาก 56px */
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); /* สีฟ้าเทอร์ควอยซ์ */
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
}

.fab-main:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.fab-main:active {
    transform: scale(0.95);
}

/* Main FAB Icon */
.fab-main-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.plus-icon,
.close-icon {
    position: absolute;
    font-size: 24px; /* ลดจาก 28px */
    font-weight: 300;
    transition: all 0.3s ease;
}

.close-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

.fab-menu-container.active .plus-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.fab-menu-container.active .close-icon {
    opacity: 1;
    transform: rotate(0);
}

/* Badge - สีส้มแดง */
.fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f97316; /* สีส้ม */
    color: white;
    font-size: 10px; /* ลดจาก 11px */
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    border: 2px solid #0f0f0f;
    animation: badgePulse 2s infinite;
}

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

/* FAB Menu Items */
.fab-menu-items {
    position: absolute;
    bottom: 60px; /* ลดจาก 70px */
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px; /* ลดจาก 12px */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.fab-menu-container.active .fab-menu-items {
    opacity: 1;
    visibility: visible;
}

/* Individual FAB Items - พื้นหลังเข้ม */
.fab-item {
    position: relative;
    width: 42px; /* ลดจาก 48px */
    height: 42px; /* ลดจาก 48px */
    background: #1a1a1a; /* สีเข้มกว่าเดิม */
    border: 2px solid #06b6d4; /* ขอบสีฟ้า */
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transform: scale(0) translateY(20px);
    transition: all 0.3s ease;
}

.fab-menu-container.active .fab-item {
    transform: scale(1) translateY(0);
}

/* Stagger animation */
.fab-menu-container.active .fab-item:nth-child(1) { transition-delay: 0.05s; }
.fab-menu-container.active .fab-item:nth-child(2) { transition-delay: 0.1s; }
.fab-menu-container.active .fab-item:nth-child(3) { transition-delay: 0.15s; }
.fab-menu-container.active .fab-item:nth-child(4) { transition-delay: 0.2s; }
.fab-menu-container.active .fab-item:nth-child(5) { transition-delay: 0.25s; }

/* FAB Item Hover - สีฟ้าเข้ม */
.fab-item:hover {
    background: #0891b2;
    border-color: #06b6d4;
    transform: scale(1.1) translateY(0);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.5);
}

.fab-item .fab-icon {
    font-size: 18px; /* ลดจาก 20px */
}

/* Labels */
.fab-item::before {
    content: attr(data-label);
    position: absolute;
    right: 52px; /* ปรับตามขนาดใหม่ */
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px; /* ลดจาก 12px */
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.fab-item:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Improved main button animation */
.fab-menu-container.active .fab-main {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    transform: rotate(135deg);
}

/* Pulse effect when closed - สีฟ้า */
.fab-main::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 50%;
    opacity: 0.4;
    animation: fabPulse 2s infinite;
    z-index: -1;
}

@keyframes fabPulse {
    0% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(1); opacity: 0.4; }
}

/* Ripple effect on click */
.fab-main::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.fab-main:active::before {
    width: 100px;
    height: 100px;
}

/* จัดการ z-index */
.fab-menu-container {
    z-index: 999;
}

.fab-menu-container.active {
    z-index: 9999;
}

/* Special colors for specific items */
.fab-item[data-label="ข่าวสาร"] { 
    border-color: #8b5cf6; /* สีม่วง */
}
.fab-item[data-label="ข่าวสาร"]:hover { 
    background: #8b5cf6;
}

.fab-item[data-label="คอร์สเรียน"] { 
    border-color: #f59e0b; /* สีส้ม */
}
.fab-item[data-label="คอร์สเรียน"]:hover { 
    background: #f59e0b;
}

.fab-item[data-label="เครื่องมือ"] { 
    border-color: #3b82f6; /* สีฟ้า */
}
.fab-item[data-label="เครื่องมือ"]:hover { 
    background: #3b82f6;
}

.fab-item[data-label="Music Video"] { 
    border-color: #ef4444; /* สีแดง */
}
.fab-item[data-label="Music Video"]:hover { 
    background: #ef4444;
}

.fab-item[data-label="วิเคราะห์วิดีโอ"] { 
    border-color: #10b981; /* สีเขียว */
}
.fab-item[data-label="วิเคราะห์วิดีโอ"]:hover { 
    background: #10b981;
}

/* สำหรับจอเล็กมาก */
@media (max-width: 480px) {
    .fab-main {
        width: 44px;
        height: 44px;
    }
    
    .fab-item {
        width: 38px;
        height: 38px;
    }
    
    .fab-item .fab-icon {
        font-size: 16px;
    }
    
    .plus-icon,
    .close-icon {
        font-size: 22px;
    }
    
    .fab-menu-container {
        bottom: 15px;
        right: 15px;
    }
}
/* ========== END MOBILE BUTTON SIZE OPTIMIZATION ========== */

/* ========== SUPPORT BUTTON ========== */
.support-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    z-index: 999;
    animation: supportPulse 2s ease-in-out infinite;
}

@keyframes supportPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    }
}

.support-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    background: linear-gradient(135deg, #2EE65A 0%, #25D366 100%);
}

.support-icon {
    font-size: 16px;
    animation: supportIconBounce 1.5s ease-in-out infinite;
}

@keyframes supportIconBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    75% { transform: translateY(2px); }
}

.support-text {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .support-button {
        bottom: 15px;
        left: 15px;
        padding: 10px;
        border-radius: 50%;
        width: 45px;
        height: 45px;
        justify-content: center;
    }
    
    .support-icon {
        font-size: 20px;
    }
    
    .support-text {
        display: none;
    }
    
    /* Show mobile credit button */
    .mobile-credit-btn {
        display: flex !important;
    }
    
    /* Show mobile login button */
    .mobile-login-btn {
        display: inline-flex !important;
    }
    
    /* Show mobile total credits */
    .mobile-total-credits {
        display: flex !important;
    }
    
    /* Show mobile login container on mobile only */
    .mobile-login-container {
        display: flex !important;
    }
    
    /* Adjust usage bar on mobile */
    .usage-bar {
        width: 80px;
    }
    
    .usage-text {
        font-size: 12px;
    }
}

/* เลื่อนปุ่มขึ้นเมื่อมี FAB menu เปิด */
.fab-menu-container.active ~ .support-button {
    bottom: 320px;
    transition: bottom 0.3s ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .support-button {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}
/* ========== END SUPPORT BUTTON ========== */

/* ========== GOOGLE SIGN-IN STYLES ========== */
#authSection {
    display: flex;
    align-items: center;
    gap: 10px;
}

#googleSignInWrapper {
    display: block;
}

/* Override Google Sign-In button styles */
.g_id_signin {
    overflow: hidden;
    border-radius: 8px;
}

#userProfile {
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--surface-light);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

#userAvatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    object-fit: cover;
}

#userName {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#userEmail {
    color: var(--text-secondary);
    font-size: 12px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sign-out-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sign-out-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.sign-out-btn svg {
    width: 18px;
    height: 18px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #authSection {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    #userProfile {
        flex: 1;
        justify-content: space-between;
    }
    
    #userName, #userEmail {
        max-width: 120px;
    }
    
    .g_id_signin {
        width: 100% !important;
    }
    
    #googleSignInWrapper {
        width: 100%;
        max-width: 200px;
    }
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
    #userProfile {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
}
/* Manual Google Sign-In Button */
.manual-google-signin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #4285f4;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.manual-google-signin:hover {
    background: #357ae8;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.manual-google-signin img {
    width: 18px;
    height: 18px;
}

/* Hide manual button when official button loads */
#googleSignInButton:not(:empty) ~ .manual-google-signin {
    display: none;
}
/* ========== END GOOGLE SIGN-IN STYLES ========== */

/* Character Template Modal Mobile Fixes */
@media (max-width: 768px) {
    .character-template-modal {
        padding: 0;
        align-items: flex-start;
    }
    
    .character-template-content {
        margin: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        padding: 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .template-actions {
        position: sticky;
        bottom: 0;
        background: #1a1a1a;
        padding: 20px;
        margin: -20px -20px 0 -20px;
        border-top: 1px solid var(--border);
        z-index: 10003;
    }
    
    .generate-from-template-btn,
    .cancel-btn {
        width: 100%;
        margin: 10px 0;
        min-width: auto;
    }
}

/* ========== LOGIN BUTTON & FREE CREDITS MOBILE ========== */
@media (max-width: 768px) {
    /* Free Credits Label */
    .usage-info {
        position: relative;
        padding-top: 20px \!important;
    }
    
    .usage-info > div:first-child {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        margin-bottom: 0 \!important;
    }
    
    .usage-info > div:first-child span:first-child {
        font-size: 10px \!important;
        font-weight: bold;
    }
    
    .usage-info > div:first-child span:last-child {
        font-size: 9px \!important;
    }
}

/* ========== HIDE RATING SECTION ========== */
.rating-section {
    display: none !important;
}
/* ========== END HIDE RATING SECTION ========== */
