/* MFI System CSS - Premium Editorial & Ministerial Theme */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

:root {
    /* Paleta de Colores (Verde Imperial y Oro Ministerial) */
    --primary: #0f2d1e; /* Verde Imperial profundo */
    --primary-hover: #071910;
    --primary-light: #e6edea; /* Fondo local suave verde */
    --secondary: #2d3632; /* Gris pizarra oscuro con matiz verde */
    --accent: #c5a059; /* Oro cálido ministerial */
    --accent-hover: #b48f49;
    --bg-body: #f9f8f6; /* Marfil / Papel cálido suave */
    --bg-card: #ffffff;
    
    --text-main: #232b27;
    --text-muted: #5e6b64;
    --text-on-primary: #ffffff;
    
    --border-color: #e5eae7;
    
    --success: #2e7d32;
    --danger: #d32f2f;
    --info: #0288d1;
    --warning: #f57c00;

    /* Sombras y Radios */
    --shadow-sm: 0 2px 8px rgba(15, 45, 30, 0.03);
    --shadow-md: 0 8px 24px rgba(15, 45, 30, 0.05);
    --shadow-lg: 0 16px 40px rgba(15, 45, 30, 0.08);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reseteo General */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-balance: balance;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* Layout y Contenedor */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Header & Navbar */
.navbar-header {
    background-color: var(--primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--accent);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-on-primary);
}

.logo-brand span {
    color: var(--accent);
}

.logo-brand i {
    font-size: 1.8rem;
    color: var(--accent);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-on-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Botón Hamburguesa */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-on-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Entrada Animada Suave */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* Dashboard & Resúmenes */
.dashboard-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #173d2a 100%);
    color: var(--text-on-primary);
    padding: 4rem 2rem 5.5rem 2rem; /* Separación extra abajo para solapamiento */
    border-radius: var(--radius-lg);
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border-bottom: 3px solid var(--accent);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dashboard-hero h2 {
    color: var(--text-on-primary);
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.dashboard-hero p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.15rem;
    max-width: 650px;
    margin: 0 auto;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: -3rem; /* Solapa sobre la cabecera hero */
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 5;
    padding: 0 1rem;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--accent); /* Borde superior oro elegante */
    transition: var(--transition);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(197, 160, 89, 0.3);
}

.stat-info h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
    color: var(--primary);
    line-height: 1;
}

.stat-info p {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
}

.stat-icon {
    font-size: 2.2rem;
    color: var(--accent);
    background-color: var(--primary-light);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quick Actions Box */
.quick-actions-box {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.quick-actions-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: var(--text-on-primary);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--secondary);
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-accent {
    background-color: var(--accent);
    color: var(--primary);
}

.btn-accent:hover {
    background-color: var(--accent-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #c53030;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Form Search Bar */
.search-form-wrapper {
    margin-bottom: 2.5rem;
}

.search-box-container {
    display: flex;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    padding: 0.4rem;
    border: 1px solid var(--border-color);
}

.search-box-input {
    flex: 1;
    border: none;
    padding: 0.8rem 1rem;
    font-size: 1.05rem;
    outline: none;
    font-family: inherit;
    background: transparent;
}

.search-box-btn {
    border-radius: var(--radius-sm);
}

/* Grid & Cards (Pastores / Colaboradores) */
.page-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.member-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent); /* Borde superior oro */
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.member-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(197, 160, 89, 0.3);
}

/* Badges */
.member-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.badge-pastor {
    background-color: var(--primary);
    color: var(--text-on-primary);
}

.badge-collaborator {
    background-color: #2b6cb0;
    color: white;
}

.badge-membership {
    background-color: var(--accent);
    color: var(--primary);
    border: 1px solid rgba(0,0,0,0.1);
}

.member-card-header {
    height: 160px;
    background: linear-gradient(135deg, #f0f4f1 0%, #e2e8f0 100%);
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 0 1.5rem;
}

.member-card-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--bg-card);
    object-fit: cover;
    background-color: var(--bg-card);
    box-shadow: var(--shadow-md);
    transform: translateY(25px);
    cursor: pointer;
    transition: var(--transition);
}

.member-card-avatar:hover {
    transform: translateY(25px) scale(1.05);
}

.member-card-body {
    padding: 2.5rem 1.5rem 1.5rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.member-name {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.member-position {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.member-details-list {
    list-style: none;
    margin-bottom: 1.5rem;
    flex: 1;
}

.member-details-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #4a5568;
}

.member-details-item i {
    color: var(--primary);
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* Quick Contacts Footer in Card */
.member-card-footer {
    padding: 1rem 1.5rem;
    background-color: #f7fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.contact-quick-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-contact {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-contact:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-contact.btn-whatsapp:hover {
    background-color: #e6fffa;
    color: #38a169;
    border-color: #38a169;
}

.btn-contact.btn-email:hover {
    background-color: #ebf8ff;
    color: #3182ce;
    border-color: #3182ce;
}

/* Detail Profile Grid (Ficha Completa) */
.profile-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    align-items: start;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-container.sidebar-hidden {
    grid-template-columns: 1fr !important;
}

.profile-container.sidebar-hidden .profile-sidebar {
    display: none !important;
}

/* Floating restore button */
.btn-restore-sidebar {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 999;
    background: var(--primary);
    color: var(--text-on-primary);
    border: 1.5px solid var(--accent);
    box-shadow: 0 10px 25px rgba(15, 45, 30, 0.25);
    border-radius: 30px;
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-restore-sidebar:hover {
    background: var(--primary-hover);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 14px 30px rgba(15, 45, 30, 0.35);
}

.profile-sidebar {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
    position: sticky;
    top: 85px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    z-index: 10;
}

.profile-sidebar::-webkit-scrollbar {
    width: 5px;
}

.profile-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.profile-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.profile-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent);
}

.profile-sidebar-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-light);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.profile-sidebar-name {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.profile-sidebar-role {
    font-size: 0.95rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}

.profile-sidebar-contacts {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.contact-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.contact-whatsapp {
    background-color: #25d366;
    color: white;
}

.contact-whatsapp:hover {
    background-color: #1ebe57;
    color: white;
}

.contact-phone {
    background-color: var(--primary);
    color: white;
}

.contact-phone:hover {
    background-color: var(--primary-hover);
    color: white;
}

.contact-email {
    background-color: var(--info);
    color: white;
}

.contact-email:hover {
    background-color: #2b6cb0;
    color: white;
}

/* Contact Card Box & Buttons Layout */
.contact-card-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.85rem 0.75rem;
    margin-bottom: 0.85rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.contact-card-header {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.contact-card-value {
    color: #0f172a;
    font-weight: 700;
    margin-bottom: 0.75rem;
    user-select: all;
    line-height: 1.3;
}

.contact-card-value.phone-value {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: monospace;
    letter-spacing: 0.5px;
}

.contact-card-value.email-value {
    font-size: 0.85rem;
    font-weight: 700;
    word-break: break-all;
    overflow-wrap: anywhere;
    padding: 0 0.25rem;
}

.contact-btn-row {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.contact-btn-row .contact-action-btn {
    margin-bottom: 0;
    flex: 1;
    height: 36px;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    box-sizing: border-box;
    white-space: nowrap;
}

.contact-btn-row .btn-copy-data {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary);
    height: 36px;
    padding: 0 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-sizing: border-box;
    white-space: nowrap;
}

.contact-btn-row .btn-copy-data:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.profile-main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.profile-section-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
}

.profile-section-title {
    font-size: 1.25rem;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.profile-data-item {
    display: flex;
    flex-direction: column;
}

.profile-data-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.profile-data-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
}

.profile-data-value-block {
    white-space: pre-line;
    background-color: #f7fafc;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Forms */
.form-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.form-group.col-full {
    grid-column: 1 / -1;
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.form-label span.required {
    color: var(--danger);
}

.form-control {
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e0;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.15);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Photo Input Upload Box */
.photo-upload-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background-color: #f7fafc;
    border: 2px dashed #cbd5e0;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    transition: var(--transition);
}

.photo-upload-container:hover {
    border-color: var(--primary);
}

.photo-preview-box {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #cbd5e0;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.photo-upload-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.photo-upload-info label {
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    transition: var(--transition);
    text-align: center;
}

.photo-upload-info label:hover {
    background-color: var(--primary);
    color: white;
}

.photo-upload-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Form Actions Button Bar */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

/* Search results styles */
.search-results-meta {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Custom Table/List for Collaborators inside Pastor profile */
.collaborator-table-wrapper {
    overflow-x: auto;
}

.collaborators-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.collaborators-table th, .collaborators-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.collaborators-table th {
    background-color: #f7fafc;
    color: var(--secondary);
    font-weight: 600;
}

.collaborator-table-row:hover {
    background-color: #fcfdfd;
}

.collaborator-list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 0.75rem;
}

/* Alert Boxes / Toast */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #def7ec;
    color: #03543f;
    border-left: 5px solid var(--success);
}

.alert-danger {
    background-color: #fde8e8;
    color: #9b1c1c;
    border-left: 5px solid var(--danger);
}

/* Footer Section */
.footer-section {
    background-color: var(--secondary);
    color: #cbd5e0;
    padding: 2rem 0;
    margin-top: auto;
    border-top: 4px solid var(--primary);
    text-align: center;
}

.footer-content p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-brand {
    font-weight: 700;
    color: white;
}

.footer-brand span {
    color: var(--accent);
}

/* Responsive Rules */
@media (max-width: 992px) {
    .profile-container {
        grid-template-columns: 1fr;
    }
    
    .profile-sidebar {
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        position: relative;
    }

    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 70px;
        left: 0;
        background-color: var(--primary);
        padding: 1.5rem;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    .dashboard-hero {
        padding: 2rem 1.5rem;
    }

    .dashboard-hero h2 {
        font-size: 1.8rem;
    }

    .form-group-grid {
        grid-template-columns: 1fr;
    }
}

/* Modulo Asistencia - Estilos Modernos */
.attendance-header-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.attendance-date-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.attendance-date-input {
    padding: 0.6rem 1rem;
    border: 1px solid #cbd5e0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--primary);
    outline: none;
    transition: var(--transition);
}

.attendance-date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.15);
}

.save-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
}

.save-indicator.saving {
    opacity: 1;
    visibility: visible;
    background-color: var(--primary-light);
    color: var(--primary);
}

.save-indicator.success {
    opacity: 1;
    visibility: visible;
    background-color: #def7ec;
    color: var(--success);
}

/* Switches iOS Elegantes */
.switch-container {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: var(--transition);
    border-radius: 34px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.switch-container input:checked + .switch-slider {
    background-color: var(--success);
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(24px);
}

/* Badge de tipo de persona en la lista de asistencia */
.attendee-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.attendee-badge.badge-pastor {
    background-color: var(--primary-light);
    color: var(--primary);
}

.attendee-badge.badge-collab {
    background-color: #ebf8ff;
    color: #2b6cb0;
}

/* Staggered load animation delays for grid elements */
.stats-grid > :nth-child(1) { animation-delay: 0.05s; }
.stats-grid > :nth-child(2) { animation-delay: 0.10s; }
.stats-grid > :nth-child(3) { animation-delay: 0.15s; }

.card-grid > :nth-child(1) { animation-delay: 0.05s; }
.card-grid > :nth-child(2) { animation-delay: 0.10s; }
.card-grid > :nth-child(3) { animation-delay: 0.15s; }
.card-grid > :nth-child(4) { animation-delay: 0.20s; }
.card-grid > :nth-child(5) { animation-delay: 0.25s; }
.card-grid > :nth-child(6) { animation-delay: 0.30s; }

/* Responsive enhancements for mobile/tablet */
@media (max-width: 992px) {
    .profile-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .profile-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    .main-content {
        padding: 1.5rem 0;
    }
    .dashboard-hero {
        padding: 3rem 1.5rem 5rem 1.5rem;
    }
    .dashboard-hero h2 {
        font-size: 2rem;
    }
    .stats-grid {
        margin-top: -2.5rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .page-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .page-section-header .btn {
        width: 100%;
    }
    .quick-actions-grid {
        flex-direction: column;
        width: 100%;
    }
    .quick-actions-grid .btn {
        width: 100%;
    }
    .form-group-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    .col-full {
        grid-column: span 1 !important;
    }
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    .form-actions .btn {
        width: 100%;
    }
    .navbar-container {
        position: relative;
    }
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: -1rem;
        right: -1rem;
        background-color: var(--primary);
        flex-direction: column;
        padding: 1.5rem 1rem;
        gap: 0.75rem;
        border-top: 1px solid var(--accent);
        border-bottom: 3px solid var(--accent);
        box-shadow: var(--shadow-lg);
        z-index: 100;
    }
    .nav-menu.active {
        display: flex;
    }
    .menu-toggle {
        display: block;
    }
}

/* Ventana Modal de Importación Masiva */
.import-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.import-modal.active {
    display: flex;
}

.import-modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 96vw;
    max-width: 1600px;
    max-height: 92vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border-top: 5px solid var(--accent);
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.import-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.import-modal-header h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
}

.import-modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.import-modal-close-btn:hover {
    color: var(--danger);
}

.import-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.import-modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: #fcfbf9;
}

.import-table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    /* Scrollbar visible y estilizada */
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-body);
    cursor: default;
}

.import-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.import-table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 4px;
}

.import-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.import-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.import-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.import-table th, .import-table td {
    padding: 0.65rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.import-table th {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    text-align: left;
}

.import-table td input, .import-table td select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: var(--transition);
    width: 100%;
    min-width: 100px;
    max-width: 180px;
    box-sizing: border-box;
}

.import-table td input:focus, .import-table td select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.1);
}

.import-table td input.invalid {
    border-color: var(--danger);
    background-color: #fdf2f2;
}

.import-table tr.row-invalid {
    background-color: #fffaf0;
}

.import-table td .btn-delete-row {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.import-table td .btn-delete-row:hover {
    color: var(--danger);
}

/* ==========================================================================
   Estilos de Usuario y Cierre de Sesión en el Menú (Horizontal)
   ========================================================================== */
.user-menu-item {
    border-left: 1px solid rgba(255,255,255,0.2);
    padding-left: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-menu-name {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-logout {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    background-color: var(--danger);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background-color: #b32424;
    color: white;
    transform: scale(1.05);
}

/* ==========================================================================
   Sidebar Lateral Izquierdo (Pantallas Grandes)
   ========================================================================== */
@media (min-width: 769px) {
    /* Layout principal usando CSS Grid para Sidebar lateral y contenido */
    body.admin-layout {
        display: grid !important;
        grid-template-columns: 280px 1fr !important;
        grid-template-rows: 1fr auto !important;
        grid-template-areas: 
            "sidebar main"
            "sidebar footer" !important;
        min-height: 100vh;
        margin: 0;
        overflow-x: hidden;
        transition: grid-template-columns 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Estado Colapsado / Oculto del Sidebar */
    body.admin-layout.main-sidebar-collapsed {
        grid-template-columns: 0px 1fr !important;
        grid-template-areas: 
            "main main"
            "footer footer" !important;
    }

    body.admin-layout.main-sidebar-collapsed .navbar-header {
        transform: translateX(-100%);
        box-shadow: none;
    }

    /* Modificación de Navbar superior a Sidebar lateral */
    .navbar-header {
        grid-area: sidebar;
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        border-bottom: none;
        border-right: 3px solid var(--accent);
        display: flex;
        flex-direction: column;
        z-index: 1000;
        padding: 1.5rem 1.25rem;
        box-shadow: 4px 0 24px rgba(15, 45, 30, 0.15);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Botón para colapsar en el sidebar */
    .btn-sidebar-collapse {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: var(--text-on-primary);
        width: 32px;
        height: 32px;
        border-radius: var(--radius-sm);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: var(--transition);
        font-size: 0.9rem;
        z-index: 10;
    }

    .btn-sidebar-collapse:hover {
        background: var(--accent);
        color: var(--primary);
        transform: scale(1.05);
    }

    /* Botón flotante para expandir el sidebar cuando está oculto */
    .btn-sidebar-expand-floating {
        position: fixed;
        top: 1.25rem;
        left: 1.25rem;
        z-index: 9999;
        background: var(--primary);
        color: var(--text-on-primary);
        border: 2px solid var(--accent);
        box-shadow: 0 8px 25px rgba(15, 45, 30, 0.3);
        border-radius: 50%;
        width: 44px;
        height: 44px;
        display: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: var(--transition);
        font-size: 1.15rem;
    }

    .btn-sidebar-expand-floating:hover {
        background: var(--primary-hover);
        transform: scale(1.1);
        color: var(--accent);
        box-shadow: 0 12px 30px rgba(15, 45, 30, 0.4);
    }

    body.admin-layout.main-sidebar-collapsed .btn-sidebar-expand-floating {
        display: flex !important;
    }

    /* Contenedor del navbar para Sidebar vertical */
    .navbar-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: space-between;
        height: 100%;
        gap: 2rem;
    }

    /* Logo superior en el Sidebar */
    .logo-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
        margin-bottom: 1rem;
        width: 100%;
    }

    .logo-brand img {
        max-height: 55px; /* Logo más grande y presentable */
        width: auto;
        object-fit: contain;
        filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
    }

    .logo-brand span {
        display: block;
        font-size: 1.1rem;
    }

    /* Menú de Navegación Vertical */
    .nav-menu {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.5rem;
        margin-bottom: auto; /* Empuja el perfil de usuario al final */
        overflow-y: auto;
        padding-right: 0.25rem;
    }

    /* Enlaces individuales estilo tarjeta lateral */
    .nav-link {
        padding: 0.75rem 1rem;
        width: 100%;
        font-size: 0.95rem;
        border-radius: var(--radius-sm);
        border-left: 3px solid transparent;
        transition: var(--transition);
    }

    /* Efectos hover y activos premium con indicador dorado en el borde izquierdo */
    .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.05);
        color: var(--text-on-primary);
        border-left-color: var(--accent-hover);
        padding-left: 1.25rem; /* Efecto sutil de desplazamiento al pasar el ratón */
    }

    .nav-link.active {
        background-color: rgba(255, 255, 255, 0.08) !important;
        color: var(--text-on-primary) !important;
        border-left-color: var(--accent);
        font-weight: 600;
        box-shadow: inset 3px 0 8px rgba(0, 0, 0, 0.1);
    }

    /* Perfil de usuario al pie del Sidebar */
    .user-menu-item {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-left: 0;
        padding-top: 1.5rem;
        margin-top: 1rem;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    .user-menu-name {
        font-size: 0.95rem;
    }

    .btn-logout {
        padding: 0.45rem 0.75rem;
        font-size: 0.95rem;
    }

    /* Contenido Principal en la Grid (ocupa la columna derecha de forma natural) */
    .main-content {
        grid-area: main;
        margin-left: 0 !important;
        width: 100% !important;
        padding: 2.5rem 3rem;
        flex: none !important;
    }

    /* Footer en la Grid (ocupa la columna derecha al pie) */
    .footer-section {
        grid-area: footer;
        margin-left: 0 !important;
        width: 100% !important;
        flex: none !important;
    }
}

/* ==========================================================================
   Estilos de Modales Dinámicos Modernos (SweetAlert Style)
   ========================================================================== */
.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 30, 23, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal-backdrop.active {
    opacity: 1;
}

.custom-modal-window {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 95%;
    max-width: 480px;
    padding: 2.25rem 2rem;
    text-align: center;
    transform: scale(0.85);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    border-top: 5px solid var(--accent);
}

.custom-modal-backdrop.active .custom-modal-window {
    transform: scale(1);
    opacity: 1;
}

.custom-modal-icon {
    font-size: 3.25rem;
    color: var(--accent);
    margin-bottom: 1.25rem;
    display: inline-block;
    animation: bounceModalIcon 0.6s ease;
}

.custom-modal-icon.danger {
    color: var(--danger);
}

.custom-modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    font-family: inherit;
}

.custom-modal-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.75rem;
}

.custom-modal-input-wrapper {
    margin-bottom: 1.75rem;
    text-align: left;
}

.custom-modal-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--primary);
    transition: var(--transition);
    background-color: #f8fafc;
}

.custom-modal-input:focus {
    outline: none;
    border-color: var(--accent);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(220, 180, 80, 0.25);
}

.custom-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.custom-modal-btn {
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.custom-modal-btn-confirm {
    background-color: var(--accent);
    color: var(--primary);
}

.custom-modal-btn-confirm:hover {
    background-color: #cda439;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 180, 80, 0.3);
}

.custom-modal-btn-cancel {
    background-color: #f1f5f9;
    color: var(--text-muted);
}

.custom-modal-btn-cancel:hover {
    background-color: #e2e8f0;
    color: var(--primary);
    transform: translateY(-2px);
}

@keyframes bounceModalIcon {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}




