:root {
    --brand-red: #d32f2f; --brand-green: #689f38; --bg-color: #f1f5f9; --surface: #ffffff;
    --sidebar-bg: #0f172a; --sidebar-hover: #1e293b; --text-dark: #1e293b; --text-muted: #64748b;
    --border-color: #e2e8f0; --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05); --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --radius-lg: 16px; --radius-md: 10px;
}

/* 🚨 CORRECCIONES PARA EL CELULAR (NO BORRAR) 🚨 */

@media (max-width: 900px) {
    /* 1. Solución al solapamiento: Espacio al fondo para la barra flotante */
    .content-area { 
        padding-bottom: 120px !important; 
    }

    /* 2. Arreglamos el mes para que las flechas ◀ ▶ NO se escondan */
    .calendario-header { 
        justify-content: space-between !important; 
        width: 100% !important; 
        box-sizing: border-box !important; 
        padding: 10px 15px !important; 
    }
    #label-semana { 
        min-width: 10px !important; 
        font-size: 1.2rem !important; 
        flex: 1 !important; 
        text-align: center !important; 
    }
    
    /* 3. Días con diseño elegante deslizable (Carrusel) */
    .week-container { 
        flex-wrap: nowrap !important; 
        justify-content: flex-start !important; 
        overflow-x: auto !important; 
        padding-bottom: 15px !important;
        -webkit-overflow-scrolling: touch;
    }
    .day-box { 
        flex: 0 0 auto !important; 
        min-width: 110px !important; 
    }
    .week-container::-webkit-scrollbar { display: none; }

    /* 4. Solución cuadro de WhatsApp: 100% de pantalla sin deformarse */
    textarea#input-directrices-culto, .input-obs {
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 60px !important;
    }
    
    /* 5. Ajuste extra para que los botones del fondo en Asistencia no se peguen */
    #lista-asistencia-container + div {
        padding-bottom: 30px !important;
    }
}
/* 🎨 MEJORA DEL DISEÑO DEL CUADRO DE WHATSAPP 🎨 */
textarea {
    padding: 12px 15px; 
    font-size: 1rem; 
    border: 2px solid var(--border-color); 
    border-radius: var(--radius-md); 
    color: var(--text-dark); 
    font-weight: 500; 
    transition: all 0.2s; 
    outline: none; 
    background: #f8fafc; 
    width: 100%; 
    box-sizing: border-box; 
    font-family: inherit;
    margin-top: 8px; /* Separación con el título */
    resize: vertical; /* Permite agrandarlo solo hacia abajo */
}
textarea:focus { 
    border-color: var(--brand-green); 
    background: white; 
    box-shadow: 0 0 0 3px rgba(104,159,56,0.1); 
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; margin: 0; background-color: var(--bg-color); color: var(--text-dark); height: 100vh; overflow: hidden; }

#app-container { display: flex; height: 100vh; width: 100vw; }

.sidebar { width: 280px; background: var(--sidebar-bg); color: white; display: flex; flex-direction: column; box-shadow: 4px 0 15px rgba(0,0,0,0.1); z-index: 10; transition: 0.3s;}
.sidebar-header { padding: 30px 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); }
.logo-img { height: 90px; object-fit: contain; margin-bottom: 15px; filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.4)); }
.sidebar-title { font-size: 1.4rem; font-weight: 900; margin: 0; letter-spacing: 1px; color: #f8fafc;}
.sidebar-subtitle { font-size: 0.9rem; color: var(--brand-green); margin-top: 5px; font-style: italic; }

.navbar-vertical { flex: 1; padding: 20px 15px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.nav-btn { background: transparent; border: none; padding: 15px 20px; text-align: left; font-weight: 600; border-radius: var(--radius-md); cursor: pointer; color: #94a3b8; transition: all 0.2s; display: flex; align-items: center; gap: 12px; }
.nav-btn .nav-icon { font-size: 1.2rem; }
.nav-btn .nav-text { font-size: 1.05rem; }
.nav-btn:hover:not(.active) { background: var(--sidebar-hover); color: white; transform: translateX(5px);}
.nav-btn.active { background: var(--brand-green); color: white; box-shadow: 0 4px 12px rgba(104, 159, 56, 0.4); }

.sidebar-footer { padding: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.btn-logout { width: 100%; background: transparent; border: 2px solid #ef4444; color: #ef4444; font-weight: bold; padding: 12px; border-radius: var(--radius-md); cursor: pointer; transition: 0.2s; display: flex; justify-content: center; align-items: center; gap: 8px;}
.btn-logout:hover { background: #ef4444; color: white; }

.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar { background: var(--surface); height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; box-shadow: var(--shadow-sm); z-index: 5; border-bottom: 1px solid var(--border-color);}
.topbar h2 { margin: 0; font-size: 1.4rem; color: var(--text-dark); }
.user-badge { background: #f1f5f9; color: var(--text-dark); font-weight: 700; padding: 8px 18px; border-radius: 30px; font-size: 0.95rem; border: 1px solid var(--border-color); display: flex; align-items: center; gap: 8px;}
.user-badge-role { color: var(--brand-green); font-size: 0.8rem; text-transform: uppercase; }

.content-area { flex: 1; overflow-y: auto; padding: 40px; }
.content-container { max-width: 1100px; margin: 0 auto; }

.admin-section { background: var(--surface); padding: 30px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 30px; display: flex; gap: 20px; align-items: flex-start; justify-content: center; flex-wrap: wrap; border: 1px solid var(--border-color); }
.admin-section.highlight { border: none; background: linear-gradient(145deg, #ffffff, #fcfdfc); box-shadow: 0 10px 25px rgba(104, 159, 56, 0.1); position: relative; overflow: hidden; }
.admin-section.highlight::before { content: ''; position: absolute; top: 0; left: 0; width: 6px; height: 100%; background: var(--brand-green); }

h1, h2 { text-align: center; color: var(--text-dark); margin-bottom: 25px; font-weight: 800; }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], select { padding: 12px 15px; font-size: 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-dark); font-weight: 500; transition: all 0.2s; outline: none; background: #f8fafc; width: 100%; box-sizing: border-box;}
input:focus, select:focus { border-color: var(--brand-green); background: white; box-shadow: 0 0 0 3px rgba(104,159,56,0.1); }

.btn-admin { background: var(--text-dark); color: white; border: none; padding: 12px 24px; font-size: 1rem; font-weight: bold; border-radius: var(--radius-md); cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-admin:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); filter: brightness(1.1);}
.btn-green { background: var(--brand-green); }

.evento-wrapper { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 300px; }
.chips-container { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap;}
.chip { background: #e2e8f0; color: var(--text-dark); padding: 6px 14px; font-size: 0.85rem; border-radius: 20px; cursor: pointer; font-weight: 600; transition: 0.2s; }
.chip:hover { background: var(--text-dark); color: white; }
.chip.active { background: var(--text-dark); color: white; border-color: var(--brand-green); }

.calendario-header { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 30px; background: var(--surface); padding: 15px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); width: max-content; margin-left: auto; margin-right: auto;}
.btn-flecha { background: #f1f5f9; border: none; border-radius: 12px; width: 45px; height: 45px; font-size: 1.2rem; cursor: pointer; color: var(--text-dark); transition: 0.2s; font-weight: bold; }
.btn-flecha:hover { background: var(--text-dark); color: white; transform: scale(1.05); }

.week-container { display: flex; justify-content: center; gap: 15px; margin-bottom: 40px; flex-wrap: wrap; }
.day-box { background: var(--surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px 25px; min-width: 120px; text-align: center; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--shadow-sm); }
.day-box:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.day-box.active { background: var(--text-dark); border-color: var(--text-dark); color: white; transform: translateY(-8px); box-shadow: 0 15px 30px rgba(30, 41, 59, 0.3); }
.day-box.active .day-name { color: #cbd5e1; }
.day-box.active .day-full-date { color: #f8fafc; }
.day-name { font-size: 0.85rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; letter-spacing: 1px;}
.day-number { font-size: 2.8rem; font-weight: 900; line-height: 1; margin-bottom: 8px; }
.day-full-date { font-size: 0.85rem; color: #94a3b8; font-weight: 500; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 25px; margin-bottom: 30px;}
.card { background: var(--surface); padding: 30px; border-radius: var(--radius-lg); text-align: left; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); transition: 0.3s; position: relative; overflow: hidden;}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.disponible { border-top: 6px solid var(--brand-green); }
.ocupado { border-top: 6px solid var(--brand-red); background-color: #fffafb; }
.time { font-size: 1.6rem; font-weight: 900; margin-bottom: 10px; color: var(--text-dark); text-align: center;}
.status { font-size: 0.95rem; font-weight: 800; margin-bottom: 25px; text-transform: uppercase; letter-spacing: 0.5px; text-align: center;}
.status.libre { color: var(--brand-green); }
.status.asignado { color: var(--brand-red); }
.select-hermano { margin-bottom: 20px; width: 100%; box-sizing: border-box;}
.btn-asignar { background: var(--brand-green); color: white; border: none; padding: 12px; border-radius: var(--radius-md); cursor: pointer; width: 100%; font-weight: bold; font-size: 1.05rem; transition: 0.2s;}

.btn-liberar { background: transparent; color: var(--brand-red); border: 2px solid var(--brand-red); padding: 10px; border-radius: var(--radius-md); cursor: pointer; width: 100%; font-weight: bold; margin-top: 20px; transition: 0.2s;}
.btn-liberar:hover { background: var(--brand-red); color: white; }
.nombre-asignado { font-size: 1.3rem; font-weight: 800; background: #fee2e2; color: #b91c1c; padding: 15px; border-radius: var(--radius-md); display: block; width: 100%; box-sizing: border-box; border: 1px dashed #f87171;}

.tabs-grupos { display: flex; gap: 10px; justify-content: flex-start; margin-bottom: 25px; overflow-x: auto; padding-bottom: 10px; border-bottom: 2px solid var(--border-color);}
.tab-btn { padding: 12px 24px; background: transparent; border: none; cursor: pointer; font-weight: 700; font-size: 1.05rem; color: var(--text-muted); transition: 0.2s; border-bottom: 3px solid transparent; white-space: nowrap;}
.tab-btn:hover { color: var(--brand-green); }
.tab-btn.active { color: var(--brand-green); border-bottom-color: var(--brand-green); }

.grupo-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 30px; border: 1px solid var(--border-color); margin-bottom: 30px;}
.grupo-header-title { text-align: left; color: var(--text-dark); font-size: 1.5rem; font-weight: 900; margin-top: 0; margin-bottom: 20px; display: flex; align-items: center; gap: 10px;}
.grupo-header-title::before { content: '📌'; }

.obrero-row { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; padding: 15px 20px; border-radius: var(--radius-md); border: 1px solid var(--border-color); margin-bottom: 12px; transition: 0.2s; flex-wrap: wrap; gap: 15px;}
.obrero-row:hover { border-color: #cbd5e1; background: white; box-shadow: var(--shadow-sm); }

.btn-guardar { width: 100%; margin-top: 15px; background: var(--text-dark); color: white; border: none; padding: 18px; font-size: 1.2rem; font-weight: 800; border-radius: var(--radius-md); cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 1px;}
.btn-guardar:hover { background: var(--brand-green); transform: translateY(-3px); box-shadow: 0 10px 20px rgba(104,159,56,0.2); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 9999; }
.modal-content { background: var(--surface); padding: 40px; border-radius: var(--radius-lg); width: 90%; max-width: 500px; text-align: left; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); border: 1px solid var(--border-color);}
.modal-content h2 { text-align: left; margin-top: 0; }

/* 🎨 DISEÑO DE LOGIN PREMIUM 🎨 */
#panel-login-wrapper { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, #0f172a, #1e293b); display: flex; justify-content: center; align-items: center; z-index: 99999; padding: 20px; box-sizing: border-box; }
.login-box { background: white; padding: 40px 30px; border-radius: 20px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); width: 100%; max-width: 380px; text-align: center; position: relative; border-top: 6px solid var(--brand-green); box-sizing: border-box; }
.login-input { margin-bottom: 15px; padding: 14px; background: #f8fafc; font-size: 1.05rem; border: 2px solid #e2e8f0; border-radius: 10px; width: 100%; box-sizing: border-box; color: #1e293b; font-weight: 600; outline: none; transition: 0.2s;}
.login-input:focus { border-color: var(--brand-green); background: #ffffff; box-shadow: 0 0 0 4px rgba(104, 159, 56, 0.1); }
.badge-aseo { background: #e0f2fe; color: #0369a1; padding: 12px; border-radius: 8px; font-weight: 700; font-size: 0.9rem; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; border: 1px solid #bae6fd;}
.badge-aseo-header { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.badge-aseo-body { display: flex; flex-direction: column; gap: 8px; width: 100%; } 
.badge-aseo button.btn-x { background: none; border: none; color: #ef4444; font-weight: bold; cursor: pointer; font-size: 1.1rem; padding: 0 5px; }
.badge-aseo button.btn-x:hover { transform: scale(1.2); }
.btn-mini-save { background: var(--brand-green) !important; color: white !important; border-radius: 4px; border:none; padding: 6px 10px !important; font-size: 0.9rem !important; cursor:pointer;}
.btn-mini-save:hover { transform: translateY(-2px) !important; box-shadow: 0 2px 4px rgba(0,0,0,0.2);}

/* Ocultar scrollbars horizontales */
.navbar-vertical::-webkit-scrollbar, .tabs-grupos::-webkit-scrollbar, .chips-container::-webkit-scrollbar { display: none; }
.navbar-vertical, .tabs-grupos, .chips-container { -ms-overflow-style: none; scrollbar-width: none; }

/* 📱 DISEÑO CELULAR (BARRA INFERIOR TIPO APP NATIVA) 📱 */
@media (max-width: 900px) {
    #app-container { flex-direction: column; padding-bottom: 80px; }
    .sidebar { width: 100%; height: 65px; flex-direction: row; justify-content: space-between; align-items: center; padding: 0 20px; box-sizing: border-box; z-index: 50; flex-shrink: 0; position: sticky; top: 0; background: var(--sidebar-bg); }
    .sidebar-header { padding: 0; border: none; display: flex; align-items: center; gap: 10px; width: auto;}
    .logo-img { height: 35px; margin: 0; }
    .sidebar-title { font-size: 1.2rem; margin: 0;}
    .sidebar-subtitle { display: none; }
    .sidebar-footer { padding: 0; border: none; display: block; }
    .btn-logout { padding: 6px 12px; font-size: 0.85rem; width: auto; border: 1px solid #ef4444; background: transparent; }
    
    .topbar { height: auto; padding: 12px; flex-direction: column; gap: 8px; align-items: center; text-align: center; border-bottom: 2px solid var(--brand-green); flex-shrink: 0;}
    .topbar h2 { font-size: 1.1rem; margin: 0; white-space: normal;}
    .user-badge { font-size: 0.85rem; padding: 5px 12px; }
    
    .content-area { padding: 15px; }
    .admin-section { padding: 15px; flex-direction: column; gap: 15px;}
    .grid { grid-template-columns: 1fr; gap: 15px; }
    
    /* LA JOYA: BARRA INFERIOR FLOTANTE */
    .navbar-vertical { 
        position: fixed; bottom: 0; left: 0; width: 100%; height: 75px;
        background: var(--sidebar-bg);
        flex-direction: row; justify-content: space-around; align-items: center;
        padding: 5px 10px 15px 10px; margin: 0; box-sizing: border-box;
        z-index: 9999; border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 25px rgba(0,0,0,0.4); overflow: visible;
    }
    .nav-btn { 
        flex-direction: column; gap: 4px; padding: 5px; width: 22%; 
        background: transparent !important; color: #94a3b8; 
        box-shadow: none !important; justify-content: center;
        border-radius: 12px; transition: 0.2s; align-items: center; display: flex;
    }
    .nav-btn .nav-icon { font-size: 1.4rem; margin: 0; display: block; filter: grayscale(100%); opacity: 0.6;}
    .nav-btn .nav-text { font-size: 0.7rem; font-weight: 600; text-align: center; line-height: 1;}
    .nav-btn.active { color: var(--brand-green); transform: translateY(-3px);}
    .nav-btn.active .nav-icon { filter: grayscale(0%); opacity: 1; filter: drop-shadow(0 2px 4px rgba(104,159,56,0.4));}
    
    input[type="text"], input[type="password"], input[type="date"], input[type="time"], select, textarea { width: 100%; box-sizing: border-box; }
    #sec-oracion > div:first-child { flex-direction: column !important; align-items: stretch !important; gap: 10px; }
    #sec-oracion > div:first-child > div { width: 100%; justify-content: space-between; box-sizing: border-box; }
    #btn-pdf-oracion { width: 100%; margin: 0; }
}
/* DISEÑO DE CHECKBOXES PARA MÚLTIPLES GRUPOS */
.checkbox-list { display: flex; flex-direction: column; gap: 8px; max-height: 150px; overflow-y: auto; background: #f8fafc; padding: 12px; border: 2px solid var(--border-color); border-radius: var(--radius-md); margin-bottom: 15px;}
.cb-label { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; font-weight: 600; cursor: pointer; color: var(--text-dark); }
.cb-label input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--brand-green); }