{% 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 %}ShinaStore | Premium E-Commerce{% endblock %}</title>
    <meta name="description" content="{% block meta_description %}Experience premium shopping with ShinaStore. Minimalist design, curated products.{% endblock %}">
    
    <!-- Google 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=Inter:wght@300;400;500;600;700&family=Montserrat:wght@600;700;800&display=swap" rel="stylesheet">
    
    <!-- Bootstrap 5 CDN -->
    <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.1/font/bootstrap-icons.css">
    
    <!-- Custom CSS -->
    <link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
    
    <style>
        :root {
            --primary-color: #0F172A;
            --accent-color: #F43F5E;
            --bg-light: #F8FAFC;
            --text-main: #1E293B;
            --glass-bg: rgba(255, 255, 255, 0.8);
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-light);
            color: var(--text-main);
            overflow-x: hidden;
        }

        h1, h2, h3, h4, h5, .navbar-brand {
            font-family: 'Montserrat', sans-serif;
            font-weight: 700;
        }

        .navbar {
            background: var(--glass-bg);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(0,0,0,0.05);
            padding: 1rem 0;
        }

        .navbar-brand {
            font-size: 1.5rem;
            letter-spacing: -1px;
            color: var(--primary-color) !important;
        }

        .navbar-brand span {
            color: var(--accent-color);
        }

        .btn-primary {
            background-color: var(--primary-color);
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            background-color: #1e293b;
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
        }

        .nav-link {
            font-weight: 500;
            color: var(--text-main) !important;
            margin: 0 0.5rem;
        }

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

        .cart-badge {
            position: absolute;
            top: -5px;
            right: -10px;
            background-color: var(--accent-color);
            color: white;
            font-size: 0.7rem;
            padding: 2px 6px;
            border-radius: 50%;
        }

        footer {
            background: var(--primary-color);
            color: white;
            padding: 4rem 0 2rem;
        }

        .footer-logo {
            font-size: 1.5rem;
            font-weight: 800;
            margin-bottom: 1.5rem;
            display: block;
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
    <nav class="navbar navbar-expand-lg sticky-top">
        <div class="container">
            <a class="navbar-brand" href="{% url 'index' %}">SHINA<span>STORE</span></a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto align-items-center">
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'index' %}">Shop</a>
                    </li>
                    <li class="nav-item position-relative me-3">
                        <a class="nav-link" href="{% url 'cart_detail' %}">
                            <i class="bi bi-bag"></i>
                            {% if request.session.cart %}
                                <span class="cart-badge">{{ request.session.cart|length }}</span>
                            {% endif %}
                        </a>
                    </li>
                    {% if user.is_authenticated %}
                        <li class="nav-item">
                            <a class="nav-link" href="/admin/">Dashboard</a>
                        </li>
                        <li class="nav-item">
                            <a class="btn btn-primary ms-lg-3" href="/admin/logout/">Logout</a>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a class="nav-link" href="/admin/login/?next={{ request.path }}">Login</a>
                        </li>
                        <li class="nav-item">
                            <a class="btn btn-primary ms-lg-3" href="/admin/">Register</a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    {% if messages %}
    <div class="container mt-3">
        {% for message in messages %}
        <div class="alert alert-{{ message.tags }} alert-dismissible fade show shadow-sm" role="alert" style="border-radius: 12px;">
            {{ message }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
        {% endfor %}
    </div>
    {% endif %}

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

    <footer>
        <div class="container">
            <div class="row">
                <div class="col-lg-4 mb-4 mb-lg-0">
                    <span class="footer-logo">SHINASTORE</span>
                    <p class="text-secondary">Premium minimalist e-commerce experience. Curated products for the modern lifestyle.</p>
                </div>
                <div class="col-lg-2 col-md-4 mb-4 mb-md-0">
                    <h5 class="mb-4">Shop</h5>
                    <ul class="list-unstyled">
                        <li><a href="#" class="text-secondary text-decoration-none">New Arrivals</a></li>
                        <li><a href="#" class="text-secondary text-decoration-none">Best Sellers</a></li>
                        <li><a href="#" class="text-secondary text-decoration-none">Sale</a></li>
                    </ul>
                </div>
                <div class="col-lg-2 col-md-4 mb-4 mb-md-0">
                    <h5 class="mb-4">Company</h5>
                    <ul class="list-unstyled">
                        <li><a href="#" class="text-secondary text-decoration-none">About Us</a></li>
                        <li><a href="#" class="text-secondary text-decoration-none">Contact</a></li>
                        <li><a href="#" class="text-secondary text-decoration-none">Careers</a></li>
                    </ul>
                </div>
                <div class="col-lg-4 col-md-4">
                    <h5 class="mb-4">Subscribe</h5>
                    <div class="input-group mb-3">
                        <input type="text" class="form-control bg-transparent border-secondary text-white" placeholder="Email address">
                        <button class="btn btn-outline-light" type="button">Join</button>
                    </div>
                </div>
            </div>
            <hr class="my-5 border-secondary">
            <div class="text-center text-secondary">
                <p>&copy; 2026 ShinaStore. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <!-- Bootstrap 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>
