/* =========================================
   1. CONFIGURAÇÕES GERAIS
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Manrope:wght@300;400;600;700&display=swap');

:root {
    /* Paleta Luxury Agency */
    --bg-body: #f4f6f9;
    --bg-sidebar: #0a0a0a;
    --text-sidebar: #a0a0a0;
    --text-sidebar-active: #fff;
    --accent-color: #c5a059;
    --accent-hover: #b08d4b;
    --white: #ffffff;
    --sidebar-width: 260px;
    --header-height: 70px;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-body);
    font-family: 'Manrope', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .brand, .navbar-brand {
    font-family: 'Playfair Display', serif;
}

/* =========================================
   2. ESTRUTURA E ANIMAÇÃO (O FIX DO TOGGLE)
   ========================================= */
#wrapper {
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden; /* Evita scroll lateral na animação */
}

/* --- SIDEBAR (Fixa na esquerda) --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed; /* Fixa na tela */
    top: 0;
    left: 0; /* Posição Inicial: Visível */
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    z-index: 1000;
    transition: all 0.3s ease; /* Animação suave */
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}

/* --- CONTEÚDO PRINCIPAL (Margem para não ficar atrás da sidebar) --- */
.main-content {
    width: 100%;
    min-height: 100vh;
    padding: 30px;
    padding-left: calc(var(--sidebar-width) + 30px); /* Margem Esquerda = Sidebar + Espaço */
    transition: all 0.3s ease; /* Animação suave acompanha a sidebar */
}

/* --- HEADER DO CONTEÚDO --- */
.main-content header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

/* =========================================
   3. LÓGICA DO TOGGLE (AQUI ESTAVA O PROBLEMA)
   ========================================= */

/* ESTADO: TOGGLED (Recolhido no Desktop) */
/* 1. Esconde a Sidebar puxando para a esquerda negativa */
#wrapper.toggled .sidebar {
    left: calc(var(--sidebar-width) * -1);
}

/* 2. Remove a margem do conteúdo para ocupar a tela toda */
#wrapper.toggled .main-content {
    padding-left: 30px; /* Volta ao padding normal */
}


/* =========================================
   4. RESPONSIVIDADE (Mobile)
   ========================================= */
@media (max-width: 768px) {

    /* MOBILE PADRÃO: Sidebar Escondida */
    .sidebar {
        left: calc(var(--sidebar-width) * -1);
    }

    /* MOBILE PADRÃO: Conteúdo sem margem */
    .main-content {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* MOBILE TOGGLED (Clicou no botão): Mostra Sidebar */
    #wrapper.toggled .sidebar {
        left: 0;
        box-shadow: 10px 0 50px rgba(0,0,0,0.5);
    }

    /* Opcional: Escurece o fundo ao abrir menu no mobile */
    #wrapper.toggled::before {
        content: "";
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
}

/* =========================================
   5. ELEMENTOS VISUAIS (Links, Tabelas, Etc)
   ========================================= */

/* Menu Links */
.sidebar .brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar a {
    padding: 15px 25px;
    text-decoration: none;
    color: var(--text-sidebar);
    display: flex; align-items: center;
    border-left: 3px solid transparent;
    transition: 0.2s;
}
.sidebar a i { margin-right: 12px; font-size: 1.1rem; }
.sidebar a:hover { color: var(--white); background: rgba(255,255,255,0.03); }
.sidebar a.active {
    background: rgba(197, 160, 89, 0.1);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
}
.sidebar .mt-auto { margin-top: auto; }

/* Botão Toggle */
#menu-toggle {
    cursor: pointer;
    font-size: 1.8rem;
    color: var(--accent-color);
}

/* Tabelas (Com Scroll Fixado) */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: white;
    border-radius: 8px;
}
.table { margin-bottom: 0; white-space: nowrap; }
.table thead th {
    background: #111;
    color: var(--accent-color);
    border: none;
    padding: 15px;
    text-transform: uppercase;
    font-size: 0.75rem;
}
.table tbody td { padding: 15px; vertical-align: middle; border-bottom: 1px solid #eee; }

/* Cards & Buttons */
.card { border: none; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.03); margin-bottom: 20px; }
.btn-primary {
    background: var(--accent-color); border: none; color: #000; font-weight: 600; text-transform: uppercase;
}
.btn-primary:hover { background: var(--accent-hover); color: #000; }
.badge { font-weight: 600; padding: 6px 10px; border-radius: 4px; }

/* --- PÁGINAS EXTRAS --- */
body.login-page { background: #000; display: flex; align-items: center; justify-content: center; height: 100vh; }
.card-login { width: 100%; max-width: 400px; background: #111; border: 1px solid #333; padding: 40px; }
.card-login h3 { color: #fff; }
.card-login .form-control { background: #222; border: 1px solid #333; color: #fff; height: 50px; }

body.home-page { background: #000; }
.home-navbar { background: rgba(0,0,0,0.9); border-bottom: 1px solid #222; padding: 15px 0; }
.hero-section { height: 100vh; background: url('https://images.unsplash.com/photo-1500917293891-ef795e70e1f6?q=80&w=2070&auto=format&fit=crop') center/cover; position: relative; display: flex; align-items: center; justify-content: center; }
.hero-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.hero-content { position: relative; z-index: 2; color: #fff; text-align: center; }
.btn-outline-light { border: 1px solid var(--accent-color); color: var(--accent-color); }
.btn-outline-light:hover { background: var(--accent-color); color: #000; }