/* style.css - Versão Mestre Completa e Definitiva */

/* =========================================
   1. RESET E BASE
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background: linear-gradient(to bottom, #f0f7ff, #e0e7ff);
    overflow-x: hidden;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #1f2937;
    line-height: 1.5;
}

/* Scrollbars personalizadas */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

/* Utilitários */
.hidden {
    display: none !important;
}

/* =========================================
   2. HEADER E NAVEGAÇÃO
   ========================================= */
header.main-header {
    background: linear-gradient(to right, #1e3a8a, #3b82f6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 100%;
    z-index: 40;
    position: sticky;
    top: 0;
}

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #e5e7eb;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    flex: 1;
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-item.active {
    color: #2563eb;
    font-weight: 600;
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
}

/* =========================================
   3. COMPONENTES DE UI (CARDS, INPUTS)
   ========================================= */

.card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
}

.card:hover {
    box-shadow: 0 10px 40px 0 rgba(31, 38, 135, 0.12);
}

/* Inputs Claros */
.input-field {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    background-color: rgba(255, 255, 255, 0.9);
    transition: all 0.2s;
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.input-field:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    background-color: white;
}

/* Inputs Escuros (Modais Azuis) */
.input-field-dark {
    width: 100%;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.input-field-dark::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-field-dark:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.25);
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

/* CORREÇÃO PARA DROPDOWNS NOS MODAIS */
select.input-field-dark option {
    background-color: #ffffff;
    color: #333333;
}

/* Banner da Criança */
.child-banner {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* =========================================
   4. BOTÕES E INTERAÇÃO
   ========================================= */

.btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.35);
}

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    border: 1px solid #d1d5db;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-ver {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-ver:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.35);
}

.btn-approve {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-approve:active { transform: scale(0.95); }

.btn-reject {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-reject:active { transform: scale(0.95); }

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    border-radius: 16px;
    transition: transform 0.2s, background-color 0.2s;
    border: none;
    cursor: pointer;
    width: 100%;
    height: 100%;
    font-weight: 500;
}

.quick-action-btn:active {
    transform: scale(0.95);
}

.quick-action-btn i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.role-select-btn {
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    width: 100%;
}

.role-select-btn:hover {
    transform: translateY(-2px);
}

.emergency-active-btn {
    background: #ef4444 !important;
    color: white !important;
    border: 2px solid white;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
    animation: pulseRed 1s infinite;
    font-weight: bold;
    z-index: 10;
}

/* =========================================
   5. MODAIS
   ========================================= */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    padding: 1rem;
}

.modal-content {
    background: linear-gradient(160deg, #1e3a8a, #3b82f6);
    color: white;
    border-radius: 24px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.modal-content p, 
.modal-content label {
    color: rgba(255, 255, 255, 0.9);
}

/* =========================================
   6. CHAT E MENSAGENS
   ========================================= */
.message-input-container {
    max-width: 100%;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    position: relative;
    font-size: 0.95rem;
    max-width: 85%;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    word-wrap: break-word;
    margin-bottom: 0.5rem;
}

.message-bubble.sent {
    background: #3b82f6;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.message-bubble.received {
    background: white;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #e5e7eb;
}

.message-bubble.emergency {
    background: #ef4444;
    color: white;
    align-self: center;
    text-align: center;
    width: 95%;
    border-radius: 12px;
    font-weight: bold;
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    border: 2px solid rgba(255,255,255,0.3);
}

.message-bubble.resolved {
    background: #10b981;
    color: white;
    align-self: center;
    text-align: center;
    width: 95%;
    border-radius: 12px;
    font-weight: bold;
    padding: 0.75rem;
    opacity: 0.95;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: none;
}

/* =========================================
   7. CALENDÁRIO
   ========================================= */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background-color: rgba(255,255,255,0.2);
}

.calendar-day:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.calendar-day.active {
    background-color: #2563eb !important;
    color: white !important;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
    border: 2px solid white;
    z-index: 2;
}

.calendar-day.mother {
    background-color: #f472b6;
    color: white;
}

.calendar-day.father {
    background-color: #60a5fa;
    color: white;
}

.calendar-day.pending {
    background-image: repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0),
      rgba(255, 255, 255, 0) 5px,
      rgba(255, 255, 255, 0.4) 5px, 
      rgba(255, 255, 255, 0.4) 10px
    );
    border: 2px dashed #fbbf24;
    position: relative;
    z-index: 1;
}

/* =========================================
   8. ÁLBUM E DOCUMENTOS
   ========================================= */
.album-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.album-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.2s;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.5);
    background-color: #e5e7eb;
}

.album-grid img:hover {
    transform: scale(1.05);
    z-index: 10;
}

.document-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid white;
}

.document-card:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* =========================================
   9. ANIMAÇÕES
   ========================================= */
.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseRed {
    0% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); 
        transform: scale(1); 
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); 
        transform: scale(1.02); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); 
        transform: scale(1); 
    }
}

/* =========================================
   10. TEMA ROSA (MÃE)
   ========================================= */
body.theme-pink header.main-header {
    background: linear-gradient(to right, #be185d, #ec4899);
}

body.theme-pink .btn {
    background: linear-gradient(135deg, #ec4899, #be185d);
    box-shadow: 0 4px 6px rgba(236, 72, 153, 0.25);
}

body.theme-pink .btn:hover {
    box-shadow: 0 6px 12px rgba(236, 72, 153, 0.35);
}

body.theme-pink .nav-item.active {
    color: #db2777;
}

body.theme-pink .input-field:focus {
    border-color: #ec4899;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.3);
}

body.theme-pink .message-bubble.sent {
    background: #ec4899;
}

/* Botão de Aprovação no Calendário */
.btn-calendar-confirm {
    background: #10b981;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-top: 5px;
    display: inline-flex;
    align-items: center;
}

/* =========================================
   11. BANNER DE MEDICAÇÃO (REDESIGN)
   ========================================= */
.med-banner {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1rem;
    margin: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-left: 5px solid #cbd5e1; /* Cinza padrão */
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Estado de Espera (Falta tempo) */
.med-banner.waiting {
    border-left-color: #3b82f6; /* Azul */
}

/* Estado de Ação (Hora de dar/Atrasado) */
.med-banner.action {
    border-left-color: #ef4444; /* Vermelho */
    background: linear-gradient(to right, #fff1f2, #fff);
    animation: pulseBorder 2s infinite;
}

.med-timer-box {
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1f2937;
}

.btn-confirm-med {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    animation: bounce 1s infinite;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* --- ADICIONE AO FINAL DO style.css --- */

/* Botão de resolver dentro do balão de emergência */
.btn-resolve-chat {
    background: white;
    color: #ef4444;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 800;
    margin-top: 10px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.75rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    display: inline-block;
}

.btn-resolve-chat:hover {
    transform: scale(1.05);
    background: #fff1f2;
}

/* Estilo para emergência JÁ RESOLVIDA (Verde) */
.message-bubble.emergency-resolved {
    background: #d1fae5; /* Verde claro */
    color: #065f46;      /* Verde escuro texto */
    border: 2px solid #10b981; /* Borda verde */
    opacity: 1;          /* Totalmente visível */
    text-align: center;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    padding: 1rem;
    border-radius: 12px;
}