-- ============================================================
-- MIGRATION: Sistem de Categorii cu Mega-Menu
-- ============================================================
-- Versiune: 1.0
-- Data: 2025-11-30
-- Descriere: Adaugă tabelele necesare pentru sistemul de categorii
--            cu suport pentru mega-menu dinamic
-- ============================================================

SET FOREIGN_KEY_CHECKS = 0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";

-- ============================================================
-- Tabelul: categories
-- Descriere: Stocheaza ierarhia de categorii pe multiple niveluri
-- ============================================================
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `parent_id` INT(11) DEFAULT NULL COMMENT 'ID-ul categoriei parinte (NULL pentru categorii root)',
    `name` VARCHAR(255) NOT NULL COMMENT 'Numele categoriei',
    `slug` VARCHAR(255) NOT NULL COMMENT 'URL-friendly identifier unic',
    `description` TEXT DEFAULT NULL COMMENT 'Descriere detaliata a categoriei',
    `icon` VARCHAR(100) DEFAULT NULL COMMENT 'Clasa CSS pentru iconita (ex: ci-computer)',
    `image_url` VARCHAR(500) DEFAULT NULL COMMENT 'URL imagine reprezentativa',
    `url` VARCHAR(500) DEFAULT NULL COMMENT 'Link catre pagina de categorie',
    `position` INT(11) DEFAULT 0 COMMENT 'Ordinea de afisare (mai mic = mai sus)',
    `is_active` TINYINT(1) DEFAULT 1 COMMENT 'Categorie activa (1) sau dezactivata (0)',
    `show_in_menu` TINYINT(1) DEFAULT 1 COMMENT 'Arata in mega-menu (1=da, 0=nu)',
    `has_megamenu` TINYINT(1) DEFAULT 0 COMMENT 'Are submeniu extins - mega-menu (1=da, 0=nu)',
    `megamenu_layout` VARCHAR(50) DEFAULT 'auto' COMMENT 'Layout mega-menu: auto, 2-col, 3-col, 4-col',
    `seo_title` VARCHAR(255) DEFAULT NULL COMMENT 'Titlu SEO pentru pagina categoriei',
    `seo_description` TEXT DEFAULT NULL COMMENT 'Meta description pentru SEO',
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `slug` (`slug`),
    KEY `idx_parent` (`parent_id`),
    KEY `idx_position` (`position`),
    KEY `idx_active` (`is_active`),
    KEY `idx_show_in_menu` (`show_in_menu`),
    CONSTRAINT `fk_categories_parent` 
        FOREIGN KEY (`parent_id`) 
        REFERENCES `categories` (`id`) 
        ON DELETE CASCADE 
        ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Categorii de produse cu ierarhie';

-- ============================================================
-- Tabelul: category_promo_cards
-- Descriere: Carduri promotionale afisate in mega-menu
-- ============================================================
DROP TABLE IF EXISTS `category_promo_cards`;
CREATE TABLE `category_promo_cards` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `category_id` INT(11) NOT NULL COMMENT 'ID categoria parinte pentru care apare cardul',
    `title` VARCHAR(255) NOT NULL COMMENT 'Titlul produsului/ofertei',
    `subtitle` TEXT DEFAULT NULL COMMENT 'Subtitlu (ex: Deal of the week, Best deal)',
    `badge_text` VARCHAR(100) DEFAULT NULL COMMENT 'Text badge (ex: Save up to $400)',
    `badge_bg_color` VARCHAR(50) DEFAULT 'danger' COMMENT 'Culoare badge: danger, success, warning, info, etc',
    `description` TEXT DEFAULT NULL COMMENT 'Descriere suplimentara',
    `price_original` DECIMAL(10,2) DEFAULT NULL COMMENT 'Pret original (taiat)',
    `price_sale` DECIMAL(10,2) DEFAULT NULL COMMENT 'Pret promotional',
    `price_label` VARCHAR(100) DEFAULT NULL COMMENT 'Label pret (ex: Starts from)',
    `image_url` VARCHAR(500) NOT NULL COMMENT 'URL imagine produs',
    `image_alt` VARCHAR(255) DEFAULT NULL COMMENT 'Text alternativ pentru imagine (SEO)',
    `icon` VARCHAR(100) DEFAULT NULL COMMENT 'Icon brand optional (ex: ci-apple, ci-google)',
    `button_text` VARCHAR(100) DEFAULT 'Shop now' COMMENT 'Text buton CTA',
    `button_url` VARCHAR(500) NOT NULL COMMENT 'Link buton CTA',
    `bg_color` VARCHAR(50) DEFAULT 'bg-body-secondary' COMMENT 'Clasa CSS pentru culoare fundal',
    `position` INT(11) DEFAULT 0 COMMENT 'Ordinea de afisare',
    `is_active` TINYINT(1) DEFAULT 1 COMMENT 'Card activ (1) sau inactiv (0)',
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `idx_category` (`category_id`),
    KEY `idx_active` (`is_active`),
    KEY `idx_position` (`position`),
    CONSTRAINT `fk_promo_cards_category` 
        FOREIGN KEY (`category_id`) 
        REFERENCES `categories` (`id`) 
        ON DELETE CASCADE 
        ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Carduri promotionale pentru mega-menu';

-- ============================================================
-- Tabelul: category_settings
-- Descriere: Setari globale pentru comportamentul mega-menu
-- ============================================================
DROP TABLE IF EXISTS `category_settings`;
CREATE TABLE `category_settings` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `setting_key` VARCHAR(100) NOT NULL COMMENT 'Cheie unica pentru setare',
    `setting_value` TEXT DEFAULT NULL COMMENT 'Valoarea setarii',
    `description` VARCHAR(255) DEFAULT NULL COMMENT 'Descriere setare',
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Setari globale pentru mega-menu';

-- ============================================================
-- Date initiale pentru category_settings
-- ============================================================
INSERT INTO `category_settings` (`setting_key`, `setting_value`, `description`) VALUES
('homepage_static_menu', '1', 'Mega-menu static pe homepage (1=da, 0=nu)'),
('hover_trigger', 'hover', 'Trigger pentru deschidere: hover sau click'),
('hover_delay', '200', 'Delay hover in milisecunde'),
('max_megamenu_columns', '3', 'Numar maxim de coloane in mega-menu (fara promo card)'),
('show_mobile_all_categories', '1', 'Arata butonul All Categories pe mobile (1=da, 0=nu)'),
('min_menu_height', '561.33', 'Inaltime minima mega-menu in px (pentru 12 categorii nivel 0)');

-- ============================================================
-- DATE EXEMPLU: Categorii pentru Electronics
-- ============================================================

-- Categoria 1: Computers & Accessories
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Computers & Accessories', 'computers-accessories', 'ci-computer', '/shop-catalog-electronics.php', 1, 1, 1, 1, '3-col');

SET @cat_computers_accessories = LAST_INSERT_ID();

-- Subcategorii nivel 1
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_computers_accessories, 'Computers', 'computers', '/shop-catalog-electronics.php', 1),
(@cat_computers_accessories, 'Accessories', 'accessories', '/shop-catalog-electronics.php', 2);

SET @subcat_computers = LAST_INSERT_ID() - 1;
SET @subcat_accessories = LAST_INSERT_ID();

-- Items nivel 2 - Computers
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_computers, 'Laptops & Tablets', 'laptops-tablets', '/shop-catalog-electronics.php', 1),
(@subcat_computers, 'Desktop Computers', 'desktop-computers', '/shop-catalog-electronics.php', 2),
(@subcat_computers, 'External Components', 'external-components', '/shop-catalog-electronics.php', 3),
(@subcat_computers, 'Internal Components', 'internal-components', '/shop-catalog-electronics.php', 4),
(@subcat_computers, 'Networking Products (NAS)', 'networking-products', '/shop-catalog-electronics.php', 5),
(@subcat_computers, 'Single Board Computers', 'single-board-computers', '/shop-catalog-electronics.php', 6),
(@subcat_computers, 'Desktop Barebones', 'desktop-barebones', '/shop-catalog-electronics.php', 7);

-- Items nivel 2 - Accessories
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_accessories, 'Monitors', 'monitors', '/shop-catalog-electronics.php', 1),
(@subcat_accessories, 'Bags, Cases & Sleeves', 'bags-cases-sleeves', '/shop-catalog-electronics.php', 2),
(@subcat_accessories, 'Batteries', 'batteries', '/shop-catalog-electronics.php', 3),
(@subcat_accessories, 'Chargers & Adapters', 'chargers-adapters', '/shop-catalog-electronics.php', 4),
(@subcat_accessories, 'Cooling Pads', 'cooling-pads', '/shop-catalog-electronics.php', 5),
(@subcat_accessories, 'Mounts', 'mounts', '/shop-catalog-electronics.php', 6),
(@subcat_accessories, 'Replacement Screens', 'replacement-screens', '/shop-catalog-electronics.php', 7),
(@subcat_accessories, 'Security Locks', 'security-locks', '/shop-catalog-electronics.php', 8),
(@subcat_accessories, 'Stands', 'stands', '/shop-catalog-electronics.php', 9);

-- Card promotional
INSERT INTO `category_promo_cards` (`category_id`, `title`, `subtitle`, `badge_text`, `badge_bg_color`, `price_label`, `price_original`, `price_sale`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_computers_accessories, 'Surface Laptop Studio', 'Starts from', 'Save up to $400', 'danger', 'Starts from', 1599.00, 1399.00, '/assets/img/mega-menu/electronics/01.png', 'Surface Laptop Studio', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 2: Smartphones & Tablets
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Smartphones & Tablets', 'smartphones-tablets', 'ci-smartphone-2', '/shop-catalog-electronics.php', 2, 1, 1, 1, '3-col');

SET @cat_smartphones = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_smartphones, 'Smartphones', 'smartphones', '/shop-catalog-electronics.php', 1),
(@cat_smartphones, 'Tablets', 'tablets', '/shop-catalog-electronics.php', 2),
(@cat_smartphones, 'Accessories', 'smartphone-accessories', '/shop-catalog-electronics.php', 3);

SET @subcat_smartphones = LAST_INSERT_ID() - 2;
SET @subcat_tablets = LAST_INSERT_ID() - 1;
SET @subcat_phone_acc = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_smartphones, 'Apple iPhone', 'apple-iphone', '/shop-catalog-electronics.php', 1),
(@subcat_smartphones, 'Google Pixel', 'google-pixel', '/shop-catalog-electronics.php', 2),
(@subcat_smartphones, 'Android Smartphones', 'android-smartphones', '/shop-catalog-electronics.php', 3),
(@subcat_smartphones, 'Phablets', 'phablets', '/shop-catalog-electronics.php', 4);

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_tablets, 'Apple iPad', 'apple-ipad', '/shop-catalog-electronics.php', 1),
(@subcat_tablets, 'Android Tablets', 'android-tablets', '/shop-catalog-electronics.php', 2),
(@subcat_tablets, 'Tablets with Keyboard', 'tablets-keyboard', '/shop-catalog-electronics.php', 3);

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_phone_acc, 'Accessory Kits', 'accessory-kits', '/shop-catalog-electronics.php', 1),
(@subcat_phone_acc, 'Batteries & Battery Packs', 'batteries-battery-packs', '/shop-catalog-electronics.php', 2),
(@subcat_phone_acc, 'Bags & Cases', 'phone-bags-cases', '/shop-catalog-electronics.php', 3),
(@subcat_phone_acc, 'Cables', 'phone-cables', '/shop-catalog-electronics.php', 4),
(@subcat_phone_acc, 'Car Accessories', 'car-accessories', '/shop-catalog-electronics.php', 5),
(@subcat_phone_acc, 'Chargers & Power Adapters', 'phone-chargers-adapters', '/shop-catalog-electronics.php', 6);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `subtitle`, `icon`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_smartphones, 'iPad Pro M1', 'Deal of the week', 'ci-apple', '/assets/img/mega-menu/electronics/02.png', 'iPad Pro', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 3: Headphones
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Headphones', 'headphones', 'ci-headphones-2', '/shop-catalog-electronics.php', 3, 1, 1, 1, '2-col');

SET @cat_headphones = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_headphones, 'Headphones', 'headphones-items', '/shop-catalog-electronics.php', 1),
(@cat_headphones, 'Accessories', 'headphone-accessories', '/shop-catalog-electronics.php', 2);

SET @subcat_headphones = LAST_INSERT_ID() - 1;
SET @subcat_headphone_acc = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_headphones, 'Earbud Headphones', 'earbud-headphones', '/shop-catalog-electronics.php', 1),
(@subcat_headphones, 'Over-Ear Headphones', 'over-ear-headphones', '/shop-catalog-electronics.php', 2),
(@subcat_headphones, 'On-Ear Headphones', 'on-ear-headphones', '/shop-catalog-electronics.php', 3),
(@subcat_headphones, 'Bluetooth Headphones', 'bluetooth-headphones', '/shop-catalog-electronics.php', 4),
(@subcat_headphones, 'Sports & Fitness', 'sports-fitness-headphones', '/shop-catalog-electronics.php', 5),
(@subcat_headphones, 'Noise-Cancelling', 'noise-cancelling-headphones', '/shop-catalog-electronics.php', 6);

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_headphone_acc, 'Cases & Sleeves', 'headphone-cases', '/shop-catalog-electronics.php', 1),
(@subcat_headphone_acc, 'Cables & Cords', 'headphone-cables', '/shop-catalog-electronics.php', 2),
(@subcat_headphone_acc, 'Ear Pads', 'ear-pads', '/shop-catalog-electronics.php', 3);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `badge_text`, `badge_bg_color`, `price_label`, `price_sale`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_headphones, 'Wireless Headphones', 'Save up to $200', 'danger', 'Starts from', 119.99, '/assets/img/mega-menu/electronics/08.png', 'Wireless Headphones', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 4: TV, Video & Audio
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'TV, Video & Audio', 'tv-video-audio', 'ci-monitor-2', '/shop-catalog-electronics.php', 4, 1, 1, 1, '3-col');

SET @cat_tv_video = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_tv_video, 'TV, Video & Audio', 'tv-video-audio-items', '/shop-catalog-electronics.php', 1);

SET @subcat_tv_video = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_tv_video, 'TV Sets', 'tv-sets', '/shop-catalog-electronics.php', 1),
(@subcat_tv_video, 'Home Theater Systems', 'home-theater-systems', '/shop-catalog-electronics.php', 2),
(@subcat_tv_video, 'DVD Players & Recorders', 'dvd-players-recorders', '/shop-catalog-electronics.php', 3),
(@subcat_tv_video, 'Blue-ray Players & Recorders', 'blue-ray-players-recorders', '/shop-catalog-electronics.php', 4),
(@subcat_tv_video, 'HD DVD Players & Recorders', 'hd-dvd-players-recorders', '/shop-catalog-electronics.php', 5),
(@subcat_tv_video, 'DVD-VCR Combos', 'dvd-vcr-combos', '/shop-catalog-electronics.php', 6),
(@subcat_tv_video, 'DTV Converters', 'dtv-converters', '/shop-catalog-electronics.php', 7),
(@subcat_tv_video, 'AV Receivers', 'av-receivers', '/shop-catalog-electronics.php', 8),
(@subcat_tv_video, 'AV Amplifiers', 'av-amplifiers', '/shop-catalog-electronics.php', 9),
(@subcat_tv_video, 'Projectors', 'projectors', '/shop-catalog-electronics.php', 10),
(@subcat_tv_video, 'Projection Screens', 'projection-screens', '/shop-catalog-electronics.php', 11),
(@subcat_tv_video, 'Satelite Television', 'satelite-television', '/shop-catalog-electronics.php', 12),
(@subcat_tv_video, 'TV-DTD Combos', 'tv-dtd-combos', '/shop-catalog-electronics.php', 13),
(@subcat_tv_video, 'Sound Systems', 'sound-systems', '/shop-catalog-electronics.php', 14),
(@subcat_tv_video, 'Home Cinema Systems', 'home-cinema-systems', '/shop-catalog-electronics.php', 15),
(@subcat_tv_video, 'Streaming Media Players', 'streaming-media-players', '/shop-catalog-electronics.php', 16),
(@subcat_tv_video, 'VCRs', 'vcrs', '/shop-catalog-electronics.php', 17),
(@subcat_tv_video, 'Video Glasses', 'video-glasses', '/shop-catalog-electronics.php', 18),
(@subcat_tv_video, 'Lens Attachments', 'tv-lens-attachments', '/shop-catalog-electronics.php', 19),
(@subcat_tv_video, 'Subwoofers', 'tv-subwoofers', '/shop-catalog-electronics.php', 20),
(@subcat_tv_video, 'Sound Boosters', 'sound-boosters', '/shop-catalog-electronics.php', 21);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `description`, `price_label`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_tv_video, 'LG OLED 4K Smart TV', 'Best deal! Save up to $500', NULL, '/assets/img/mega-menu/electronics/03.png', 'Smart TV', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 5: Speakers & Home Music
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Speakers & Home Music', 'speakers-home-music', 'ci-speaker-2', '/shop-catalog-electronics.php', 5, 1, 1, 1, '3-col');

SET @cat_speakers = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_speakers, 'Speakers', 'speakers', '/shop-catalog-electronics.php', 1),
(@cat_speakers, 'Home Audio', 'home-audio', '/shop-catalog-electronics.php', 2);

SET @subcat_speakers = LAST_INSERT_ID() - 1;
SET @subcat_home_audio = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_speakers, 'Smart Speakers', 'smart-speakers', '/shop-catalog-electronics.php', 1),
(@subcat_speakers, 'Bluetooth Speakers', 'bluetooth-speakers', '/shop-catalog-electronics.php', 2),
(@subcat_speakers, 'Bookshelf Speakers', 'bookshelf-speakers', '/shop-catalog-electronics.php', 3),
(@subcat_speakers, 'Ceiling & In-Wall Speakers', 'ceiling-in-wall-speakers', '/shop-catalog-electronics.php', 4),
(@subcat_speakers, 'Center-Channel Speakers', 'center-channel-speakers', '/shop-catalog-electronics.php', 5),
(@subcat_speakers, 'Floorstanding Speakers', 'floorstanding-speakers', '/shop-catalog-electronics.php', 6),
(@subcat_speakers, 'Outdoor Speakers', 'outdoor-speakers', '/shop-catalog-electronics.php', 7),
(@subcat_speakers, 'Satellite Speakers', 'satellite-speakers', '/shop-catalog-electronics.php', 8),
(@subcat_speakers, 'Sound Bars', 'sound-bars', '/shop-catalog-electronics.php', 9),
(@subcat_speakers, 'Surround Sound Systems', 'surround-sound-systems', '/shop-catalog-electronics.php', 10);

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_home_audio, 'Home Theater', 'home-theater', '/shop-catalog-electronics.php', 1),
(@subcat_home_audio, 'Wireless & Streaming Audio', 'wireless-streaming-audio', '/shop-catalog-electronics.php', 2),
(@subcat_home_audio, 'Stereo System Components', 'stereo-system-components', '/shop-catalog-electronics.php', 3),
(@subcat_home_audio, 'Compact Radios & Stereos', 'compact-radios-stereos', '/shop-catalog-electronics.php', 4),
(@subcat_home_audio, 'Home Audio Accessories', 'home-audio-accessories', '/shop-catalog-electronics.php', 5),
(@subcat_home_audio, 'Subwoofers', 'audio-subwoofers', '/shop-catalog-electronics.php', 6);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `subtitle`, `icon`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_speakers, 'Nest Audio', 'Deal of the week', 'ci-google', '/assets/img/mega-menu/electronics/04.png', 'Nest Audio', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 6: Cameras, Photo & Video
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Cameras, Photo & Video', 'cameras-photo-video', 'ci-camera-2', '/shop-catalog-electronics.php', 6, 1, 1, 1, '3-col');

SET @cat_cameras = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_cameras, 'Cameras & Lenses', 'cameras-lenses', '/shop-catalog-electronics.php', 1),
(@cat_cameras, 'Accessories', 'camera-accessories', '/shop-catalog-electronics.php', 2);

SET @subcat_cameras = LAST_INSERT_ID() - 1;
SET @subcat_camera_acc = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_cameras, 'Point & Shoot Cameras', 'point-shoot-cameras', '/shop-catalog-electronics.php', 1),
(@subcat_cameras, 'DSLR Cameras', 'dslr-cameras', '/shop-catalog-electronics.php', 2),
(@subcat_cameras, 'Mirrorless Cameras', 'mirrorless-cameras', '/shop-catalog-electronics.php', 3),
(@subcat_cameras, 'Body Mounted Cameras', 'body-mounted-cameras', '/shop-catalog-electronics.php', 4),
(@subcat_cameras, 'Camcorders', 'camcorders', '/shop-catalog-electronics.php', 5),
(@subcat_cameras, 'Camcorder Lenses', 'camcorder-lenses', '/shop-catalog-electronics.php', 6),
(@subcat_cameras, 'Camera Lenses', 'camera-lenses', '/shop-catalog-electronics.php', 7),
(@subcat_cameras, 'Macro & Ringlight Flashes', 'macro-ringlight-flashes', '/shop-catalog-electronics.php', 8),
(@subcat_cameras, 'Shoe Mount Flashes', 'shoe-mount-flashes', '/shop-catalog-electronics.php', 9),
(@subcat_cameras, 'Tripods & Monopods', 'tripods-monopods', '/shop-catalog-electronics.php', 10),
(@subcat_cameras, 'Video Studio', 'video-studio', '/shop-catalog-electronics.php', 11);

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_camera_acc, 'Bags & Cases', 'camera-bags-cases', '/shop-catalog-electronics.php', 1),
(@subcat_camera_acc, 'Binoculars & Scopes', 'binoculars-scopes', '/shop-catalog-electronics.php', 2),
(@subcat_camera_acc, 'Batteries & Chargers', 'camera-batteries-chargers', '/shop-catalog-electronics.php', 3),
(@subcat_camera_acc, 'Cables & Cords', 'camera-cables-cords', '/shop-catalog-electronics.php', 4),
(@subcat_camera_acc, 'Camcorder Accessories', 'camcorder-accessories', '/shop-catalog-electronics.php', 5),
(@subcat_camera_acc, 'Cleaning Equipment', 'camera-cleaning-equipment', '/shop-catalog-electronics.php', 6),
(@subcat_camera_acc, 'Protector Foils', 'protector-foils', '/shop-catalog-electronics.php', 7),
(@subcat_camera_acc, 'Filters & Accessories', 'filters-accessories', '/shop-catalog-electronics.php', 8),
(@subcat_camera_acc, 'Remote Controls', 'camera-remote-controls', '/shop-catalog-electronics.php', 9),
(@subcat_camera_acc, 'Rain Covers', 'rain-covers', '/shop-catalog-electronics.php', 10),
(@subcat_camera_acc, 'Viewfinders', 'viewfinders', '/shop-catalog-electronics.php', 11);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `badge_text`, `badge_bg_color`, `price_label`, `price_original`, `price_sale`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_cameras, 'Canon Digital Cameras', 'Save up to $300', 'danger', 'Starts from', 1100.00, 899.00, '/assets/img/mega-menu/electronics/05.png', 'Canon Camera', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 7: Printers & Ink
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Printers & Ink', 'printers-ink', 'ci-printer-2', '/shop-catalog-electronics.php', 7, 1, 1, 1, '3-col');

SET @cat_printers = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_printers, 'By type', 'printers-by-type', '/shop-catalog-electronics.php', 1),
(@cat_printers, 'Scanners', 'scanners', '/shop-catalog-electronics.php', 2),
(@cat_printers, 'Printers', 'printers', '/shop-catalog-electronics.php', 3);

SET @subcat_printers_type = LAST_INSERT_ID() - 2;
SET @subcat_scanners = LAST_INSERT_ID() - 1;
SET @subcat_printers = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_printers_type, 'All-in-One', 'all-in-one', '/shop-catalog-electronics.php', 1),
(@subcat_printers_type, 'Copying', 'copying', '/shop-catalog-electronics.php', 2),
(@subcat_printers_type, 'Faxing', 'faxing', '/shop-catalog-electronics.php', 3),
(@subcat_printers_type, 'Photo Printing', 'photo-printing', '/shop-catalog-electronics.php', 4),
(@subcat_printers_type, 'Printing Only', 'printing-only', '/shop-catalog-electronics.php', 5),
(@subcat_printers_type, 'Scanning', 'scanning', '/shop-catalog-electronics.php', 6);

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_scanners, 'Business Card Scanners', 'business-card-scanners', '/shop-catalog-electronics.php', 1),
(@subcat_scanners, 'Document Scanners', 'document-scanners', '/shop-catalog-electronics.php', 2),
(@subcat_scanners, 'Flatbed & Photo Scanners', 'flatbed-photo-scanners', '/shop-catalog-electronics.php', 3),
(@subcat_scanners, 'Slide & Negative Scanners', 'slide-negative-scanners', '/shop-catalog-electronics.php', 4);

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_printers, 'Dot Matrix Printers', 'dot-matrix-printers', '/shop-catalog-electronics.php', 1),
(@subcat_printers, 'Inkjet Printers', 'inkjet-printers', '/shop-catalog-electronics.php', 2),
(@subcat_printers, 'Label Printers', 'label-printers', '/shop-catalog-electronics.php', 3),
(@subcat_printers, 'Laser Printers', 'laser-printers', '/shop-catalog-electronics.php', 4),
(@subcat_printers, 'Photo Printers', 'photo-printers', '/shop-catalog-electronics.php', 5),
(@subcat_printers, 'Wide Format Printers', 'wide-format-printers', '/shop-catalog-electronics.php', 6),
(@subcat_printers, 'Plotter Printers', 'plotter-printers', '/shop-catalog-electronics.php', 7);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `description`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_printers, 'Epson Color Printers', 'Best deal! Save up to $200', '/assets/img/mega-menu/electronics/06.png', 'Epson Printer', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 8: Charging Stations
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Charging Stations', 'charging-stations', 'ci-battery-2', '/shop-catalog-electronics.php', 8, 1, 1, 1, '2-col');

SET @cat_charging = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_charging, 'Charging Stations', 'charging-stations-items', '/shop-catalog-electronics.php', 1);

SET @subcat_charging = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_charging, 'Portable Power Stations', 'portable-power-stations', '/shop-catalog-electronics.php', 1),
(@subcat_charging, 'Inverter Power Stations', 'inverter-power-stations', '/shop-catalog-electronics.php', 2),
(@subcat_charging, 'Outdoor Generators', 'outdoor-generators', '/shop-catalog-electronics.php', 3),
(@subcat_charging, 'Gasoline Generators', 'gasoline-generators', '/shop-catalog-electronics.php', 4),
(@subcat_charging, 'Cell Phone Chargers', 'cell-phone-chargers', '/shop-catalog-electronics.php', 5),
(@subcat_charging, 'Power Strips', 'power-strips', '/shop-catalog-electronics.php', 6),
(@subcat_charging, 'Wall Chargers', 'wall-chargers', '/shop-catalog-electronics.php', 7);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `badge_text`, `badge_bg_color`, `description`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_charging, 'Portable Power Stations', 'Huge sale!', 'danger', 'Save up to $350', '/assets/img/mega-menu/electronics/07.png', 'Portable Power Station', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 9: Wearable Electronics
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Wearable Electronics', 'wearable-electronics', 'ci-watch-2', '/shop-catalog-electronics.php', 9, 1, 1, 1, '2-col');

SET @cat_wearable = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_wearable, 'Wearable Gadgets', 'wearable-gadgets', '/shop-catalog-electronics.php', 1);

SET @subcat_wearable = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_wearable, 'Smartwatches', 'smartwatches', '/shop-catalog-electronics.php', 1),
(@subcat_wearable, 'Fitness Trackers', 'fitness-trackers', '/shop-catalog-electronics.php', 2),
(@subcat_wearable, 'Smart Glasses', 'smart-glasses', '/shop-catalog-electronics.php', 3),
(@subcat_wearable, 'Rings', 'rings', '/shop-catalog-electronics.php', 4),
(@subcat_wearable, 'Virtual Reality', 'virtual-reality', '/shop-catalog-electronics.php', 5),
(@subcat_wearable, 'Clips, Arm & Wristbands', 'clips-arm-wristbands', '/shop-catalog-electronics.php', 6),
(@subcat_wearable, 'Accessories', 'wearable-accessories', '/shop-catalog-electronics.php', 7);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `subtitle`, `icon`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_wearable, 'Pixel Watch', 'Deal of the week', 'ci-google', '/assets/img/mega-menu/electronics/09.png', 'Pixel Watch', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 10: Powerbanks
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Powerbanks', 'powerbanks', 'ci-powerbank', '/shop-catalog-electronics.php', 10, 1, 1, 1, '2-col');

SET @cat_powerbanks = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_powerbanks, 'Powerbanks', 'powerbanks-items', '/shop-catalog-electronics.php', 1);

SET @subcat_powerbanks = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_powerbanks, 'Fast Charging', 'fast-charging', '/shop-catalog-electronics.php', 1),
(@subcat_powerbanks, 'Built In Cable', 'built-in-cable', '/shop-catalog-electronics.php', 2),
(@subcat_powerbanks, 'Built In Wall Plug', 'built-in-wall-plug', '/shop-catalog-electronics.php', 3),
(@subcat_powerbanks, 'LED Indicator Lights', 'led-indicator-lights', '/shop-catalog-electronics.php', 4),
(@subcat_powerbanks, 'Pocket Size', 'pocket-size', '/shop-catalog-electronics.php', 5),
(@subcat_powerbanks, 'Wireless Charging', 'wireless-charging', '/shop-catalog-electronics.php', 6),
(@subcat_powerbanks, 'Short Circuit Protection', 'short-circuit-protection', '/shop-catalog-electronics.php', 7),
(@subcat_powerbanks, 'Scratch Resistant', 'scratch-resistant', '/shop-catalog-electronics.php', 8),
(@subcat_powerbanks, 'Flashlight', 'flashlight', '/shop-catalog-electronics.php', 9),
(@subcat_powerbanks, 'Lightweight', 'lightweight', '/shop-catalog-electronics.php', 10);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `description`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_powerbanks, 'Powerbanks Deals', 'Save up to $50 on our', '/assets/img/mega-menu/electronics/10.png', 'Powerbank', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 11: HDD/SSD Data Storage
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'HDD/SSD Data Storage', 'hdd-ssd-data-storage', 'ci-hard-drive-2', '/shop-catalog-electronics.php', 11, 1, 1, 1, '2-col');

SET @cat_storage = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_storage, 'Data Storage', 'data-storage', '/shop-catalog-electronics.php', 1);

SET @subcat_storage = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_storage, 'External Hard Drives', 'external-hard-drives', '/shop-catalog-electronics.php', 1),
(@subcat_storage, 'External SSD', 'external-ssd', '/shop-catalog-electronics.php', 2),
(@subcat_storage, 'External Zip Drives', 'external-zip-drives', '/shop-catalog-electronics.php', 3),
(@subcat_storage, 'Floppy & Tape Drives', 'floppy-tape-drives', '/shop-catalog-electronics.php', 4),
(@subcat_storage, 'Internal Hard Drives', 'internal-hard-drives', '/shop-catalog-electronics.php', 5),
(@subcat_storage, 'Internal SSD', 'internal-ssd', '/shop-catalog-electronics.php', 6),
(@subcat_storage, 'Network Attached Storage', 'network-attached-storage', '/shop-catalog-electronics.php', 7),
(@subcat_storage, 'USB Flash Drives', 'usb-flash-drives', '/shop-catalog-electronics.php', 8);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `badge_text`, `badge_bg_color`, `price_label`, `price_sale`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_storage, 'Samsung SSD Deals', 'Save up to $100', 'danger', 'Starts from', 89.99, '/assets/img/mega-menu/electronics/11.png', 'SSD', 'Shop now', '/shop-catalog-electronics.php', 1);

-- Categoria 12: Video Games
INSERT INTO `categories` (`parent_id`, `name`, `slug`, `icon`, `url`, `position`, `is_active`, `show_in_menu`, `has_megamenu`, `megamenu_layout`) VALUES
(NULL, 'Video Games', 'video-games', 'ci-game', '/shop-catalog-electronics.php', 12, 1, 1, 1, '3-col');

SET @cat_games = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@cat_games, 'Games & Hardware', 'games-hardware', '/shop-catalog-electronics.php', 1);

SET @subcat_games = LAST_INSERT_ID();

INSERT INTO `categories` (`parent_id`, `name`, `slug`, `url`, `position`) VALUES
(@subcat_games, 'Video Games', 'video-games-items', '/shop-catalog-electronics.php', 1),
(@subcat_games, 'PlayStation 5', 'playstation-5', '/shop-catalog-electronics.php', 2),
(@subcat_games, 'PlayStation 4', 'playstation-4', '/shop-catalog-electronics.php', 3),
(@subcat_games, 'Xbox Series X', 'xbox-series-x', '/shop-catalog-electronics.php', 4),
(@subcat_games, 'Xbox Series S', 'xbox-series-s', '/shop-catalog-electronics.php', 5),
(@subcat_games, 'Nintendo Switch', 'nintendo-switch', '/shop-catalog-electronics.php', 6),
(@subcat_games, 'Gaming PC', 'gaming-pc', '/shop-catalog-electronics.php', 7),
(@subcat_games, 'Gaming Laptops', 'gaming-laptops', '/shop-catalog-electronics.php', 8),
(@subcat_games, 'Wii U', 'wii-u', '/shop-catalog-electronics.php', 9),
(@subcat_games, 'Wii', 'wii', '/shop-catalog-electronics.php', 10),
(@subcat_games, 'Nintendo 3DS', 'nintendo-3ds', '/shop-catalog-electronics.php', 11),
(@subcat_games, 'Nintendo 2DS', 'nintendo-2ds', '/shop-catalog-electronics.php', 12),
(@subcat_games, 'Nintendo DS', 'nintendo-ds', '/shop-catalog-electronics.php', 13),
(@subcat_games, 'Mac', 'mac-gaming', '/shop-catalog-electronics.php', 14),
(@subcat_games, 'PlayStation Vita', 'playstation-vita', '/shop-catalog-electronics.php', 15),
(@subcat_games, 'Sony PSP', 'sony-psp', '/shop-catalog-electronics.php', 16),
(@subcat_games, 'Retro Gaming', 'retro-gaming', '/shop-catalog-electronics.php', 17),
(@subcat_games, 'Microconsoles', 'microconsoles', '/shop-catalog-electronics.php', 18),
(@subcat_games, 'Controllers', 'controllers', '/shop-catalog-electronics.php', 19),
(@subcat_games, 'Accessories', 'gaming-accessories', '/shop-catalog-electronics.php', 20),
(@subcat_games, 'Digital Games Screens', 'digital-games-screens', '/shop-catalog-electronics.php', 21),
(@subcat_games, 'Game Pass', 'game-pass', '/shop-catalog-electronics.php', 22),
(@subcat_games, 'PlayStation Plus', 'playstation-plus', '/shop-catalog-electronics.php', 23);

INSERT INTO `category_promo_cards` (`category_id`, `title`, `badge_text`, `badge_bg_color`, `price_label`, `price_original`, `price_sale`, `image_url`, `image_alt`, `button_text`, `button_url`, `position`) VALUES
(@cat_games, 'Xbox Series X', 'Save $100', 'danger', 'Starts from', 599.00, 499.00, '/assets/img/mega-menu/electronics/12.png', 'Xbox', 'Shop now', '/shop-catalog-electronics.php', 1);

SET FOREIGN_KEY_CHECKS = 1;
COMMIT;

-- ============================================================
-- Finalizare Migration
-- ============================================================
-- Pentru a rula această migrare:
-- 1. Prin phpMyAdmin: Import -> Selectați fișierul
-- 2. Prin MySQL CLI: mysql -u root -p cartzilla_shop < migration_categories_system.sql
-- ============================================================

