# -*- coding: utf-8 -*-
"""
Web Dashboard v3.0 - Futuristik Modelhane Üretim Takip Sistemi
Ultra modern, animasyonlu, neon efektli arayüz
"""

import sys
import json
import math
from datetime import datetime, timedelta
from typing import Dict, List, Optional, Any
from dataclasses import dataclass, asdict
import random

from PyQt6.QtWidgets import (
    QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
    QGridLayout, QLabel, QPushButton, QFrame, QScrollArea,
    QProgressBar, QStackedWidget, QSplitter, QTextEdit,
    QSpinBox, QDoubleSpinBox, QComboBox, QLineEdit, QCheckBox,
    QSlider, QGroupBox, QTableWidget, QTableWidgetItem,
    QHeaderView, QAbstractItemView, QMenu, QMenuBar,
    QStatusBar, QToolBar, QToolButton, QButtonGroup,
    QRadioButton, QTabWidget, QTreeWidgetItem, QTreeWidget,
    QGraphicsView, QGraphicsScene, QGraphicsOpacityEffect,
    QGraphicsDropShadowEffect
)
from PyQt6.QtCore import (
    Qt, QTimer, QThread, pyqtSignal, QPropertyAnimation,
    QEasingCurve, QParallelAnimationGroup, QSequentialAnimationGroup,
    QRect, QPointF, QSize, pyqtProperty, QUrl, QVariantAnimation,
    QTimeLine, QEvent, QEventLoop
)
from PyQt6.QtGui import (
    QFont, QColor, QPalette, QLinearGradient, QRadialGradient,
    QPen, QBrush, QPainter, QPixmap, QIcon, QCursor,
    QPolygonF, QFontDatabase, QHoverEvent, QEnterEvent,
    QMouseEvent, QResizeEvent, QShowEvent, QPainterPath,
    QTransform, QFontMetrics, QConicalGradient
)


@dataclass
class Proje:
    """Proje veri yapısı"""
    id: str
    ad: str
    musteri: str
    durum: str
    baslangic: datetime
    bitis: datetime
    bütce: float
    harcanan: float
    ilerleme: float
    sorumlu: str
    takim_uyeleri: List[str]
    oncelik: str
    risk_seviyesi: str


class FuturisticButton(QPushButton):
    """Futuristik animasyonlu buton"""

    def __init__(self, text, color="#00ffff", glow_color="#00ffff"):
        super().__init__(text)
        self.color = QColor(color)
        self.glow_color = QColor(glow_color)
        self.animation = QPropertyAnimation(self, b"color")
        self.setupStyle()
        self.animations = []

    def setupStyle(self):
        self.setStyleSheet(f"""
            FuturisticButton {{
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(0, 20, 40, 200),
                    stop:0.5 rgba(0, 40, 80, 220),
                    stop:1 rgba(0, 60, 120, 200));
                border: 2px solid {self.color.name()};
                border-radius: 10px;
                color: {self.color.name()};
                font-size: 14px;
                font-weight: bold;
                padding: 12px 24px;
                text-transform: uppercase;
                letter-spacing: 1px;
            }}
            FuturisticButton:hover {{
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(0, 40, 80, 240),
                    stop:0.5 rgba(0, 60, 120, 250),
                    stop:1 rgba(0, 80, 160, 240));
                border: 2px solid {self.glow_color.name()};
                color: #ffffff;
            }}
            FuturisticButton:pressed {{
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(0, 60, 120, 200),
                    stop:0.5 rgba(0, 80, 160, 220),
                    stop:1 rgba(0, 100, 200, 200));
            }}
        """)

        # Glow efekti
        self.shadow_effect = QGraphicsDropShadowEffect()
        self.shadow_effect.setColor(self.glow_color)
        self.shadow_effect.setBlurRadius(15)
        self.shadow_effect.setXOffset(0)
        self.shadow_effect.setYOffset(0)
        self.setGraphicsEffect(self.shadow_effect)

    def enterEvent(self, event):
        # Hover animasyonu
        self.shadow_effect.setBlurRadius(30)
        self.shadow_effect.setColor(self.glow_color.lighter(150))
        super().enterEvent(event)

    def leaveEvent(self, event):
        # Normal duruma dön
        self.shadow_effect.setBlurRadius(15)
        self.shadow_effect.setColor(self.glow_color)
        super().leaveEvent(event)


class NeonCard(QFrame):
    """Neon ışıklı kart widget"""

    def __init__(self, title, value, subtitle="", icon="📊", color="#00ffff"):
        super().__init__()
        self.color = QColor(color)
        self.title = title
        self.value = value
        self.subtitle = subtitle
        self.icon = icon
        self.setupUI()
        self.addAnimations()

    def setupUI(self):
        self.setFixedSize(280, 160)
        self.setFrameStyle(QFrame.Shape.NoFrame)

        # Ana arka plan gradient
        self.setStyleSheet(f"""
            NeonCard {{
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(0, 10, 30, 220),
                    stop:0.5 rgba(0, 20, 50, 240),
                    stop:1 rgba(0, 30, 70, 220));
                border: 1px solid rgba({self.color.red()}, {self.color.green()}, {self.color.blue()}, 100);
                border-radius: 20px;
            }}
        """)

        layout = QVBoxLayout()
        layout.setSpacing(8)
        layout.setContentsMargins(20, 15, 20, 15)

        # Icon ve başlık
        header = QHBoxLayout()
        icon_label = QLabel(self.icon)
        icon_label.setStyleSheet(f"""
            font-size: 32px;
            color: {self.color.name()};
            text-shadow: 0 0 20px {self.color.name()};
        """)
        header.addWidget(icon_label)

        header.addStretch()

        title_label = QLabel(self.title)
        title_label.setStyleSheet("""
            color: rgba(255, 255, 255, 200);
            font-size: 11px;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
        """)
        header.addWidget(title_label)
        layout.addLayout(header)

        # Ana değer
        value_label = QLabel(self.value)
        value_label.setStyleSheet(f"""
            color: #ffffff;
            font-size: 36px;
            font-weight: bold;
            font-family: 'Consolas', monospace;
            text-shadow: 0 0 10px rgba(255, 255, 255, 50);
        """)
        layout.addWidget(value_label)

        # Alt başlık
        if self.subtitle:
            subtitle_label = QLabel(self.subtitle)
            subtitle_label.setStyleSheet(f"""
                color: {self.color.name()};
                font-size: 12px;
                font-weight: 500;
            """)
            layout.addWidget(subtitle_label)

        # Animasyonlu glow efekti
        self.glow_effect = QGraphicsDropShadowEffect()
        self.glow_effect.setColor(self.color)
        self.glow_effect.setBlurRadius(20)
        self.glow_effect.setXOffset(0)
        self.glow_effect.setYOffset(0)
        self.setGraphicsEffect(self.glow_effect)

        self.setLayout(layout)

    def addAnimations(self):
        # Pulse animasyonu
        self.pulse_timer = QTimer()
        self.pulse_timer.timeout.connect(self.pulse)
        self.pulse_timer.start(2000)
        self.pulse_state = 0

    def pulse(self):
        # Glow yoğunluğunu değiştir
        if self.pulse_state == 0:
            self.glow_effect.setBlurRadius(30)
            self.pulse_state = 1
        else:
            self.glow_effect.setBlurRadius(20)
            self.pulse_state = 0

    def enterEvent(self, event):
        # Hover efekti
        self.setStyleSheet(self.styleSheet() + """
            NeonCard {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(0, 30, 60, 240),
                    stop:0.5 rgba(0, 40, 80, 255),
                    stop:1 rgba(0, 50, 100, 240));
            }
        """)
        self.glow_effect.setBlurRadius(40)
        super().enterEvent(event)

    def leaveEvent(self, event):
        self.glow_effect.setBlurRadius(20)
        super().leaveEvent(event)


class AnimatedSidebarMenu(QWidget):
    """Animasyonlu kenar menü"""

    menuItemSelected = pyqtSignal(str)

    def __init__(self):
        super().__init__()
        self.selected_item = "dashboard"
        self.menu_items_data = [
            ("dashboard", "🌟 Ana Dashboard", "#00ffff"),
            ("cnc", "⚡ CNC Takip", "#ff00ff"),
            ("uretim", "🔥 Üretim", "#00ff88"),
            ("projeler", "💎 Projeler", "#ffaa00"),
            ("siparisler", "💎 Siparişler", "#ff6b6b"),
            ("teklifler", "🚀 Teklifler", "#4ecdc4"),
            ("analiz", "📊 Analiz", "#a8e6cf"),
            ("admin", "⚙️ Admin", "#ff8cc8"),
        ]
        self.setupUI()

    def setupUI(self):
        self.setFixedWidth(280)
        self.setStyleSheet("""
            AnimatedSidebarMenu {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 rgba(10, 10, 30, 250),
                    stop:0.5 rgba(20, 20, 50, 250),
                    stop:1 rgba(10, 10, 30, 250));
                border-right: 2px solid rgba(0, 255, 255, 30);
            }
        """)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(5)

        # Logo bölümü
        logo_frame = QFrame()
        logo_frame.setFixedHeight(100)
        logo_frame.setStyleSheet("""
            QFrame {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(0, 255, 255, 30),
                    stop:1 rgba(0, 100, 200, 30));
                border-bottom: 2px solid rgba(0, 255, 255, 50);
            }
        """)

        logo_layout = QHBoxLayout()
        logo_layout.setContentsMargins(20, 20, 20, 20)

        # Animasyonlu logo
        self.logo_label = QLabel("🏭")
        self.logo_label.setStyleSheet("""
            font-size: 48px;
            color: #00ffff;
            text-shadow: 0 0 30px #00ffff;
        """)
        logo_layout.addWidget(self.logo_label)

        logo_text = QVBoxLayout()
        company_name = QLabel("FIKATIA")
        company_name.setStyleSheet("""
            font-size: 24px;
            font-weight: bold;
            color: #ffffff;
            letter-spacing: 3px;
            text-transform: uppercase;
        """)
        logo_text.addWidget(company_name)

        subtitle = QLabel("Modelhane System")
        subtitle.setStyleSheet("""
            font-size: 10px;
            color: rgba(255, 255, 255, 150);
            letter-spacing: 2px;
            text-transform: uppercase;
        """)
        logo_text.addWidget(subtitle)

        logo_layout.addLayout(logo_text)
        logo_frame.setLayout(logo_layout)
        layout.addWidget(logo_frame)

        # Menü öğeleri
        self.menu_buttons = QButtonGroup()
        for item_id, text, color in self.menu_items_data:
            btn = AnimatedMenuButton(text, color)
            btn.setCheckable(True)
            btn.setProperty("menu_id", item_id)
            btn.clicked.connect(lambda checked, mid=item_id: self.onMenuClick(mid))
            self.menu_buttons.addButton(btn)
            layout.addWidget(btn)

        # İlk butonu seç
        self.menu_buttons.buttons()[0].setChecked(True)

        layout.addStretch()

        # Kullanıcı paneli
        user_frame = QFrame()
        user_frame.setStyleSheet("""
            QFrame {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(0, 255, 255, 20),
                    stop:1 rgba(0, 100, 200, 20));
                border-top: 2px solid rgba(0, 255, 255, 50);
                padding: 15px;
            }
        """)

        user_layout = QHBoxLayout()
        user_icon = QLabel("👤")
        user_icon.setStyleSheet("font-size: 28px; color: #00ffff;")
        user_layout.addWidget(user_icon)

        user_info = QVBoxLayout()
        user_name = QLabel("ADMIN USER")
        user_name.setStyleSheet("""
            font-weight: bold;
            font-size: 13px;
            color: #ffffff;
            letter-spacing: 1px;
        """)
        user_info.addWidget(user_name)

        user_role = QLabel("System Administrator")
        user_role.setStyleSheet("""
            font-size: 10px;
            color: rgba(255, 255, 255, 180);
            text-transform: uppercase;
        """)
        user_info.addWidget(user_role)

        user_layout.addLayout(user_info)
        user_frame.setLayout(user_layout)
        layout.addWidget(user_frame)

        self.setLayout(layout)

        # Logo animasyonu
        self.logo_animation_timer = QTimer()
        self.logo_animation_timer.timeout.connect(self.animateLogo)
        self.logo_animation_timer.start(100)
        self.logo_angle = 0

    def animateLogo(self):
        # Logo hafifçe yanıp sönsün
        self.logo_angle += 5
        opacity = 0.7 + 0.3 * math.sin(math.radians(self.logo_angle))
        self.logo_label.setGraphicsEffect(None)
        effect = QGraphicsOpacityEffect()
        effect.setOpacity(opacity)
        self.logo_label.setGraphicsEffect(effect)

    def onMenuClick(self, menu_id):
        self.selected_item = menu_id
        self.menuItemSelected.emit(menu_id)


class AnimatedMenuButton(QPushButton):
    """Animasyonlu menü butonu"""

    def __init__(self, text, color="#00ffff"):
        super().__init__(text)
        self.color = QColor(color)
        self.setupStyle()

    def setupStyle(self):
        self.setStyleSheet(f"""
            AnimatedMenuButton {{
                background-color: transparent;
                border: none;
                padding: 15px 25px;
                text-align: left;
                font-size: 14px;
                font-weight: 600;
                color: rgba(255, 255, 255, 180);
                text-transform: uppercase;
                letter-spacing: 1px;
                transition: all 0.3s ease;
            }}
            AnimatedMenuButton:hover {{
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 rgba({self.color.red()}, {self.color.green()}, {self.color.blue()}, 40),
                    stop:1 rgba({self.color.red()}, {self.color.green()}, {self.color.blue()}, 20));
                color: #ffffff;
                border-left: 3px solid {self.color.name()};
            }}
            AnimatedMenuButton:checked {{
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 rgba({self.color.red()}, {self.color.green()}, {self.color.blue()}, 80),
                    stop:0.7 rgba({self.color.red()}, {self.color.green()}, {self.color.blue()}, 40),
                    stop:1 rgba({self.color.red()}, {self.color.green()}, {self.color.blue()}, 20));
                color: #ffffff;
                border-left: 4px solid {self.color.name()};
                font-size: 15px;
            }}
        """)


class FuturisticDashboard(QMainWindow):
    """Ana Futuristik Dashboard Penceresi"""

    def __init__(self):
        super().__init__()
        self.setupSampleData()
        self.current_page = "dashboard"
        self.setupUI()
        self.addBackgroundAnimation()

    def setupSampleData(self):
        """Örnek veriler"""
        self.projeler = [
            Proje(
                id="PRJ-001", ad="Otomatik Vites Sistemi", musteri="OtoTek A.Ş.",
                durum="Üretim", baslangic=datetime.now() - timedelta(days=30),
                bitis=datetime.now() + timedelta(days=45), bütce=250000,
                harcanan=125000, ilerleme=65, sorumlu="Ahmet Demir",
                takim_uyeleri=["Mehmet Kaya", "Ali Yılmaz"], oncelik="Kritik",
                risk_seviyesi="Orta"
            ),
            Proje(
                id="PRJ-002", ad="Hidrolik Pres Kalıbı", musteri="PresMak Endüstri",
                durum="Tasarım", baslangic=datetime.now() - timedelta(days=15),
                bitis=datetime.now() + timedelta(days=60), bütce=180000,
                harcanan=45000, ilerleme=25, sorumlu="Mehmet Kaya",
                takim_uyeleri=["Ali Yılmaz"], oncelik="Yüksek", risk_seviyesi="Düşük"
            ),
        ]

    def setupUI(self):
        self.setWindowTitle("🚀 FIKATIA - Futuristic Dashboard v3.0")
        self.setGeometry(50, 50, 1600, 1000)

        # Ana stil - koyu tema
        self.setStyleSheet("""
            QMainWindow {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 #0a0a1a,
                    stop:0.5 #141428,
                    stop:1 #0a0a1a);
            }
            QWidget {
                font-family: 'Segoe UI', 'Arial', sans-serif;
                color: #ffffff;
            }
            QScrollArea {
                background: transparent;
                border: none;
            }
            QScrollBar:vertical {
                background: rgba(0, 20, 40, 150);
                width: 15px;
                border-radius: 8px;
                border: 1px solid rgba(0, 255, 255, 30);
            }
            QScrollBar::handle:vertical {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 rgba(0, 255, 255, 100),
                    stop:0.5 rgba(0, 150, 255, 150),
                    stop:1 rgba(0, 255, 255, 100));
                border-radius: 6px;
                min-height: 20px;
            }
            QScrollBar::add-line:vertical,
            QScrollBar::sub-line:vertical {
                border: none;
                background: none;
            }
        """)

        # Merkezi widget
        central_widget = QWidget()
        self.setCentralWidget(central_widget)

        # Ana layout
        main_layout = QHBoxLayout()
        main_layout.setContentsMargins(0, 0, 0, 0)
        main_layout.setSpacing(0)

        # Sidebar
        self.sidebar = AnimatedSidebarMenu()
        self.sidebar.menuItemSelected.connect(self.navigateToPage)
        main_layout.addWidget(self.sidebar)

        # İçerik alanı
        self.content_stack = QStackedWidget()
        self.content_stack.setStyleSheet("""
            QStackedWidget {
                background: transparent;
            }
        """)

        # Sayfaları oluştur
        self.createPages()

        main_layout.addWidget(self.content_stack)
        central_widget.setLayout(main_layout)

        # Sayfa geçiş animasyonu
        self.page_animation = QPropertyAnimation(self.content_stack, b"geometry")
        self.page_animation.setDuration(500)
        self.page_animation.setEasingCurve(QEasingCurve.Type.OutCubic)

    def createPages(self):
        """Tüm sayfaları oluştur"""
        # Dashboard
        self.dashboard_page = self.createDashboardPage()
        self.content_stack.addWidget(self.dashboard_page)

        # Diğer sayfalar
        self.cnc_page = self.createCNCPage()
        self.content_stack.addWidget(self.cnc_page)

        self.uretim_page = self.createUretimPage()
        self.content_stack.addWidget(self.uretim_page)

        self.projeler_page = self.createProjelerPage()
        self.content_stack.addWidget(self.projeler_page)

        self.siparisler_page = self.createSiparislerPage()
        self.content_stack.addWidget(self.siparisler_page)

        self.teklifler_page = self.createTekliflerPage()
        self.content_stack.addWidget(self.teklifler_page)

        self.analiz_page = self.createAnalizPage()
        self.content_stack.addWidget(self.analiz_page)

        self.admin_page = self.createAdminPage()
        self.content_stack.addWidget(self.admin_page)

    def createDashboardPage(self):
        """Futuristik Dashboard sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)
        layout.setSpacing(25)

        # Başlık
        header = self.createPageHeader("🌟 COMMAND CENTER", "Sistem genel bakış ve kontrol merkezi")
        layout.addWidget(header)

        # Ana istatistik kartları
        cards_layout = QGridLayout()
        cards_layout.setSpacing(20)

        cards = [
            ("AKTİF PROJE", "12", "2 Kritik", "🚀", "#00ffff"),
            ("SİPARİŞ AKTİF", "24", "4 Acil", "💎", "#ff00ff"),
            ("TEKLİF BEKLEYEN", "8", "3 Son Gün", "⚡", "#00ff88"),
            ("VERİMLİLİK", "%87.5", "↑ 5.2%", "🔥", "#ffaa00"),
            ("MAKİNE DURUM", "3/4", "1 Bakımda", "⚙️", "#ff6b6b"),
            ("TOPLAM CİRO", "$2.4M", "Bu Ay", "💰", "#4ecdc4"),
        ]

        for i, (title, value, subtitle, icon, color) in enumerate(cards):
            card = NeonCard(title, value, subtitle, icon, color)
            cards_layout.addWidget(card, i // 3, i % 3)

        layout.addLayout(cards_layout)

        # Alt bölüm - Aktiviteler ve Hızlı Erişim
        bottom_section = QHBoxLayout()
        bottom_section.setSpacing(20)

        # Aktiviteler paneli
        activity_frame = self.createGlassPanel("🔔 GERÇEK ZAMANLI AKTİVİTE")
        activity_layout = QVBoxLayout()

        # Aktivite listesi
        activities = [
            "⚡ Yeni sipariş oluşturuldu: SIP-2024-003",
            "🎯 Proje tamamlandı: PRJ-045 (100%)",
            "💰 Teklif kabul edildi: TKF-012 ($125K)",
            "🔧 Makine bakımı başlatıldı: CNC-002",
            "📊 Rapor oluşturuldu: Günlük Üretim",
        ]

        for activity in activities:
            activity_label = QLabel(activity)
            activity_label.setStyleSheet("""
                color: rgba(255, 255, 255, 200);
                padding: 8px 12px;
                margin: 2px 0;
                background: rgba(0, 255, 255, 10);
                border-left: 3px solid rgba(0, 255, 255, 50);
                border-radius: 4px;
                font-size: 12px;
            """)
            activity_layout.addWidget(activity_label)

        activity_frame.setLayout(activity_layout)
        bottom_section.addWidget(activity_frame, 2)

        # Hızlı erişim paneli
        quick_frame = self.createGlassPanel("⚡ HIZLI ERİŞİM")
        quick_layout = QVBoxLayout()
        quick_layout.setSpacing(10)

        quick_actions = [
            ("➕ Yeni Proje", "#00ff88"),
            ("📦 Yeni Sipariş", "#ff00ff"),
            ("💼 Yeni Teklif", "#ffaa00"),
            ("📊 Rapor Oluştur", "#00ffff"),
        ]

        for text, color in quick_actions:
            btn = FuturisticButton(text, color)
            btn.setMaximumHeight(50)
            quick_layout.addWidget(btn)

        quick_frame.setLayout(quick_layout)
        bottom_section.addWidget(quick_frame, 1)

        layout.addLayout(bottom_section)
        layout.addStretch()

        page.setLayout(layout)
        return page

    def createGlassPanel(self, title):
        """Cam efekti panel oluştur"""
        panel = QFrame()
        panel.setStyleSheet("""
            QFrame {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(255, 255, 255, 20),
                    stop:0.1 rgba(255, 255, 255, 10),
                    stop:1 rgba(255, 255, 255, 5));
                border: 1px solid rgba(255, 255, 255, 20);
                border-radius: 15px;
                backdrop-filter: blur(10px);
            }
        """)

        layout = QVBoxLayout()
        layout.setContentsMargins(20, 20, 20, 20)

        # Başlık
        header = QLabel(title)
        header.setStyleSheet("""
            font-size: 16px;
            font-weight: bold;
            color: #00ffff;
            padding-bottom: 10px;
            border-bottom: 2px solid rgba(0, 255, 255, 30);
            margin-bottom: 10px;
        """)
        layout.addWidget(header)

        panel.setLayout(layout)
        return panel

    def createCNCPage(self):
        """CNC Takip sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)
        layout.setSpacing(25)

        header = self.createPageHeader("⚡ CNC KONTROL MERKEZİ", "Makine durumu ve üretim takibi")
        layout.addWidget(header)

        # Filtre paneli
        filter_panel = self.createGlassPanel("🔍 FİLTRELE")
        filter_layout = QHBoxLayout()

        filter_layout.addWidget(QLabel("Makine:"))
        makine_combo = self.createFuturisticCombo()
        makine_combo.addItems(["Tümü", "CNC-001", "CNC-002", "FRZ-001", "TRN-001"])
        filter_layout.addWidget(makine_combo)

        filter_layout.addWidget(QLabel("Durum:"))
        durum_combo = self.createFuturisticCombo()
        durum_combo.addItems(["Tümü", "Çalışıyor", "Boşta", "Bakımda", "Arıza"])
        filter_layout.addWidget(durum_combo)

        filter_layout.addStretch()
        btn_yenile = FuturisticButton("🔄 YENİLE", "#00ffff")
        filter_layout.addWidget(btn_yenile)

        filter_panel.setLayout(filter_layout)
        layout.addWidget(filter_panel)

        # Makine grid
        makineler_grid = QGridLayout()
        makineler_grid.setSpacing(20)

        # 4 makine kartı
        for i in range(4):
            makine_card = self.createMachineCard(i)
            makineler_grid.addWidget(makine_card, i // 2, i % 2)

        layout.addLayout(makineler_grid)
        layout.addStretch()

        page.setLayout(layout)
        return page

    def createMachineCard(self, index):
        """Makine kartı oluştur"""
        card = QFrame()
        card.setStyleSheet("""
            QFrame {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(0, 20, 40, 200),
                    stop:0.5 rgba(0, 30, 60, 220),
                    stop:1 rgba(0, 40, 80, 200));
                border: 2px solid rgba(0, 255, 255, 50);
                border-radius: 20px;
                padding: 25px;
            }
        """)

        layout = QVBoxLayout()

        # Makine başlık
        header_layout = QHBoxLayout()
        makine_adi = QLabel(f"CNC-00{index+1}")
        makine_adi.setStyleSheet("""
            font-size: 20px;
            font-weight: bold;
            color: #00ffff;
            text-shadow: 0 0 10px #00ffff;
        """)
        header_layout.addWidget(makine_adi)

        header_layout.addStretch()

        durumlar = ["Çalışıyor", "Boşta", "Bakımda", "Arıza"]
        renkler = ["#00ff00", "#ffaa00", "#ff8800", "#ff0000"]
        durum_label = QLabel(durumlar[index])
        durum_renk = renkler[index]
        durum_label.setStyleSheet(f"""
            background-color: {durum_renk};
            color: #000000;
            padding: 8px 20px;
            border-radius: 20px;
            font-weight: bold;
            font-size: 12px;
            text-transform: uppercase;
        """)
        header_layout.addWidget(durum_label)
        layout.addLayout(header_layout)

        # Verimlilik
        verim = 87 - index * 10
        verim_label = QLabel(f"Verimlilik: %{verim}")
        verim_label.setStyleSheet("color: rgba(255, 255, 255, 200); font-size: 12px;")
        layout.addWidget(verim_label)

        verim_bar = QProgressBar()
        verim_bar.setValue(verim)
        verim_bar.setStyleSheet("""
            QProgressBar {
                border: 1px solid rgba(0, 255, 255, 30);
                border-radius: 10px;
                text-align: center;
                background-color: rgba(0, 20, 40, 150);
                color: #ffffff;
                font-weight: bold;
                height: 25px;
            }
            QProgressBar::chunk {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 #00ffff,
                    stop:0.5 #00ffaa,
                    stop:1 #00ffff);
                border-radius: 9px;
            }
        """)
        layout.addWidget(verim_bar)

        # Sensör verileri
        sensor_grid = QGridLayout()
        sensor_data = [
            ("Sıcaklık", f"{42+index*5}°C", "#ff6b6b"),
            ("Vibrasyon", f"{0.5+index*0.2}g", "#ffd43b"),
            ("Çalışma", f"{1245-index*200}h", "#4ecdc4"),
        ]

        for j, (label, value, color) in enumerate(sensor_data):
            lbl = QLabel(f"{label}:")
            lbl.setStyleSheet("color: rgba(255, 255, 255, 180); font-size: 11px;")
            sensor_grid.addWidget(lbl, j, 0)

            val_lbl = QLabel(value)
            val_lbl.setStyleSheet(f"color: {color}; font-weight: bold; font-size: 14px;")
            sensor_grid.addWidget(val_lbl, j, 1)

        layout.addLayout(sensor_grid)
        layout.addStretch()

        card.setLayout(layout)
        return card

    def createFuturisticCombo(self):
        """Futuristik combobox"""
        combo = QComboBox()
        combo.setStyleSheet("""
            QComboBox {
                background: rgba(0, 20, 40, 200);
                border: 2px solid rgba(0, 255, 255, 50);
                border-radius: 8px;
                padding: 8px 15px;
                color: #ffffff;
                font-size: 13px;
                min-width: 150px;
            }
            QComboBox:hover {
                border-color: rgba(0, 255, 255, 100);
                background: rgba(0, 30, 60, 220);
            }
            QComboBox::drop-down {
                border: none;
                width: 30px;
            }
            QComboBox::down-arrow {
                image: none;
                border-left: 5px solid transparent;
                border-right: 5px solid transparent;
                border-top: 5px solid #00ffff;
            }
            QComboBox QAbstractItemView {
                background: rgba(0, 20, 40, 250);
                border: 2px solid rgba(0, 255, 255, 50);
                selection-background-color: rgba(0, 255, 255, 100);
                color: #ffffff;
            }
        """)
        return combo

    def createUretimPage(self):
        """Üretim sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)

        header = self.createPageHeader("🔥 ÜRETİM KONTROL", "İş emri yönetimi ve takip")
        layout.addWidget(header)

        # Üretim tablosu
        table = QTableWidget()
        table.setColumnCount(8)
        table.setHorizontalHeaderLabels([
            "İŞ EMRİ", "PARÇA", "MİKTAR", "TAMAM", "DURUM",
            "MAKİNE", "OPERATÖR", "TARİH"
        ])

        # Örnek veriler
        table.setRowCount(15)
        for i in range(15):
            table.setItem(i, 0, QTableWidgetItem(f"PO-2024-{i+1:03d}"))
            table.setItem(i, 1, QTableWidgetItem(f"PRJ-{random.randint(100,999)}-{chr(65+i%26)}"))
            table.setItem(i, 2, QTableWidgetItem(str(random.randint(10, 100))))
            table.setItem(i, 3, QTableWidgetItem(str(random.randint(0, 100))))

            durum = random.choice(["Bekliyor", "İşleniyor", "Tamamlandı", "Kalite Kontrol"])
            durum_item = QTableWidgetItem(durum)
            durum_color = {"Bekliyor": "#ffaa00", "İşleniyor": "#00aaff", "Tamamlandı": "#00ff00", "Kalite Kontrol": "#ff00ff"}[durum]
            durum_item.setBackground(QColor(durum_color))
            durum_item.setForeground(QColor("white"))
            table.setItem(i, 4, durum_item)

            table.setItem(i, 5, QTableWidgetItem(f"CNC-00{random.randint(1,4)}"))
            table.setItem(i, 6, QTableWidgetItem(f"OP-{random.randint(1,8):02d}"))
            table.setItem(i, 7, QTableWidgetItem((datetime.now() - timedelta(days=random.randint(0,30))).strftime("%d.%m.%Y")))

        table.setStyleSheet("""
            QTableWidget {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(0, 20, 40, 200),
                    stop:1 rgba(0, 10, 30, 200));
                border: 1px solid rgba(0, 255, 255, 30);
                border-radius: 12px;
                gridline-color: rgba(0, 255, 255, 20);
                color: #ffffff;
            }
            QTableWidget::item {
                padding: 12px;
                border-bottom: 1px solid rgba(0, 255, 255, 10);
            }
            QHeaderView::section {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(0, 40, 80, 200),
                    stop:1 rgba(0, 20, 60, 200));
                color: #00ffff;
                padding: 15px;
                font-weight: bold;
                border: none;
                border-right: 1px solid rgba(0, 255, 255, 30);
                text-transform: uppercase;
                letter-spacing: 1px;
            }
        """)

        layout.addWidget(table)
        page.setLayout(layout)
        return page

    def createProjelerPage(self):
        """Projeler sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)

        header = self.createPageHeader("💎 PROJE YÖNETİMİ", "Tüm projeler ve detaylı takip")
        layout.addWidget(header)

        # Proje kartları
        scroll = QScrollArea()
        scroll.setWidgetResizable(True)

        projeler_widget = QWidget()
        projeler_layout = QGridLayout()
        projeler_layout.setSpacing(20)

        for i, proje in enumerate(self.projeler):
            proje_card = self.createProjectCard(proje)
            projeler_layout.addWidget(proje_card, i // 2, i % 2)

        projeler_widget.setLayout(projeler_layout)
        scroll.setWidget(projeler_widget)
        layout.addWidget(scroll)

        page.setLayout(layout)
        return page

    def createProjectCard(self, proje):
        """Proje kartı oluştur"""
        card = QFrame()
        card.setStyleSheet("""
            QFrame {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(0, 30, 60, 220),
                    stop:0.5 rgba(0, 40, 80, 240),
                    stop:1 rgba(0, 20, 40, 220));
                border: 2px solid rgba(0, 255, 255, 50);
                border-radius: 20px;
                padding: 30px;
            }
        """)

        # Hover efekti
        card.shadow_effect = QGraphicsDropShadowEffect()
        card.shadow_effect.setColor(QColor("#00ffff"))
        card.shadow_effect.setBlurRadius(20)
        card.setGraphicsEffect(card.shadow_effect)

        layout = QVBoxLayout()
        layout.setSpacing(15)

        # Proje başlık
        header_layout = QHBoxLayout()
        proje_id = QLabel(proje.id)
        proje_id.setStyleSheet("font-size: 12px; color: rgba(255, 255, 255, 150); font-weight: bold;")
        header_layout.addWidget(proje_id)

        header_layout.addStretch()

        oncelik_renk = "#ff0000" if proje.oncelik == "Kritik" else "#ff8800" if proje.oncelik == "Yüksek" else "#00ff00"
        oncelik_label = QLabel(proje.oncelik)
        oncelik_label.setStyleSheet(f"""
            background-color: {oncelik_renk};
            color: #000000;
            padding: 6px 15px;
            border-radius: 15px;
            font-size: 11px;
            font-weight: bold;
            text-transform: uppercase;
        """)
        header_layout.addWidget(oncelik_label)
        layout.addLayout(header_layout)

        # Proje adı
        proje_adi = QLabel(proje.ad)
        proje_adi.setStyleSheet("""
            font-size: 22px;
            font-weight: bold;
            color: #00ffff;
            margin: 10px 0;
        """)
        layout.addWidget(proje_adi)

        # Müşteri
        musteri_label = QLabel(f"🏢 {proje.musteri}")
        musteri_label.setStyleSheet("color: rgba(255, 255, 255, 200); font-size: 14px; margin-bottom: 15px;")
        layout.addWidget(musteri_label)

        # Durum
        durum_renk = {"Üretim": "#00ff88", "Tasarım": "#00aaff", "Montaj": "#ff00ff", "Test": "#ffaa00"}.get(proje.durum, "#888888")
        durum_label = QLabel(proje.durum)
        durum_label.setStyleSheet(f"""
            background-color: {durum_renk};
            color: #000000;
            padding: 8px 20px;
            border-radius: 20px;
            font-weight: bold;
            display: inline-block;
            margin: 10px 0;
            text-transform: uppercase;
        """)
        layout.addWidget(durum_label)

        # İlerleme
        layout.addWidget(QLabel("İlerleme:"))
        ilerleme_bar = QProgressBar()
        ilerleme_bar.setValue(int(proje.ilerleme))
        ilerleme_bar.setStyleSheet("""
            QProgressBar {
                border: 1px solid rgba(0, 255, 255, 50);
                border-radius: 10px;
                text-align: center;
                background-color: rgba(0, 20, 40, 150);
                color: #ffffff;
                font-weight: bold;
                height: 30px;
            }
            QProgressBar::chunk {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 #00ffff,
                    stop:0.5 #00ffaa,
                    stop:1 #00ffff);
                border-radius: 9px;
            }
        """)
        layout.addWidget(ilerleme_bar)

        # Detaylar
        details_layout = QHBoxLayout()
        details_layout.setSpacing(20)

        details = [
            (f"📅 {proje.baslangic.strftime('%d.%m.%Y')} - {proje.bitis.strftime('%d.%m.%Y')}", "#ffaa00"),
            (f"💰 ${proje.bütce:,.0f}", "#00ff88"),
            (f"👤 {proje.sorumlu}", "#ff00ff"),
        ]

        for text, color in details:
            detail = QLabel(text)
            detail.setStyleSheet(f"color: {color}; font-weight: bold; font-size: 12px;")
            details_layout.addWidget(detail)

        layout.addLayout(details_layout)
        layout.addStretch()

        card.setLayout(layout)
        return card

    def createSiparislerPage(self):
        """Siparişler sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)

        header = self.createPageHeader("💎 SİPARİŞ YÖNETİMİ", "Tüm siparişler ve ödeme takibi")
        layout.addWidget(header)

        # Sipariş istatistikleri
        stats_layout = QHBoxLayout()
        stats = [
            ("Toplam Sipariş", "127", "#00ffff"),
            ("Bu Ay", "24", "#00ff88"),
            ("Bekleyen", "8", "#ffaa00"),
            ("Geciken", "3", "#ff6b6b"),
        ]

        for title, value, color in stats:
            card = NeonCard(title, value, "", "📦", color)
            card.setFixedSize(200, 100)
            stats_layout.addWidget(card)

        layout.addLayout(stats_layout)

        # Sipariş tablosu
        table = QTableWidget()
        table.setColumnCount(9)
        table.setHorizontalHeaderLabels([
            "SİPARİŞ NO", "MÜŞTERİ", "ÜRÜN", "MİKTAR", "BİRİM FİYAT",
            "TOPLAM", "DURUM", "ÖDEME", "TESLİM"
        ])

        table.setStyleSheet("""
            QTableWidget {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(0, 20, 40, 200),
                    stop:1 rgba(0, 10, 30, 200));
                border: 1px solid rgba(0, 255, 255, 30);
                border-radius: 12px;
                gridline-color: rgba(0, 255, 255, 20);
                color: #ffffff;
            }
            QTableWidget::item {
                padding: 12px;
            }
            QHeaderView::section {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(0, 40, 80, 200),
                    stop:1 rgba(0, 20, 60, 200));
                color: #00ffff;
                padding: 15px;
                font-weight: bold;
                border: none;
                text-transform: uppercase;
            }
        """)

        layout.addWidget(table)
        page.setLayout(layout)
        return page

    def createTekliflerPage(self):
        """Teklifler sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)

        header = self.createPageHeader("🚀 TEKLİF YÖNETİMİ", "Teklifler ve kazanma oranları")
        layout.addWidget(header)

        # Teklif kartları
        cards_layout = QGridLayout()
        cards_layout.setSpacing(20)

        for i in range(6):
            teklif_card = self.createTeklifCard(i)
            cards_layout.addWidget(teklif_card, i // 2, i % 2)

        layout.addLayout(cards_layout)
        page.setLayout(layout)
        return page

    def createTeklifCard(self, index):
        """Teklif kartı oluştur"""
        card = QFrame()
        card.setStyleSheet("""
            QFrame {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgba(40, 20, 80, 220),
                    stop:0.5 rgba(60, 30, 100, 240),
                    stop:1 rgba(40, 20, 80, 220));
                border: 2px solid rgba(255, 0, 255, 50);
                border-radius: 20px;
                padding: 25px;
            }
        """)

        layout = QVBoxLayout()
        layout.setSpacing(15)

        # Teklif bilgisi
        header_layout = QHBoxLayout()
        teklif_id = QLabel(f"TKF-2024-{index+1:03d}")
        teklif_id.setStyleSheet("color: rgba(255, 255, 255, 150); font-weight: bold;")
        header_layout.addWidget(teklif_id)

        header_layout.addStretch()

        ihtimal = 90 - index * 10
        ihtimal_label = QLabel(f"%{ihtimal}")
        ihtimal_color = "#00ff00" if ihtimal > 70 else "#ffaa00" if ihtimal > 40 else "#ff0000"
        ihtimal_label.setStyleSheet(f"""
            background-color: {ihtimal_color};
            color: #000000;
            padding: 6px 15px;
            border-radius: 15px;
            font-weight: bold;
            font-size: 14px;
        """)
        header_layout.addWidget(ihtimal_label)
        layout.addLayout(header_layout)

        # Müşteri
        musteriler = ["TechCorp Industries", "AeroSpace Dynamics", "MedTech Solutions", "AutoParts Pro", "Energy Systems", "Robotics Lab"]
        musteri = QLabel(musteriler[index])
        musteri.setStyleSheet("font-size: 18px; font-weight: bold; color: #ff00ff;")
        layout.addWidget(musteri)

        # Proje adı
        proje_adi = QLabel(f"Proje #{index+1} - Special Components")
        proje_adi.setStyleSheet("color: rgba(255, 255, 255, 200); font-size: 14px;")
        layout.addWidget(proje_adi)

        # Tutar
        tutar = random.randint(50000, 500000)
        tutar_label = QLabel(f"${tutar:,}")
        tutar_label.setStyleSheet("font-size: 28px; font-weight: bold; color: #ffffff; margin: 10px 0;")
        layout.addWidget(tutar_label)

        # Kazanma ihtimali bar
        layout.addWidget(QLabel("Kazanma İhtimali:"))
        ihtimal_bar = QProgressBar()
        ihtimal_bar.setValue(ihtimal)
        ihtimal_bar.setStyleSheet("""
            QProgressBar {
                border: 1px solid rgba(255, 0, 255, 50);
                border-radius: 10px;
                text-align: center;
                background-color: rgba(40, 20, 80, 150);
                color: #ffffff;
                font-weight: bold;
                height: 25px;
            }
            QProgressBar::chunk {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 #ff00ff,
                    stop:0.5 #ff88ff,
                    stop:1 #ff00ff);
                border-radius: 9px;
            }
        """)
        layout.addWidget(ihtimal_bar)

        # Temsilci
        temsilciler = ["Ahmet Demir", "Mehmet Kaya", "Ali Yılmaz", "Veli Can", "Hakan Bülent", "Ayşe Gül"]
        temsilci = QLabel(f"👤 {temsilciler[index]}")
        temsilci.setStyleSheet("color: rgba(255, 255, 255, 180); font-size: 12px;")
        layout.addWidget(temsilci)

        card.setLayout(layout)
        return card

    def createAnalizPage(self):
        """Analiz sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)

        header = self.createPageHeader("📊 ANALİZ MERKEZİ", "Performans grafikleri ve raporlar")
        layout.addWidget(header)

        # Grafikler
        charts_layout = QGridLayout()
        charts_layout.setSpacing(20)

        chart_data = [
            ("AYLIK CİRO", "$1.2M", "📈", "#00ff88", "+15%"),
            ("PROJE TAMAMLANMA", "85%", "✅", "#00aaff", "+5%"),
            ("MÜŞTERİ MEMNUNİYETİ", "4.8/5", "⭐", "#ffaa00", "+0.3"),
            ("VERİMLİLİK", "+12%", "⚡", "#ff00ff", "Artış"),
        ]

        for i, (title, value, icon, color, change) in enumerate(chart_data):
            chart_frame = QFrame()
            chart_frame.setStyleSheet(f"""
                QFrame {{
                    background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                        stop:0 rgba(0, 30, 60, 220),
                        stop:0.5 rgba(0, 40, 80, 240),
                        stop:1 rgba(0, 20, 40, 220));
                    border: 2px solid rgba({QColor(color).red()}, {QColor(color).green()}, {QColor(color).blue()}, 50);
                    border-radius: 20px;
                    padding: 30px;
                }}
            """)

            chart_layout = QVBoxLayout()

            # Başlık
            chart_header = QHBoxLayout()
            icon_label = QLabel(icon)
            icon_label.setStyleSheet(f"font-size: 36px; color: {color};")
            chart_header.addWidget(icon_label)

            chart_header.addStretch()

            change_label = QLabel(change)
            change_label.setStyleSheet(f"color: {color}; font-weight: bold; font-size: 16px;")
            chart_header.addWidget(change_label)
            chart_layout.addLayout(chart_header)

            # Değer
            value_label = QLabel(value)
            value_label.setStyleSheet(f"""
                font-size: 42px;
                font-weight: bold;
                color: {color};
                margin: 20px 0;
            """)
            value_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
            chart_layout.addWidget(value_label)

            title_label = QLabel(title)
            title_label.setStyleSheet("color: rgba(255, 255, 255, 200); font-size: 14px; text-transform: uppercase;")
            title_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
            chart_layout.addWidget(title_label)

            # Grafik alanı (placeholder)
            graph_area = QFrame()
            graph_area.setStyleSheet("""
                QFrame {
                    background: rgba(0, 0, 0, 100);
                    border: 1px dashed rgba(255, 255, 255, 30);
                    border-radius: 10px;
                    height: 100px;
                }
            """)
            chart_layout.addWidget(graph_area)

            chart_frame.setLayout(chart_layout)
            charts_layout.addWidget(chart_frame, i // 2, i % 2)

        layout.addLayout(charts_layout)
        page.setLayout(layout)
        return page

    def createAdminPage(self):
        """Admin paneli sayfası"""
        page = QWidget()
        layout = QVBoxLayout()
        layout.setContentsMargins(30, 30, 30, 30)

        header = self.createPageHeader("⚙️ ADMIN PANEL", "Sistem yönetimi ve ayarlar")
        layout.addWidget(header)

        # Admin sekmeleri
        admin_tabs = QTabWidget()
        admin_tabs.setStyleSheet("""
            QTabWidget::pane {
                background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                    stop:0 rgba(0, 30, 60, 200),
                    stop:1 rgba(0, 20, 40, 200));
                border: 1px solid rgba(0, 255, 255, 30);
                border-radius: 12px;
            }
            QTabBar::tab {
                background: rgba(0, 20, 40, 150);
                padding: 12px 25px;
                margin-right: 5px;
                font-weight: bold;
                color: rgba(255, 255, 255, 200);
                border-top-left-radius: 10px;
                border-top-right-radius: 10px;
                text-transform: uppercase;
            }
            QTabBar::tab:selected {
                background: rgba(0, 40, 80, 200);
                color: #00ffff;
                border-bottom: 3px solid #00ffff;
            }
        """)

        # Kullanıcı yönetimi
        users_tab = QWidget()
        users_layout = QVBoxLayout()

        btn_add_user = FuturisticButton("➕ YENİ KULLANICI EKLE", "#00ff88")
        btn_add_user.setMaximumHeight(50)
        users_layout.addWidget(btn_add_user)

        users_table = QTableWidget()
        users_table.setColumnCount(5)
        users_table.setHorizontalHeaderLabels(["ID", "AD SOYAD", "E-POSTA", "ROL", "DURUM"])
        users_table.setStyleSheet("""
            QTableWidget {
                background: rgba(0, 20, 40, 150);
                border: 1px solid rgba(0, 255, 255, 30);
                border-radius: 8px;
                gridline-color: rgba(0, 255, 255, 20);
                color: #ffffff;
            }
            QHeaderView::section {
                background: rgba(0, 40, 80, 200);
                color: #00ffff;
                padding: 12px;
                font-weight: bold;
            }
        """)

        users_layout.addWidget(users_table)
        users_tab.setLayout(users_layout)
        admin_tabs.addTab(users_tab, "👥 KULLANICILAR")

        # Sistem ayarları
        settings_tab = QWidget()
        settings_layout = QVBoxLayout()

        settings_grid = QGridLayout()
        settings_grid.setSpacing(20)

        settings = [
            ("🏢 Şirket Adı", QLineEdit("Fikatia Modelhane")),
            ("🌐 Web Sitesi", QLineEdit("www.fikatia.com")),
            ("📧 E-posta", QLineEdit("info@fikatia.com")),
            ("📞 Telefon", QLineEdit("+90 212 123 45 67")),
            ("📍 Adres", QLineEdit("İstanbul, Turkey")),
            ("💵 Para Birimi", QComboBox()),
        ]

        for i, (label, widget) in enumerate(settings):
            lbl = QLabel(label)
            lbl.setStyleSheet("color: #00ffff; font-weight: bold; font-size: 14px;")
            settings_grid.addWidget(lbl, i // 2, (i % 2) * 2)

            if isinstance(widget, QComboBox):
                widget.addItems(["TL", "USD", "EUR"])
                widget.setStyleSheet(self.getComboBoxStyle())
            elif isinstance(widget, QLineEdit):
                widget.setStyleSheet(self.getLineEditStyle())

            settings_grid.addWidget(widget, i // 2, (i % 2) * 2 + 1)

        settings_layout.addLayout(settings_grid)

        btn_save = FuturisticButton("💾 AYARLARI KAYDET", "#00aaff")
        btn_save.setMaximumHeight(50)
        settings_layout.addWidget(btn_save)

        settings_tab.setLayout(settings_layout)
        admin_tabs.addTab(settings_tab, "⚙️ AYARLAR")

        layout.addWidget(admin_tabs)
        page.setLayout(layout)
        return page

    def getComboBoxStyle(self):
        return """
            QComboBox {
                background: rgba(0, 20, 40, 200);
                border: 2px solid rgba(0, 255, 255, 50);
                border-radius: 8px;
                padding: 10px 15px;
                color: #ffffff;
                font-size: 13px;
            }
        """

    def getLineEditStyle(self):
        return """
            QLineEdit {
                background: rgba(0, 20, 40, 200);
                border: 2px solid rgba(0, 255, 255, 50);
                border-radius: 8px;
                padding: 10px 15px;
                color: #ffffff;
                font-size: 13px;
            }
        """

    def createPageHeader(self, title, subtitle):
        """Sayfa başlığı oluştur"""
        header = QFrame()
        header.setStyleSheet("""
            QFrame {
                background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                    stop:0 rgba(0, 40, 80, 200),
                    stop:0.5 rgba(0, 60, 120, 220),
                    stop:1 rgba(0, 40, 80, 200));
                border: 2px solid rgba(0, 255, 255, 50);
                border-radius: 20px;
                padding: 25px 35px;
            }
        """)

        layout = QVBoxLayout()
        layout.setSpacing(5)

        title_label = QLabel(title)
        title_label.setStyleSheet("""
            font-size: 28px;
            font-weight: bold;
            color: #00ffff;
            text-transform: uppercase;
            letter-spacing: 2px;
            text-shadow: 0 0 20px rgba(0, 255, 255, 50);
        """)
        layout.addWidget(title_label)

        subtitle_label = QLabel(subtitle)
        subtitle_label.setStyleSheet("""
            font-size: 14px;
            color: rgba(255, 255, 255, 200);
            text-transform: uppercase;
            letter-spacing: 1px;
        """)
        layout.addWidget(subtitle_label)

        header.setLayout(layout)
        return header

    def navigateToPage(self, page_id):
        """Sayfa geçişi"""
        self.current_page = page_id

        page_map = {
            "dashboard": 0,
            "cnc": 1,
            "uretim": 2,
            "projeler": 3,
            "siparisler": 4,
            "teklifler": 5,
            "analiz": 6,
            "admin": 7
        }

        if page_id in page_map:
            # Animasyonlu geçiş
            self.content_stack.setCurrentIndex(page_map[page_id])

    def addBackgroundAnimation(self):
        """Arka plan animasyonu"""
        self.bg_timer = QTimer()
        self.bg_timer.timeout.connect(self.animateBackground)
        self.bg_timer.start(50)
        self.bg_phase = 0

    def animateBackground(self):
        """Arka plan gradyanını animasyonlu değiştir"""
        self.bg_phase += 1
        if self.bg_phase > 360:
            self.bg_phase = 0

        # Dinamik arka plan rengi
        r = int(10 + 5 * math.sin(math.radians(self.bg_phase)))
        g = int(10 + 5 * math.cos(math.radians(self.bg_phase)))
        b = int(26 + 5 * math.sin(math.radians(self.bg_phase * 2)))

        self.setStyleSheet(f"""
            QMainWindow {{
                background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                    stop:0 rgb({r}, {g}, {b}),
                    stop:0.5 rgb({r+10}, {g+10}, {b+10}),
                    stop:1 rgb({r}, {g}, {b}));
            }}
        """)


def main():
    app = QApplication(sys.argv)
    app.setStyle('Fusion')

    # Global font ayarları
    font = QFont("Segoe UI", 10)
    app.setFont(font)

    window = FuturisticDashboard()
    window.show()

    sys.exit(app.exec())


if __name__ == "__main__":
    main()