<?php
/**
 * Página 403 - Acesso Negado - MontaLoja
 */
session_start();

$businessType = $_SESSION['business_type'] ?? 'service';
$typeLabel = $businessType === 'service' ? 'Barbearia/Salão' : 'Loja/Varejo';
$dashboardUrl = '/dashboard.php';
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>403 - Acesso Negado | MontaLoja</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@400;500;600;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/iconify-icon@1.0.7/dist/iconify-icon.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --gold: #CCA43B;
            --gold-light: rgba(204, 164, 59, 0.15);
            --gold-glow: rgba(204, 164, 59, 0.4);
            --bg-dark: #0A0A0F;
            --bg-card: rgba(255, 255, 255, 0.03);
            --text-primary: #FFFFFF;
            --text-secondary: rgba(255, 255, 255, 0.6);
            --border: rgba(255, 255, 255, 0.08);
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: var(--bg-dark);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1.5rem;
            overflow: hidden;
        }

        /* Animated Background */
        .bg-pattern {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: 
                radial-gradient(ellipse at 20% 80%, rgba(204, 164, 59, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(204, 164, 59, 0.05) 0%, transparent 50%);
            z-index: 0;
        }

        .bg-grid {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
                              linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
            background-size: 50px 50px;
            z-index: 0;
        }

        /* Main Container */
        .error-container {
            position: relative;
            z-index: 1;
            width: 100%;
            max-width: 480px;
            animation: fadeInUp 0.6s ease-out;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Card */
        .error-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 24px;
            padding: 3rem 2rem;
            text-align: center;
            backdrop-filter: blur(20px);
            position: relative;
            overflow: hidden;
        }

        .error-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 150px;
            height: 3px;
            background: linear-gradient(90deg, transparent, var(--gold), transparent);
            border-radius: 0 0 4px 4px;
        }

        /* Icon Container */
        .icon-wrapper {
            position: relative;
            width: 100px;
            height: 100px;
            margin: 0 auto 1.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .icon-bg {
            position: absolute;
            width: 100%;
            height: 100%;
            background: var(--gold-light);
            border-radius: 50%;
            animation: pulse 2s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); opacity: 0.5; }
            50% { transform: scale(1.1); opacity: 0.3; }
        }

        .icon-wrapper iconify-icon {
            position: relative;
            font-size: 3rem;
            color: var(--gold);
            z-index: 1;
        }

        /* Error Code */
        .error-code {
            font-size: clamp(3.5rem, 12vw, 5rem);
            font-weight: 700;
            background: linear-gradient(135deg, var(--gold), #E8C547);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            line-height: 1;
            margin-bottom: 0.5rem;
            letter-spacing: -2px;
        }

        /* Title */
        .error-title {
            font-size: clamp(1.25rem, 4vw, 1.5rem);
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 1.25rem;
        }

        /* Badge */
        .error-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            background: var(--gold-light);
            color: var(--gold);
            padding: 0.5rem 1rem;
            border-radius: 100px;
            font-size: 0.85rem;
            font-weight: 500;
            margin-bottom: 1.25rem;
        }

        .error-badge iconify-icon {
            font-size: 1rem;
        }

        /* Message */
        .error-message {
            color: var(--text-secondary);
            font-size: clamp(0.9rem, 3vw, 1rem);
            line-height: 1.7;
            margin-bottom: 2rem;
            max-width: 360px;
            margin-left: auto;
            margin-right: auto;
        }

        .error-message strong {
            color: var(--gold);
            font-weight: 600;
        }

        /* Buttons */
        .btn-group {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0.875rem 1.5rem;
            border-radius: 12px;
            font-size: 0.95rem;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.3s ease;
            cursor: pointer;
            border: none;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--gold), #B8922F);
            color: #0A0A0F;
            box-shadow: 0 4px 20px var(--gold-glow);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 30px var(--gold-glow);
        }

        .btn-primary:active {
            transform: translateY(0);
        }

        .btn-secondary {
            background: var(--bg-card);
            color: var(--text-primary);
            border: 1px solid var(--border);
        }

        .btn-secondary:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.15);
        }

        .btn iconify-icon {
            font-size: 1.1rem;
        }

        /* Help Link */
        .help-text {
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border);
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .help-text a {
            color: var(--gold);
            text-decoration: none;
            font-weight: 500;
            transition: opacity 0.2s;
        }

        .help-text a:hover {
            opacity: 0.8;
            text-decoration: underline;
        }

        /* Responsive */
        @media (max-width: 480px) {
            body {
                padding: 1rem;
            }

            .error-card {
                padding: 2.5rem 1.5rem;
                border-radius: 20px;
            }

            .icon-wrapper {
                width: 80px;
                height: 80px;
            }

            .icon-wrapper iconify-icon {
                font-size: 2.5rem;
            }

            .error-badge {
                font-size: 0.8rem;
                padding: 0.4rem 0.8rem;
            }

            .btn {
                padding: 0.75rem 1.25rem;
                font-size: 0.9rem;
            }
        }

        @media (min-width: 481px) {
            .btn-group {
                flex-direction: row;
                justify-content: center;
            }
        }

        /* Reduced motion */
        @media (prefers-reduced-motion: reduce) {
            .error-container {
                animation: none;
            }
            .icon-bg {
                animation: none;
            }
        }
    </style>
</head>
<body>
    <div class="bg-pattern"></div>
    <div class="bg-grid"></div>

    <div class="error-container">
        <div class="error-card">
            <div class="icon-wrapper">
                <div class="icon-bg"></div>
                <iconify-icon icon="solar:lock-keyhole-bold"></iconify-icon>
            </div>

            <div class="error-code">403</div>

            <h1 class="error-title">Acesso Negado</h1>

            <div class="error-badge">
                <iconify-icon icon="solar:shield-warning-bold"></iconify-icon>
                Tipo: <?= htmlspecialchars($typeLabel) ?>
            </div>

            <p class="error-message">
                Esta página não está disponível para o seu tipo de negócio.
                Seu plano atual é configurado para <strong><?= htmlspecialchars($typeLabel) ?></strong>.
            </p>

            <div class="btn-group">
                <a href="<?= $dashboardUrl ?>" class="btn btn-primary">
                    <iconify-icon icon="solar:home-2-bold"></iconify-icon>
                    Ir para Dashboard
                </a>
                <button onclick="history.back()" class="btn btn-secondary">
                    <iconify-icon icon="solar:arrow-left-bold"></iconify-icon>
                    Voltar
                </button>
            </div>

            <div class="help-text">
                Precisa de ajuda? <a href="/pages/suporte.php">Fale com o suporte</a>
            </div>
        </div>
    </div>
</body>
</html>
