/* --- Variaveis Globais e Temas --- */
:root { 
    --admin-primary: #eab308; /* COR BLINDADA DO SEU SAAS */
    --primary: var(--admin-primary); /* Essa o JS pode mudar (só afeta o app) */
    --btn-text: #1c1c24; /* Cor escura padrão para os botões do painel admin */
    
    --success: #05cd99; 
    --danger: #ee5d50; 
    --sidebar-bg: #1c1c24; 
    --sidebar-hover: #2b2b36; 
    --sidebar-text: #8e8e9e; 
    --sidebar-active-bg: var(--admin-primary); /* Protege o menu lateral */
    --sidebar-active-text: #1c1c24; 
    --bg-light: #f4f7fe; 
    --card-bg: #ffffff; 
    --text-main: #2b3674; 
    --text-muted: #a3aed1; 
    --border-color: #e9edf7; 
}

body.dark-theme {
    --sidebar-bg: #0b0b0e;
    --sidebar-hover: #1c1c24;
    --bg-light: #121212;
    --card-bg: #1e1e24;
    --text-main: #f4f7fe;
    --text-muted: #8e8e9e;
    --border-color: #2b2b36;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-light); color: var(--text-main); font-size: 14px; overflow-x: hidden; transition: background 0.3s, color 0.3s; }

.tela, .aba-conteudo, .aba-cliente { display: none; animation: fadeIn 0.3s; }
.aba-conteudo.ativa, .aba-cliente.ativa { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Layout Admin --- */
/* BLINDAGEM MÁXIMA AQUI: Força a cor do admin independente da cor do white-label */
.app-layout { display: flex; height: 100vh; overflow: hidden; position: relative; width: 100%; --primary: var(--admin-primary) !important; }

.sidebar { width: 260px; background-color: var(--sidebar-bg); color: white; display: flex; flex-direction: column; overflow-y: auto; transition: transform 0.3s ease; flex-shrink: 0; z-index: 1000;}
.sidebar-header { padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.05); }
.sidebar-header h2 { font-size: 1.2rem; display: flex; align-items: center; justify-content: center; gap: 10px;}
.sidebar-menu { flex: 1; padding: 15px 10px; }
.menu-item { display: flex; align-items: center; padding: 12px 15px; color: var(--sidebar-text); border-radius: 8px; margin-bottom: 5px; cursor: pointer; font-weight: 500; transition: 0.2s; }
.menu-item i { width: 25px; font-size: 1.1rem; }
.menu-item:hover { background-color: var(--sidebar-hover); color: white; }
.menu-item.active { background-color: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; }
.sidebar-footer { padding: 15px; border-top: 1px solid rgba(255,255,255,0.05); }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; }

.main-content { flex: 1; overflow-y: auto; padding: 30px; background-color: var(--bg-light); position: relative; width: 100%;}
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px;}
.dash-header-left { display: flex; align-items: center; gap: 15px; }
.dash-title h1 { font-size: 1.8rem; font-weight: 700; color: var(--text-main); }
.dash-title p { color: var(--text-muted); margin-top: 5px; }
.btn-menu-mobile { display: none; background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-main); font-size: 1.5rem; padding: 8px 12px; border-radius: 8px; cursor: pointer; }

.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.metric-card { background: var(--card-bg); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; border: 1px solid var(--border-color); box-shadow: 0 4px 6px rgba(0,0,0,0.02);}
.metric-card-header { display: flex; align-items: center; gap: 15px; width: 100%; }
.icon-box { width: 50px; height: 50px; border-radius: 10px; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; flex-shrink: 0;}
.bg-blue { background: rgba(66, 133, 244, 0.1); color: #4285f4; } .bg-green { background: rgba(5, 205, 153, 0.1); color: #05cd99; } .bg-yellow { background: rgba(234, 179, 8, 0.1); color: #eab308; } .bg-red { background: rgba(238, 93, 80, 0.1); color: #ee5d50; } 

.table-container { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border-color); overflow-x: auto; margin-top: 20px;}
table { width: 100%; border-collapse: collapse; min-width: 600px; color: var(--text-main);}
th, td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background: rgba(0,0,0,0.02); color: var(--text-muted); font-weight: 600; font-size: 0.9rem; }
tr { transition: 0.2s; } .linha-clicavel:hover { background: rgba(0,0,0,0.03); cursor: pointer; }

.btn { padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;}
.btn:hover { opacity: 0.9; } .btn-google { background-color: #4285F4; color: white; width: 100%; padding: 15px; border-radius: 8px;}
.btn-perigo { background: var(--danger); color: white; } 

/* COR INTELIGENTE NO TEXTO DO BOTÃO */
.btn-primario { background: var(--primary); color: var(--btn-text); } 
.btn-secundario { background: var(--sidebar-bg); color: white; }

.form-grupo { margin-bottom: 20px; width: 100%; } .form-controle { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 5px; font-size: 1rem; outline:none; background: var(--card-bg); color: var(--text-main);}
.form-controle:focus { border-color: var(--primary); } .form-controle:disabled { opacity: 0.6; cursor: not-allowed; }
label { display: block; margin-bottom: 8px; color: var(--text-main); font-weight: 600;}

/* --- Modais --- */
.modal-overlay-custom { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 5000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px); animation: fadeIn 0.2s;}
.modal-card-custom { width: 90%; max-width: 450px; background: var(--card-bg); padding: 25px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); position: relative; max-height: 90vh; overflow-y: auto;}
.btn-fechar-modal { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; transition: 0.2s;}
.btn-fechar-modal:hover { color: var(--danger); transform: scale(1.1);}

/* --- App Cliente (Nativo/Flat) --- */
.app-cliente-container { 
    padding-bottom: 80px; background: var(--bg-light); min-height: 100vh; position: relative; max-width: 500px; margin: 0 auto; box-shadow: 0 0 20px rgba(0,0,0,0.08); 
}

/* O Segredo da Leitura Perfeita com Contraste Automático JS */
.app-cliente-container .btn-primario,
.app-cliente-container .badge-promo,
#btnAgendarCliente {
    color: var(--btn-text-dinamico, #1c1c24) !important;
    text-shadow: none !important;
    border: 1px solid rgba(0,0,0,0.1);
}

.app-header-mobile { background: var(--card-bg); height: auto; display: flex; justify-content: center; align-items: center; position: sticky; top: 0; z-index: 4000; border-bottom: 1px solid var(--border-color); box-shadow: 0 2px 10px rgba(0,0,0,0.02); width: 100%; flex-shrink: 0; flex-direction: column; padding: 25px 15px 15px 15px; }
.titulo-app { color:var(--text-main); display:flex; align-items:center; gap:8px; font-size:1.4rem; margin: 0; font-weight:bold; }
.flat-card { padding: 20px; width: 100%; color: var(--text-main); flex: 1; overflow-y: auto; }
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 500px; background: var(--card-bg); display: flex; border-top: 1px solid var(--border-color); z-index: 4000; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 10px rgba(0,0,0,0.03); }
.bottom-nav-item { flex: 1; text-align: center; padding: 12px 0; color: var(--text-muted); font-size: 0.75rem; cursor: pointer; transition: 0.2s; display: flex; flex-direction: column; align-items: center; gap: 5px; font-weight: 600;}
.bottom-nav-item.active { color: var(--primary); }
.equipe-scroll { display: flex; gap: 15px; overflow-x: auto; padding-bottom: 10px; }
.card-profissional { min-width: 110px; background: var(--card-bg); border: 2px solid var(--border-color); border-radius: 12px; padding: 15px 10px; text-align: center; cursor: pointer; transition: 0.2s; } 
.card-profissional.active { border-color: var(--primary); background: rgba(234, 179, 8, 0.05); }
.produto-card { border: 1px solid var(--border-color); border-radius: 10px; padding: 15px; background: var(--card-bg); text-align: center; position: relative;}
.produto-img { width: 100%; height: 120px; background: rgba(0,0,0,0.03); border-radius: 8px; margin-bottom: 10px; display: flex; justify-content: center; align-items: center; font-size: 2rem; color: var(--text-muted);}

.badge-promo { position: absolute; top: -10px; right: -10px; background: var(--primary); color: var(--btn-text); padding: 5px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.2);}
.order-bump { background: rgba(234, 179, 8, 0.1); border: 2px dashed var(--primary); padding: 15px; border-radius: 10px; margin-bottom: 20px; display: flex; align-items: center; gap: 15px; cursor: pointer; transition: 0.2s;} .order-bump input[type="checkbox"] { transform: scale(1.5); }

/* --- Botoes Flutuantes --- */
#btn-theme-toggle { position: fixed; bottom: 85px; left: 20px; background: var(--card-bg); color: var(--text-main); width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--border-color); box-shadow: 0 4px 10px rgba(0,0,0,0.1); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; z-index: 4000; transition: 0.3s; }
#btn-theme-toggle:hover { transform: scale(1.1); }
#floatingSocials { position:fixed; bottom: 85px; right:20px; display:none; flex-direction:column; gap:10px; z-index:4000; }
.btn-social-float { background:var(--card-bg); width:45px; height:45px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:1.5rem; box-shadow:0 4px 10px rgba(0,0,0,0.15); border:1px solid var(--border-color); text-decoration:none; transition: 0.2s; }
.btn-social-float:hover { transform: scale(1.1); }

/* --- Extras --- */
#barraEspiao { display: none; background: var(--danger); color: white; text-align: center; padding: 10px; font-weight: bold; position: sticky; top: 0; z-index: 2000;}
.btn-espiao-sair { background: white; color: var(--danger); border: none; padding: 5px 15px; border-radius: 5px; cursor: pointer; margin-left: 15px; font-weight: bold;}

/* BOTÃO SWITCH BLINDADO - ANTI-ESMAGAMENTO DEFINITIVO */
.switch { 
    position: relative; 
    display: inline-block; 
    width: 50px !important; 
    height: 28px !important; 
    flex: 0 0 50px !important; /* COMANDO SUPREMO: Não cresce, não encolhe, trava em 50px */
    padding: 0 !important;
    margin-right: 5px;
} 

.switch input { opacity: 0; width: 0; height: 0; margin: 0; } 

.slider { 
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; 
    background-color: #ccc; transition: .4s; border-radius: 34px; 
} 

.slider:before { 
    position: absolute; content: ""; 
    height: 20px !important; 
    width: 20px !important; 
    left: 4px; bottom: 4px; 
    background-color: white; transition: .4s; border-radius: 50%; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
} 

input:checked + .slider { background-color: var(--success); } 
/* A matemática exata: 50px totais - 20px da bolinha - 8px de bordas = 22px de movimento */
input:checked + .slider:before { transform: translateX(22px); }

/* FORÇA OS CAMPOS DE HORA A ENCOLHEREM PARA SALVAR O BOTÃO */
input[type="time"].form-controle {
    min-width: 0 !important; 
    flex-shrink: 1 !important;
}

.loader { border: 4px solid var(--border-color); border-top: 4px solid var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; position: fixed; top: 50%; left: 50%; margin-left: -20px; margin-top: -20px; z-index: 5001; display: none; }

/* Overlay de Bloqueio */
#telaBloqueio { position: absolute; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.85); z-index: 3000; display:none; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding: 20px; backdrop-filter: blur(5px); }

/* =========================================
   RESPONSIVIDADE (CELULARES E TABLETS)
========================================= */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 4001; 
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }
    
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; z-index: 4000; }
    .main-content { padding: 15px;  }
    .btn-menu-mobile { display: block;  }

    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .dash-header > div:not(.dash-header-left) { width: 100%; justify-content: space-between; }
    .dash-header-left { width: 100%; }

    .table-container { padding: 0; border-radius: 8px; }
    td, th { padding: 10px; font-size: 0.85rem; }
    .modal-card-custom { width: 95%; padding: 20px; }

    .app-cliente-container {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
}

@media (max-width: 480px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .metric-card-header h3 { font-size: 1.5rem; }
    
    /* Diminui um pouquinho os campos de hora só em telas muito pequenas */
    input[type="time"].form-controle { 
        padding: 8px 4px; 
        font-size: 0.85rem; 
        width: auto !important; 
    }
}

/* --- TELA DE PLANOS SAAS --- */
.planos-container { display: flex; gap: 15px; overflow-x: auto; padding: 10px 5px; align-items: stretch; }
.plano-card { flex: 1; min-width: 240px; background: var(--bg-light); border: 2px solid var(--border-color); border-radius: 12px; padding: 20px; text-align: center; position: relative; transition: 0.3s; }
.plano-card:hover { border-color: var(--primary); transform: translateY(-5px); }
.plano-card.destaque { border-color: var(--primary); background: rgba(234, 179, 8, 0.05); }

.plano-card .badge-promo {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--btn-text);
    font-size: 0.75rem;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 20px;
}

.plano-card h3 { font-size: 1.2rem; color: var(--text-main); margin-bottom: 5px;}
.plano-card .preco { font-size: 1.8rem; font-weight: bold; color: var(--text-main); margin: 15px 0 5px;}
.plano-card .preco span { font-size: 0.9rem; color: var(--text-muted); font-weight: normal;}
.plano-card ul { text-align: left; margin-bottom: 20px; padding-left: 20px; color: var(--text-muted); font-size: 0.9rem;}
.plano-card ul li { margin-bottom: 8px; }

/* =========================================
   ESTILOS DA LANDING PAGE COMERCIAL (SAAS)
========================================= */
.lp-container { max-width: 1100px; margin: 0 auto; padding: 40px 20px; }
.lp-hero { text-align: center; margin-bottom: 60px; animation: lp-fade-in 1s ease-out; }
.lp-hero h1 { font-size: 3rem; color: var(--primary); margin-bottom: 20px; text-shadow: 0 0 20px rgba(234, 179, 8, 0.3); }
.lp-hero p { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 30px; max-width: 700px; margin-left: auto; margin-right: auto; }

.lp-showcase { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; margin-bottom: 80px; }
@media (max-width: 768px) { .lp-showcase { grid-template-columns: 1fr; text-align: center; } }

.lp-features-list { display: flex; flex-direction: column; gap: 15px; }
.lp-feature-btn { 
    background: var(--card-bg); border: 2px solid var(--border-color); border-radius: 12px; 
    padding: 20px; text-align: left; cursor: pointer; transition: all 0.3s;
    display: flex; align-items: center; gap: 15px; color: var(--text-main);
}
.lp-feature-btn i { font-size: 1.8rem; color: var(--primary); width: 30px; text-align: center; }
.lp-feature-btn.active { border-color: var(--primary); box-shadow: 0 0 20px rgba(234, 179, 8, 0.2); transform: scale(1.02); }
.lp-feature-btn:hover { border-color: rgba(234, 179, 8, 0.5); }
.lp-feature-btn h4 { margin: 0 0 5px 0; font-size: 1.1rem; }
.lp-feature-btn p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.lp-mockup-wrapper { display: flex; justify-content: center; animation: lp-float 6s ease-in-out infinite; }
.lp-mockup-frame { 
    width: 300px; height: 600px; background: #000; border-radius: 40px; border: 8px solid #333;
    position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.5); overflow: hidden;
}
.lp-mockup-notch {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 25px;
    background: #333; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; z-index: 10;
}
.lp-mockup-content { 
    width: 100%; height: 100%; background: var(--sidebar-bg); padding: 40px 15px 15px 15px; 
    display: flex; flex-direction: column; gap: 15px; transition: opacity 0.3s;
}

.lp-mockup-header { background: var(--card-bg); padding: 15px; border-radius: 10px; border: 1px solid var(--border-color); }
.lp-mockup-card { background: var(--bg-light); padding: 15px; border-radius: 10px; border-left: 4px solid var(--primary); }

.lp-pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; margin-top: 50px; }

@keyframes lp-float { 
    0% { transform: translateY(0px); } 
    50% { transform: translateY(-15px); } 
    100% { transform: translateY(0px); } 
}
@keyframes lp-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   EMOJIS FLUTUANTES (TELA INICIAL)
========================================= */
.emoji-bg-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.floating-emoji {
    position: absolute;
    font-size: 2rem;
    opacity: 0.15;
    animation: floatEmoji 10s linear infinite;
    bottom: -50px;
}
@keyframes floatEmoji {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.15; }
    90% { opacity: 0.15; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}
