<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}FaturaYol - Akıllı Fatura Yönetimi{% endblock %}</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
    {% load static %}
    <style>
        :root {
            --primary-color: #2563eb;
            --sidebar-bg: #0f172a;
            --sidebar-hover: #1e293b;
            --sidebar-active: #334155;
            --bg-body: #f1f5f9;
            --text-main: #1e293b;
            --text-muted: #64748b;
        }
        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-body);
            color: var(--text-main);
            overflow-x: hidden;
            margin: 0;
            padding: 0;
        }
        #wrapper {
            display: flex;
            width: 100%;
            min-height: 100vh;
        }
        #sidebar {
            width: 280px;
            min-width: 280px;
            background: var(--sidebar-bg);
            color: #fff;
            transition: all 0.3s;
            z-index: 1000;
            box-shadow: 4px 0 10px rgba(0,0,0,0.1);
            display: flex;
            flex-direction: column;
        }
        #sidebar .sidebar-header {
            padding: 30px 25px;
            background: rgba(0,0,0,0.2);
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        #sidebar ul.components {
            padding: 20px 15px;
        }
        #sidebar ul li {
            margin-bottom: 5px;
        }
        #sidebar ul li a {
            padding: 12px 20px;
            display: flex;
            align-items: center;
            color: #94a3b8;
            text-decoration: none;
            border-radius: 10px;
            font-weight: 500;
            transition: all 0.2s;
        }
        #sidebar ul li a:hover {
            color: #fff;
            background: var(--sidebar-hover);
        }
        #sidebar ul li.active > a {
            color: #fff;
            background: var(--sidebar-active);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
        }
        #sidebar ul li a i {
            margin-right: 15px;
            font-size: 1.2rem;
        }
        #content {
            flex: 1;
            min-width: 0;
            padding: 40px;
            transition: all 0.3s;
        }
        .top-navbar {
            background: #fff;
            border-bottom: 1px solid #e2e8f0;
            padding: 15px 25px;
            margin-bottom: 35px;
            border-radius: 15px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.05);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .card {
            border: none;
            border-radius: 16px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
            transition: transform 0.2s;
        }
        .card:hover {
            transform: translateY(-2px);
        }
        .btn-primary {
            background-color: var(--primary-color);
            border: none;
            padding: 10px 20px;
            border-radius: 10px;
            font-weight: 600;
        }
        .badge-soft-success { background-color: #d1fae5; color: #065f46; }
        .badge-soft-primary { background-color: #dbeafe; color: #1e40af; }
        
        @media (max-width: 992px) {
            #sidebar {
                margin-left: -280px;
            }
            #sidebar.active {
                margin-left: 0;
            }
            #content {
                padding: 20px;
            }
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
    <div id="wrapper">
        <!-- Sidebar -->
        <nav id="sidebar">
            <div class="sidebar-header">
                <a href="{% url 'home' %}" class="text-white text-decoration-none">
                    <h3 class="mb-0 fw-bold d-flex align-items-center">
                        <i class="bi bi-lightning-charge-fill text-primary me-2"></i>
                        FaturaYol
                    </h3>
                </a>
                <small class="text-muted">Akıllı Arşivleme Sistemi</small>
            </div>

            <ul class="list-unstyled components">
                <li class="{% if active_menu == 'dashboard' %}active{% endif %}">
                    <a href="{% url 'home' %}">
                        <i class="bi bi-grid-1x2-fill"></i>
                        <span>Gösterge Paneli</span>
                    </a>
                </li>
                <li class="{% if active_menu == 'archive' %}active{% endif %}">
                    <a href="{% url 'fatura_arsivi' %}">
                        <i class="bi bi-collection-fill"></i>
                        <span>Fatura Arşivi</span>
                    </a>
                </li>
                <li class="{% if active_menu == 'reports' %}active{% endif %}">
                    <a href="{% url 'raporlar' %}">
                        <i class="bi bi-bar-chart-line-fill"></i>
                        <span>İstatistik & Raporlar</span>
                    </a>
                </li>
            </ul>

            <div class="mt-auto p-4">
                <div class="card bg-primary text-white border-0 p-3" style="background: linear-gradient(45deg, #2563eb, #4f46e5);">
                    <small class="opacity-75 mb-1">Kullanım Durumu</small>
                    <div class="progress mb-2" style="height: 6px; background: rgba(255,255,255,0.2);">
                        <div class="progress-bar bg-white" style="width: 45%;"></div>
                    </div>
                    <small class="small">Sürüm 1.0.4</small>
                </div>
            </div>
        </nav>

        <!-- Page Content -->
        <div id="content">
            <div class="container-fluid p-0">
                <div class="top-navbar">
                    <div class="d-flex align-items-center">
                        <h5 class="mb-0 fw-bold">{% block page_title %}Genel Bakış{% endblock %}</h5>
                    </div>
                    <div class="d-flex align-items-center">
                        <div class="me-4 d-none d-md-block">
                            <form action="{% url 'search' %}" method="get">
                                <div class="input-group">
                                    <span class="input-group-text bg-light border-0"><i class="bi bi-search"></i></span>
                                    <input type="text" name="q" class="form-control bg-light border-0" placeholder="Fatura veya firma ara..." style="width: 300px;" value="{{ query|default:'' }}">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                {% block content %}{% endblock %}
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    {% block extra_js %}{% endblock %}
</body>
</html>