@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

/* ================= PALETAS DE CORES GERAIS E TRANSIÇÕES ================= */
:root {
    /* Padrão de Inicialização (Rosa Clínica / Light Pink) */
    --bg-color: #fdf3f6;
    --primary-color: #f7708e;
    --primary-light: #ff8fa9;
    --card-bg: #ffffff;
    --text-dark: #6e3549;
    --text-light: #a36f81;
    --border-radius: 24px;
    --shadow: 0 8px 20px rgba(247, 112, 142, 0.15);
    --body-bg: #fce8f0;
}

/* Transição suave ao mudar de cor em todo o app */
body, .app-container, .btn, .header, .bottom-nav, .modal-content, .modal-input, .service-card, .item-card, .pro-card, .profile-pic img {
    transition: background-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: var(--body-bg);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================= UTILITÁRIOS ================= */
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ================= SELETOR DE TEMAS FLUTUANTE (PÍLULA MOBILE) ================= */
.theme-switcher {
    position: fixed;
    bottom: 85px; /* Acima do menu inferior */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 12px;
    z-index: 90; /* Atrás do modal de vídeo */
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: 40px;
    box-shadow: var(--shadow);
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.theme-btn:hover { 
    transform: scale(1.15); 
}

/* ========================================================
   PALETAS DE CORES ESPECÍFICAS (Salão de Beleza / Clínica)
   ======================================================== */

/* Dourado */
body.color-gold {
    --bg-color: #fffaf0;
    --primary-color: #d4af37;
    --primary-light: #f3e5ab;
    --text-dark: #5c4033;
    --text-light: #8b7355;
    --body-bg: #fdf5e6;
    --shadow: 0 8px 20px rgba(212, 175, 55, 0.15);
}

/* Bege */
body.color-beige {
    --bg-color: #fdfaf5;
    --primary-color: #dcbfa6;
    --primary-light: #f5ebe0;
    --text-dark: #705c4c;
    --text-light: #a49da3;
    --body-bg: #fcf6ef;
    --shadow: 0 8px 20px rgba(220, 191, 166, 0.15);
}

/* Verde Água */
body.color-aqua {
    --bg-color: #f0fbf9;
    --primary-color: #48d1cc;
    --primary-light: #afeeee;
    --text-dark: #2f4f4f;
    --text-light: #5f9ea0;
    --body-bg: #e0f7f5;
    --shadow: 0 8px 20px rgba(72, 209, 204, 0.15);
}

/* Roxinho Claro */
body.color-light-purple {
    --bg-color: #f8f3fd;
    --primary-color: #b39ddb;
    --primary-light: #d1c4e9;
    --text-dark: #4a235a;
    --text-light: #8e44ad;
    --body-bg: #f3e8fa;
    --shadow: 0 8px 20px rgba(179, 157, 219, 0.15);
}

/* Azul Clarinho */
body.color-light-blue {
    --bg-color: #f0f8ff;
    --primary-color: #87cefa;
    --primary-light: #b0e0e6;
    --text-dark: #104e8b;
    --text-light: #4682b4;
    --body-bg: #e6f2ff;
    --shadow: 0 8px 20px rgba(135, 206, 250, 0.15);
}

/* --- BARBEARIA / TATTOO (Modos Escuros) --- */
body.color-dark {
    --bg-color: #1a1a1a;
    --primary-color: #ffffff;
    --primary-light: #444444;
    --card-bg: #2d2d2d;
    --text-dark: #f5f5f5;
    --text-light: #aaaaaa;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    --body-bg: #111111;
}

body.color-purple {
    --bg-color: #fdf3fc;
    --primary-color: #9b59b6;
    --primary-light: #b97dd4;
    --card-bg: #ffffff;
    --text-dark: #6e3549;
    --text-light: #a36f81;
    --shadow: 0 8px 20px rgba(155, 89, 182, 0.15);
    --body-bg: #fce8f8;
}

/* ========================================================
   AJUSTES GERAIS DE COMPORTAMENTO EM MODOS ESCUROS
   ======================================================== */
   
body.color-dark .btn-primary, body.color-purple .btn-primary { 
    background: linear-gradient(to right, var(--primary-light), var(--primary-color)); 
    color: #fff; 
    border: 1px solid var(--primary-light); 
}

body.color-dark .modal-input, body.color-purple .modal-input { 
    background-color: rgba(255,255,255,0.05); 
    border-color: rgba(255,255,255,0.2); 
    color: white;
}

body.color-dark .header, body.color-purple .header { 
    background: linear-gradient(135deg, var(--card-bg), var(--primary-color)); 
}

body.color-dark .bottom-nav button span, body.color-purple .bottom-nav button span { color: rgba(255,255,255,0.7); }
body.color-dark .bottom-nav button, body.color-purple .bottom-nav button { color: rgba(255,255,255,0.7); }

body.color-dark .bottom-nav button.active span, body.color-purple .bottom-nav button.active span,
body.color-dark .bottom-nav button.active, body.color-dark .bottom-nav button:hover, body.color-purple .bottom-nav button.active, body.color-purple .bottom-nav button.active { 
    color: white; 
}

body.color-dark .service-info strong, body.color-purple .service-info strong { color: white; }

/* ================= CONTAINER PRINCIPAL ================= */
.app-container {
    background-color: var(--bg-color);
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    position: relative;
    padding-bottom: 130px; 
    box-shadow: 0 0 30px rgba(0,0,0,0.05);
}

/* ================= TELA DE AUTENTICAÇÃO ================= */
.view-section {
    width: 100%;
    display: flex;
    flex-direction: column;
}

#auth-view {
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: calc(100vh - 40px); 
}

.auth-box {
    background-color: var(--card-bg);
    padding: 40px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    margin-top: 5vh;
}

.auth-box .logo {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 30px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.auth-form .modal-input { margin: 0; }

.switch-auth {
    text-align: center;
    margin-top: 20px;
    font-size: 0.95rem;
    color: var(--text-light);
}

.switch-auth a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.3s;
}

/* ================= CABEÇALHO E HERO ================= */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 20px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    border-radius: 0 0 30px 30px;
    margin-bottom: -20px;
    padding-bottom: 45px;
}

.logo { font-weight: 700; letter-spacing: 0.5px; }

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    margin-top: 10px;
}

.welcome-text h2 { font-size: 1.6rem; color: var(--text-dark); }
.welcome-text p { color: var(--text-light); font-size: 0.95rem; }

.profile-pic img {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: var(--shadow);
    object-fit: cover;
}

/* ================= BOTÕES E CARDS BÁSICOS ================= */
.main-actions {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 18px 25px;
    border-radius: var(--border-radius);
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.btn i:first-child { margin-right: 15px; font-size: 1.3rem; }
.chevron { margin-left: auto; font-size: 1rem; }
.btn-primary { background: linear-gradient(to right, var(--primary-light), var(--primary-color)); color: white; }
.btn-secondary { background-color: var(--card-bg); color: var(--primary-color); }

.services { padding: 0 25px 25px 25px; }
.services h3 { 
    font-size: 1.35rem; /* Fonte com mais presença */
    font-weight: 800; /* Mais chamativo */
    color: var(--text-dark); 
    margin-bottom: 8px; 
    letter-spacing: -0.5px; /* Toque moderno na tipografia */
    position: relative;
    padding-bottom: 12px; /* Espaço para o detalhe visual */
}

.services h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 45px; /* Tamanho da barrinha */
    height: 5px; /* Espessura da barrinha */
    background: linear-gradient(to right, var(--primary-light), var(--primary-color));
    border-radius: 10px;
}

.services h3 + p {
    margin-top: 5px !important;
    margin-bottom: 25px !important;
    line-height: 1.4;
}

/* Tratamentos Mobile */
.tratamentos-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.service-card {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.service-card img {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    object-fit: cover;
    margin-right: 15px;
}

.service-info { flex: 1; }
.service-info h4 { font-size: 1rem; margin-bottom: 5px; }
.service-info p { font-size: 0.85rem; color: var(--text-light); }
.service-info strong { color: var(--primary-color); font-size: 1rem; }

/* ================= NAVEGAÇÃO INFERIOR E ABAS ================= */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CORREÇÃO DO VAZAMENTO E ESPAÇO NO FUNDO */
.bottom-nav {
    position: fixed; 
    bottom: 0;
    left: 50%; 
    transform: translateX(-50%); 
    width: 100%;
    max-width: 500px; 
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-between; 
    /* Adicionado padding extra para engolir a margem de segurança do celular (iPhone) */
    padding: 10px 5px calc(10px + env(safe-area-inset-bottom)) 5px; 
    margin: 0;
    border-radius: 0;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.05);
    z-index: 9999;
}

.bottom-nav button {
    background: none;
    border: none;
    color: var(--text-light); 
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 1.1rem;
    /* A mágica que impede os botões de vazarem da tela: */
    flex: 1 1 0px; 
    min-width: 0; 
}

.bottom-nav button span { font-size: 0.65rem; font-weight: 700; }
.bottom-nav button.active, .bottom-nav button:hover { color: var(--primary-color); }

/* ================= GRIDS DE PRODUTOS/VÍDEOS E PROFISSIONAIS ================= */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.item-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.item-card img { width: 100%; height: 120px; object-fit: cover; }
.item-card-body { padding: 10px; }
.item-card-body h4 { font-size: 0.85rem; margin-bottom: 5px; color: var(--text-dark); }
.item-card-body p { font-size: 0.8rem; color: var(--primary-color); font-weight: bold; }

.pro-card {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.pro-card img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    border: 2px solid var(--primary-light);
}

.pro-info h4 { margin-bottom: 3px; font-size: 1rem; }
.pro-info p { font-size: 0.85rem; color: var(--text-light); }

/* ================= MODAIS ================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s;
    z-index: 1000;
}

body.color-dark .modal-overlay { background-color: rgba(0, 0, 0, 0.8); }

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-content {
    background-color: var(--bg-color);
    width: 90%; max-width: 400px;
    border-radius: 30px; padding: 25px;
    transform: translateY(50px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-light); cursor: pointer; }

.modal-input {
    width: 100%; padding: 15px; border-radius: 15px;
    border: 1px solid #ccc; margin: 15px 0;
    font-family: inherit; color: var(--text-dark); background: transparent;
}

/* ================= MODAL DE VÍDEO ================= */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* Mantém a proporção 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 15px;
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ================= CALENDÁRIO ADMIN ================= */
.calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 5px; 
    margin-bottom: 15px; 
}
.cal-day-header { 
    text-align: center; 
    font-size: 0.8rem; 
    font-weight: bold; 
    color: var(--text-light); 
}
.cal-day { 
    background: var(--card-bg); 
    border-radius: 8px; 
    padding: 10px 0; 
    text-align: center; 
    cursor: pointer; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    transition: all 0.2s; 
    font-size: 0.9rem; 
    border: 1px solid transparent; 
    color: var(--text-dark); 
}
.cal-day:hover:not(.empty) { 
    transform: scale(1.05); 
    box-shadow: var(--shadow); 
}
.cal-day.empty { 
    background: transparent; 
    box-shadow: none; 
    cursor: default; 
}
/* Dia que tem agendamento marcado */
.cal-day.has-appts { 
    border: 1px solid var(--primary-color); 
    font-weight: bold; 
    color: var(--primary-color); 
}
/* Dia selecionado/clicado */
.cal-day.active { 
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color)); 
    color: white; 
    border-color: transparent; 
}
/* Ajuste para o modo escuro nas outras páginas */
body.color-dark .cal-day, body.color-purple .cal-day { 
    border: 1px solid rgba(255,255,255,0.1); 
}

/* ================= AVALIAÇÕES E CARROSSEL ================= */
.top-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #f1c40f; /* Dourado das estrelas */
    font-size: 0.9rem;
    margin-bottom: 8px;
}
.top-rating span {
    color: var(--text-light);
    margin-left: 5px;
    font-weight: 700;
    font-size: 0.85rem;
}

.reviews-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px; /* Espaço para não cortar a sombra dos cards */
    scroll-snap-type: x mandatory; /* Faz o scroll "travar" no card certinho */
    scrollbar-width: none; /* Esconde a barra feia no Firefox */
}

.reviews-carousel::-webkit-scrollbar {
    display: none; /* Esconde a barra feia no Chrome/Safari/Edge */
}

.review-card {
    min-width: 280px;
    max-width: 280px;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-price {
    background-color: var(--body-bg); /* Usa o fundo do site para destacar a tag */
    color: var(--primary-color);
    font-weight: 800;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 12px;
    white-space: nowrap; /* Impede o R$ de ficar numa linha e o número na outra */
    margin-left: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.review-header img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

.review-header h4 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.review-card .stars {
    color: #f1c40f;
    font-size: 0.75rem;
}

.review-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    font-style: italic;
}

/* ================= RESPONSIVIDADE DESKTOP ================= */
@media (min-width: 992px) {
    .app-container {
        max-width: 1200px;
        width: 90%;
        margin: 40px auto;
        border-radius: 30px;
        padding-bottom: 0;
    }

    #app-view {
        display: grid;
        grid-template-columns: 260px 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "sidebar header"
            "sidebar main";
        min-height: 80vh;
        background-color: var(--bg-color);
        border-radius: 30px;
    }

    .header {
        grid-area: header;
        background: none;
        color: var(--text-dark);
        padding: 40px 40px 10px 40px;
        margin-bottom: 0;
        border-radius: 0;
    }

    body.color-dark .header { background: none !important; }

    .header .logo { color: var(--primary-color); font-size: 1.8rem !important; }
    
    .header .icon-btn { background: white; color: var(--text-dark); box-shadow: var(--shadow); }
    body.color-dark .header .icon-btn { background: var(--card-bg); color: var(--text-dark); }
    
    .header .icon-btn:hover { background: var(--primary-light); color: white; }

    .tab-content {
        grid-area: main;
        padding: 20px 40px 40px 40px;
        overflow-y: auto;
    }

    /* DESLIGA O AJUSTE MOBILE NO COMPUTADOR */
    .bottom-nav {
        grid-area: sidebar;
        position: relative;
        left: auto; 
        bottom: auto; 
        transform: none; 
        width: auto;
        max-width: none;
        flex-direction: column;
        justify-content: flex-start;
        padding: 40px 20px;
        border-right: 1px solid rgba(0,0,0,0.1);
        border-radius: 30px 0 0 30px;
        box-shadow: none;
        z-index: 10;
    }
    
    body.color-dark .bottom-nav { border-right: 1px solid var(--text-light); }

    .bottom-nav button {
        flex-direction: row;
        justify-content: flex-start;
        padding: 18px 20px;
        border-radius: 15px;
        margin-bottom: 10px;
        transition: all 0.3s ease;
        flex: none; /* Desliga o ajuste mobile no PC */
        min-width: auto;
    }

    .bottom-nav button span { margin-left: 15px; font-size: 1rem; }
    
    .bottom-nav button.active, .bottom-nav button:hover {
        background-color: var(--primary-color); 
        color: white;
        transform: translateX(5px);
    }
    
    /* Hover/Active para os modos escuros no menu lateral do desktop */
    body.color-dark .bottom-nav button.active, body.color-dark .bottom-nav button:hover { 
        background-color: rgba(255,255,255,0.1); 
        color: white; 
    }

    .hero { padding: 0; margin-bottom: 40px; }
    .main-actions { padding: 0; flex-direction: row; margin-bottom: 40px; gap: 20px; }
    .btn { width: auto; flex: 1; padding: 15px 30px; }
    .services { padding: 0; }

    /* Tratamentos Desktop */
    .tratamentos-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .service-card { margin-bottom: 0; }
    .grid-layout { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .item-card img { height: 160px; }
    
    /* Reposiciona a "pílula" de cores para o lado direito no desktop */
    .theme-switcher {
        top: 50%;
        bottom: auto;
        left: auto;
        right: 20px;
        transform: translateY(-50%);
        flex-direction: column;
        background: transparent;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .theme-btn {
        width: 40px;
        height: 40px;
        border: 3px solid #fff;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }
}

/* ================= TOOLTIPS (BALÃO EXPLICATIVO AZUL) ================= */
@media (hover: hover) {
    [data-tooltip] {
        position: relative;
        cursor: help;
    }

    [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 120%;
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        background-color: #007bff;
        color: #ffffff;
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 0.75rem;
        font-weight: 700;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, transform 0.3s ease;
        z-index: 10000;
        box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
        pointer-events: none;
    }

    [data-tooltip]::before {
        content: '';
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        border-width: 6px;
        border-style: solid;
        border-color: #007bff transparent transparent transparent;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, transform 0.3s ease;
        z-index: 10000;
        pointer-events: none;
    }

    [data-tooltip]:hover::after,
    [data-tooltip]:hover::before {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}