<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('themes', function (Blueprint $table) {
            $table->id();
            $table->string('name')->unique();
            $table->string('slug', 191)->unique();
            $table->text('description')->nullable();
            $table->boolean('is_active')->default(false);
            
            // Color Configuration
            $table->string('primary_color', 7);
            $table->string('secondary_color', 7)->nullable();
            $table->string('accent_color', 7)->nullable();
            
            // Typography
            $table->string('font_family_body');
            $table->string('font_family_heading');
            $table->string('font_color_body', 7);
            $table->string('font_color_heading', 7);
            $table->string('font_color_link', 7);
            
            // Heading Format
            $table->json('heading_size_scale')->nullable();
            $table->string('heading_weight', 50)->nullable();
            $table->string('heading_spacing', 50)->nullable();
            
            // Backgrounds
            $table->string('background_body', 7);
            $table->string('background_card', 7);
            $table->string('background_card_hero')->nullable();
            $table->string('background_sidebar', 7);
            $table->string('background_header', 7);
            $table->string('background_footer', 7);
            
            // Scrollbar
            $table->string('scrollbar_track_color', 7)->nullable();
            $table->string('scrollbar_thumb_color', 7)->nullable();
            $table->string('scrollbar_width', 50)->nullable();
            
            // Divider
            $table->string('divider_color', 7)->nullable();
            $table->string('divider_style', 50)->nullable();
            $table->string('divider_width', 50)->nullable();
            
            $table->timestamps();
            
            // Indexes for performance
            $table->index('is_active');
            $table->index('slug');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('themes');
    }
};
