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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
// ══════════════════════════════════════════════════════════════════════════════
// Chahua Video Builder - Video Templates
// Multiple Professional Templates for Video Creation
// ══════════════════════════════════════════════════════════════════════════════
// Company: Chahua Development Co., Ltd.
// Version: 1.0.0
// License: MIT
// ══════════════════════════════════════════════════════════════════════════════

// สีหลักที่ใช้ร่วมกันทุก template
const SHARED_COLORS = {
  primary: '#60a5fa',       // Blue
  secondary: '#a855f7',     // Purple
  background: '#0a1628',    // Dark blue-black
  surface: '#132337',       // Dark blue-gray
  text: '#e2e8f0',          // Light gray
  textSecondary: '#94a3b8', // Medium gray
  accent: '#06b6d4'         // Cyan
};

export const VIDEO_TEMPLATES = {
  // ════════════════════════════════════════════════════════════════════════════
  // Modern Template - Inter Font + Rounded Corners
  // ════════════════════════════════════════════════════════════════════════════
  modern: {
    id: 'modern',
    name: 'Modern',
    description: 'Clean and professional design with gradient accents',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Inter', 'Segoe UI', sans-serif",
      code: "'Source Code Pro', monospace"
    },
    animations: {
      duration: 0.6,
      easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
      fadeIn: 'fadeIn 0.6s ease-out',
      slideUp: 'slideUp 0.6s ease-out'
    },
    styles: {
      borderRadius: '1.25rem',
      shadow: '0 20px 40px rgba(0, 0, 0, 0.3)',
      gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Classic Template - Serif Font + Traditional Style
  // ════════════════════════════════════════════════════════════════════════════
  classic: {
    id: 'classic',
    name: 'Classic',
    description: 'Traditional elegant design with serif fonts',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Playfair Display', 'Georgia', serif",
      code: "'Courier Prime', 'Courier New', monospace"
    },
    animations: {
      duration: 0.8,
      easing: 'ease-in-out',
      fadeIn: 'fadeIn 0.8s ease-in-out',
      slideUp: 'slideUp 0.8s ease-in-out'
    },
    styles: {
      borderRadius: '0.5rem',
      shadow: '0 10px 30px rgba(0, 0, 0, 0.5)',
      gradient: 'linear-gradient(180deg, rgba(59, 130, 246, 0.1), transparent)'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Minimal Template - Helvetica + Sharp Edges
  // ════════════════════════════════════════════════════════════════════════════
  minimal: {
    id: 'minimal',
    name: 'Minimal',
    description: 'Ultra-clean minimalist design',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Helvetica Neue', 'Arial', sans-serif",
      code: "'SF Mono', 'Monaco', monospace"
    },
    animations: {
      duration: 0.4,
      easing: 'linear',
      fadeIn: 'fadeIn 0.4s linear',
      slideUp: 'slideUp 0.4s linear'
    },
    styles: {
      borderRadius: '0',
      shadow: 'none',
      gradient: 'none'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Mono Template - Monospace Font + Terminal Style
  // ════════════════════════════════════════════════════════════════════════════
  mono: {
    id: 'mono',
    name: 'Mono',
    description: 'Monospace terminal-inspired style',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Roboto Mono', 'Consolas', monospace",
      code: "'Fira Code', 'Courier New', monospace"
    },
    animations: {
      duration: 0.3,
      easing: 'ease-out',
      fadeIn: 'fadeIn 0.3s ease-out',
      slideUp: 'slideUp 0.3s ease-out'
    },
    styles: {
      borderRadius: '0',
      shadow: '0 0 20px rgba(0, 255, 0, 0.3)',
      gradient: 'radial-gradient(circle, rgba(0, 255, 0, 0.1), transparent)'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Rounded Template - Poppins Font + Maximum Roundness
  // ════════════════════════════════════════════════════════════════════════════
  rounded: {
    id: 'rounded',
    name: 'Rounded',
    description: 'Soft and friendly with rounded corners',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Poppins', 'Nunito', sans-serif",
      code: "'JetBrains Mono', monospace"
    },
    animations: {
      duration: 0.7,
      easing: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
      fadeIn: 'fadeIn 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55)',
      slideUp: 'slideUp 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55)'
    },
    styles: {
      borderRadius: '0.25rem',
      shadow: '0 4px 8px rgba(96, 165, 250, 0.15)',
      gradient: 'none'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Rounded Template - Poppins Font + Maximum Roundness
  // ════════════════════════════════════════════════════════════════════════════
  rounded: {
    id: 'rounded',
    name: 'Rounded',
    description: 'Soft and friendly with rounded corners',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Poppins', 'Nunito', sans-serif",
      code: "'JetBrains Mono', monospace"
    },
    animations: {
      duration: 0.65,
      easing: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
      fadeIn: 'fadeIn 0.65s cubic-bezier(0.34, 1.56, 0.64, 1)',
      slideUp: 'slideUp 0.65s cubic-bezier(0.34, 1.56, 0.64, 1)'
    },
    styles: {
      borderRadius: '2.5rem',
      shadow: '0 25px 50px rgba(96, 165, 250, 0.3)',
      gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Space Template - Space Grotesk Font + Futuristic
  // ════════════════════════════════════════════════════════════════════════════
  space: {
    id: 'space',
    name: 'Space',
    description: 'Futuristic space-themed design',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Space Grotesk', 'Orbitron', sans-serif",
      code: "'Space Mono', monospace"
    },
    animations: {
      duration: 0.55,
      easing: 'cubic-bezier(0.19, 1, 0.22, 1)',
      fadeIn: 'fadeIn 0.55s cubic-bezier(0.19, 1, 0.22, 1)',
      slideUp: 'slideUp 0.55s cubic-bezier(0.19, 1, 0.22, 1)'
    },
    styles: {
      borderRadius: '0.75rem',
      shadow: '0 0 20px rgba(96, 165, 250, 0.4), 0 0 40px rgba(168, 85, 247, 0.2)',
      gradient: 'radial-gradient(circle, rgba(96, 165, 250, 0.15), transparent)'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Code Template - Developer-Friendly Monospace
  // ════════════════════════════════════════════════════════════════════════════
  code: {
    id: 'code',
    name: 'Code',
    description: 'Developer-friendly monospace design',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Fira Code', 'Cascadia Code', monospace",
      code: "'JetBrains Mono', 'Source Code Pro', monospace"
    },
    animations: {
      duration: 0.38,
      easing: 'cubic-bezier(0, 0, 0.2, 1)',
      fadeIn: 'fadeIn 0.38s cubic-bezier(0, 0, 0.2, 1)',
      slideUp: 'slideUp 0.38s cubic-bezier(0, 0, 0.2, 1)'
    },
    styles: {
      borderRadius: '0.5rem',
      shadow: '0 8px 24px rgba(96, 165, 250, 0.15)',
      gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(168, 85, 247, 0.1))'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Tech Template - Ubuntu Font + Clean Tech Style
  // ════════════════════════════════════════════════════════════════════════════
  tech: {
    id: 'tech',
    name: 'Tech',
    description: 'Clean technical presentation style',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Ubuntu', 'Roboto', sans-serif",
      code: "'Ubuntu Mono', 'Inconsolata', monospace"
    },
    animations: {
      duration: 0.48,
      easing: 'cubic-bezier(0.25, 0.1, 0.25, 1)',
      fadeIn: 'fadeIn 0.48s cubic-bezier(0.25, 0.1, 0.25, 1)',
      slideUp: 'slideUp 0.48s cubic-bezier(0.25, 0.1, 0.25, 1)'
    },
    styles: {
      borderRadius: '0.5rem',
      shadow: '0 8px 24px rgba(96, 165, 250, 0.15)',
      gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(168, 85, 247, 0.1))'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Tech Template - Ubuntu Font + Clean Tech Style
  // ════════════════════════════════════════════════════════════════════════════
  tech: {
    id: 'tech',
    name: 'Tech',
    description: 'Clean technical presentation style',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Ubuntu', 'Roboto', sans-serif",
      code: "'Ubuntu Mono', 'Inconsolata', monospace"
    },
    animations: {
      duration: 0.72,
      easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
      fadeIn: 'fadeIn 0.72s cubic-bezier(0.16, 1, 0.3, 1)',
      slideUp: 'slideUp 0.72s cubic-bezier(0.16, 1, 0.3, 1)'
    },
    styles: {
      borderRadius: '1rem',
      shadow: '0 20px 40px rgba(96, 165, 250, 0.3)',
      gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Corporate Template - Professional Business Style
  // ════════════════════════════════════════════════════════════════════════════
  corporate: {
    id: 'corporate',
    name: 'Corporate',
    description: 'Professional business presentation',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Lato', 'Open Sans', sans-serif",
      code: "'Consolas', monospace"
    },
    animations: {
      duration: 0.52,
      easing: 'cubic-bezier(0.45, 0, 0.55, 1)',
      fadeIn: 'fadeIn 0.52s cubic-bezier(0.45, 0, 0.55, 1)',
      slideUp: 'slideUp 0.52s cubic-bezier(0.45, 0, 0.55, 1)'
    },
    styles: {
      borderRadius: '0.5rem',
      shadow: '0 6px 20px rgba(96, 165, 250, 0.2)',
      gradient: 'linear-gradient(180deg, rgba(96, 165, 250, 0.1), transparent)'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Display Template - Display Fonts + High Impact
  // ════════════════════════════════════════════════════════════════════════════
  display: {
    id: 'display',
    name: 'Display',
    description: 'Bold display fonts for maximum impact',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Montserrat', 'Oswald', sans-serif",
      code: "'Inconsolata', monospace"
    },
    animations: {
      duration: 0.72,
      easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
      fadeIn: 'fadeIn 0.72s cubic-bezier(0.16, 1, 0.3, 1)',
      slideUp: 'slideUp 0.72s cubic-bezier(0.16, 1, 0.3, 1)'
    },
    styles: {
      borderRadius: '1rem',
      shadow: '0 20px 40px rgba(96, 165, 250, 0.3)',
      gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
    }
  },

  // ════════════════════════════════════════════════════════════════════════════
  // Corporate Template - Professional Business Style
  // ════════════════════════════════════════════════════════════════════════════
  corporate: {
    id: 'corporate',
    name: 'Corporate',
    description: 'Professional business presentation',
    colors: { ...SHARED_COLORS },
    fonts: {
      primary: "'Lato', 'Open Sans', sans-serif",
      code: "'Consolas', monospace"
    },
    animations: {
      duration: 0.5,
      easing: 'ease-in-out',
      fadeIn: 'fadeIn 0.5s ease-in-out',
      slideUp: 'slideUp 0.5s ease-in-out'
    },
    styles: {
      borderRadius: '0.5rem',
      shadow: '0 8px 20px rgba(96, 165, 250, 0.15)',
      gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(168, 85, 247, 0.08))'
    }
  }
};

// ══════════════════════════════════════════════════════════════════════════════
// Template Helper Functions
// ══════════════════════════════════════════════════════════════════════════════

export function getTemplate(templateId) {
  return VIDEO_TEMPLATES[templateId] || VIDEO_TEMPLATES.modern;
}

export function getAllTemplates() {
  return Object.values(VIDEO_TEMPLATES);
}

export function applyTemplate(templateId) {
  const template = getTemplate(templateId);
  const root = document.documentElement;

  // Apply colors as CSS variables
  Object.entries(template.colors).forEach(([key, value]) => {
    root.style.setProperty(`--color-${key}`, value);
  });

  // Apply fonts
  root.style.setProperty('--font-primary', template.fonts.primary);
  root.style.setProperty('--font-code', template.fonts.code);

  // Apply animation settings
  root.style.setProperty('--anim-duration', `${template.animations.duration}s`);
  root.style.setProperty('--anim-easing', template.animations.easing);

  // Apply styles
  root.style.setProperty('--border-radius', template.styles.borderRadius);
  root.style.setProperty('--shadow', template.styles.shadow);
  root.style.setProperty('--gradient', template.styles.gradient);

  // Apply syntax highlighting colors (if available)
  if (template.syntax) {
    Object.entries(template.syntax).forEach(([key, value]) => {
      root.style.setProperty(`--syntax-${key}`, value);
    });
  }

  return template;
}

export function generateCSS(template) {
  return `

    :root {

      --color-primary: ${template.colors.primary};

      --color-secondary: ${template.colors.secondary};

      --color-background: ${template.colors.background};

      --color-surface: ${template.colors.surface};

      --color-text: ${template.colors.text};

      --color-text-secondary: ${template.colors.textSecondary};

      --color-accent: ${template.colors.accent};

      

      --font-primary: ${template.fonts.primary};

      --font-code: ${template.fonts.code};

      

      --anim-duration: ${template.animations.duration}s;

      --anim-easing: ${template.animations.easing};

      

      --border-radius: ${template.styles.borderRadius};

      --shadow: ${template.styles.shadow};

      --gradient: ${template.styles.gradient};

    }



    body {

      font-family: var(--font-primary);

      background-color: var(--color-background);

      color: var(--color-text);

    }



    .code-block {

      font-family: var(--font-code);

      background: var(--color-surface);

      border-radius: var(--border-radius);

      box-shadow: var(--shadow);

    }



    .gradient-backdrop {

      background: var(--gradient);

    }

  `;
}