{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Searing Sandwiches | POS & Stock{% endblock %}</title>
    <!-- Fonts -->
    <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=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
    
    <style>
        :root {
            --primary-vibrant: #FF4500;
            --primary-soft: #FFF5F2;
            --secondary-vibrant: #00D1B2;
            --dark-neutral: #1A1D23;
            --light-neutral: #F8F9FA;
            --glass-bg: rgba(255, 255, 255, 0.8);
            --border-soft: rgba(0, 0, 0, 0.08);
        }

        body {
            font-family: 'Plus Jakarta Sans', sans-serif;
            background-color: var(--light-neutral);
            color: var(--dark-neutral);
            min-height: 100vh;
            overflow-x: hidden;
        }

        /* Modern Navbar */
        .navbar {
            background-color: var(--glass-bg);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--border-soft);
            padding: 0.85rem 0;
            transition: all 0.3s ease;
        }

        .navbar-brand {
            font-weight: 800;
            letter-spacing: -1.5px;
            font-size: 1.6rem;
        }

        .brand-accent {
            color: var(--primary-vibrant);
        }

        .nav-link {
            font-weight: 600;
            color: var(--dark-neutral) !important;
            margin: 0 0.5rem;
            transition: color 0.2s;
        }

        .nav-link:hover {
            color: var(--primary-vibrant) !important;
        }

        /* Buttons */
        .btn-vibrant {
            background-color: var(--primary-vibrant);
            color: white;
            border-radius: 12px;
            padding: 0.6rem 1.5rem;
            font-weight: 700;
            border: none;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 4px 12px rgba(255, 69, 0, 0.2);
        }

        .btn-vibrant:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(255, 69, 0, 0.3);
            color: white;
            background-color: #E63E00;
        }

        .btn-outline-vibrant {
            border: 2px solid var(--primary-vibrant);
            color: var(--primary-vibrant);
            border-radius: 12px;
            padding: 0.5rem 1.4rem;
            font-weight: 700;
            transition: all 0.2s;
        }

        .btn-outline-vibrant:hover {
            background-color: var(--primary-vibrant);
            color: white;
        }

        /* Cards & Containers */
        .card {
            border: 1px solid var(--border-soft);
            border-radius: 20px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            background-color: white;
        }

        .card:hover {
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
        }

        .section-title {
            font-weight: 800;
            letter-spacing: -1px;
            margin-bottom: 1.5rem;
        }

        /* Utility Classes */
        .text-vibrant { color: var(--primary-vibrant); }
        .bg-soft { background-color: var(--primary-soft); }
        
        /* Animations */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .animate-fade-in {
            animation: fadeIn 0.5s ease forwards;
        }

        /* Custom Scrollbar */
        ::-webkit-scrollbar { width: 8px; }
        ::-webkit-scrollbar-track { background: var(--light-neutral); }
        ::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--primary-vibrant); }

        /* Responsive POS Adjustments */
        @media (max-width: 991.98px) {
            .cart-sticky {
                position: fixed !important;
                bottom: 0;
                left: 0;
                right: 0;
                top: auto !important;
                z-index: 1030;
                max-height: 60vh !important;
                border-radius: 24px 24px 0 0 !important;
                box-shadow: 0 -10px 40px rgba(0,0,0,0.1) !important;
            }
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
    <nav class="navbar navbar-expand-lg sticky-top">
        <div class="container">
            <a class="navbar-brand" href="{% url 'home' %}">
                <span class="brand-accent">SEARING</span> SANDWICHES
            </a>
            <button class="navbar-toggler border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="bi bi-list fs-1"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto align-items-center">
                    {% if user.is_authenticated %}
                        {% if user.profile and user.profile.role == 'manager' %}
                            <li class="nav-item">
                                <a class="nav-link" href="{% url 'dashboard' %}">Dashboard</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="{% url 'manage_menu' %}">Menu</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="{% url 'manage_users' %}">Users</a>
                            </li>
                        {% endif %}
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'pos' %}">POS</a>
                        </li>
                        <li class="nav-item dropdown ms-lg-3">
                            <a class="nav-link dropdown-toggle d-flex align-items-center" href="#" role="button" data-bs-toggle="dropdown">
                                <div class="bg-soft rounded-circle p-2 me-2 d-inline-flex">
                                    <i class="bi bi-person text-vibrant"></i>
                                </div>
                                {{ user.username }}
                            </a>
                            <ul class="dropdown-menu dropdown-menu-end border-0 shadow-lg rounded-4 p-2">
                                <li><a class="dropdown-item rounded-3 py-2" href="{% url 'logout' %}"><i class="bi bi-box-arrow-right me-2"></i>Logout</a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a href="{% url 'login' %}" class="btn btn-vibrant px-4">Login</a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <div class="container mt-3">
        {% if messages %}
            {% for message in messages %}
                <div class="alert alert-{% if message.tags == 'error' %}danger{% else %}primary{% endif %} border-0 shadow-sm rounded-4 alert-dismissible fade show" role="alert">
                    <i class="bi {% if message.tags == 'error' %}bi-exclamation-circle{% else %}bi-check-circle{% endif %} me-2"></i>
                    {{ message }}
                    <button type="button" class="btn-close" data-bs-alert="alert" aria-label="Close"></button>
                </div>
            {% endfor %}
        {% endif %}
    </div>

    <main class="py-4">
        <div class="container">
            {% block content %}{% endblock %}
        </div>
    </main>

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