:root {
    --primary-blue: #1a73e8;
    --light-blue: #e8f0fe;
    --dark-blue: #0d47a1;
    --white: #ffffff;
    --gray: #f5f5f5;
    --dark-gray: #333333;
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
    --success: #2e7d32;
    --error: #d32f2f;
    --accent-gold: #ffc107;
}

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

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--dark-gray);
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: 80px; 
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--white);
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 10px 0;
    height: 90px;
    display: flex;
    align-items: center;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-diresa {
    height: 60px;
    width: auto;
}

.logo-image {
    height: 60px;
    width: auto;
}

.logo-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--dark-blue);
    line-height: 1.2;
    display: flex;
    flex-direction: column;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav ul li a {
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.9rem;
    cursor: pointer;
}

.nav ul li a:hover {
    color: var(--primary-blue);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown > a::after {
    content: '\f078';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.6rem;
    margin-left: 5px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    border-radius: 8px;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    padding: 10px 0;
    z-index: 1001;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--dark-gray);
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: var(--light-blue);
    color: var(--primary-blue);
}

/* Menú Móvil */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--dark-blue);
    cursor: pointer;
}

/* Buscador */
.search-container {
    display: flex;
    align-items: center;
}

.search-container input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 20px 0 0 20px;
    outline: none;
    font-size: 0.9rem;
    transition: width 0.3s ease;
    width: 0;
    opacity: 0;
    cursor: pointer;
}

.search-container input:focus,
.search-container input:not(:placeholder-shown) {
    width: 180px;
    opacity: 1;
    cursor: text;
}

.search-container button {
    padding: 8px 15px;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

.search-container input:focus + button,
.search-container input:not(:placeholder-shown) + button {
    border-radius: 0 20px 20px 0;
}

/* VISTAS SPA */
.view-section {
    display: none;
    animation: fadeIn 0.5s ease;
    padding-top: 20px;
    min-height: 80vh;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero {
    height: 85vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    color: var(--white);
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.hero-background.active {
    opacity: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0.1), rgba(0,0,0,0.6));
    z-index: 0;
}

.hero-text {
    position: relative;
    z-index: 10;
    padding-right: 10%;
    max-width: 600px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 10px;
    color: #fff;
}

.hero-subtitle {
    font-size: 1.3rem;
    font-weight: 400;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    color: #f0f0f0;
}

.hero-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    gap: 20px;
}

.hero-control-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: var(--transition);
}

.hero-control-btn:hover {
    background: var(--primary-blue);
}

/* Servicios */
.services {
    padding: 80px 0;
    background: var(--white);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--dark-blue);
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--primary-blue);
    border-radius: 2px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    border-bottom: 4px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.service-card:hover {
    transform: translateY(-10px);
    border-bottom-color: var(--primary-blue);
}

.service-card i {
    font-size: 3rem;
    color: var(--primary-blue);
    margin-bottom: 20px;
}

.service-card h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--dark-blue);
}

/* Stats Section */
.trust {
    background: var(--light-blue);
    padding: 60px 0;
}

.trust-content {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    text-align: center;
    gap: 30px;
}

.stat-item h3 {
    font-size: 2.5rem;
    color: var(--primary-blue);
}

/* Nosotros & Equipo */
.about-section {
    padding: 80px 0;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.about-card {
    background: var(--light-blue);
    padding: 30px;
    border-radius: 12px;
}

.about-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-blue);
    margin-bottom: 15px;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.team-member {
    text-align: center;
    padding: 20px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.team-member:hover {
    transform: translateY(-5px);
}

.member-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 4px solid var(--light-blue);
}

.member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cargo {
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Subpáginas */
.page-header {
    background: var(--dark-blue);
    color: white;
    padding: 40px 0;
    margin-bottom: 40px;
    text-align: center;
    border-radius: 0 0 20px 20px;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.doc-card {
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.doc-card:hover {
    border-color: var(--primary-blue);
    background: var(--light-blue);
}

.doc-icon {
    font-size: 2rem;
    color: var(--error);
    margin-bottom: 15px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.gallery-item {
    height: 250px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background-color: #ddd;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

.back-home-btn {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.back-home-btn i {
    margin-right: 5px;
}

/* ESTILOS NUEVOS PARA ORGANIGRAMA */
.organigrama-container {
    text-align: center;
    margin-bottom: 50px;
}
.img-frame {
    box-shadow: var(--shadow);
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 10px;
    background: white;
    display: inline-block;
}
.org-img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ESTILOS NUEVOS PARA RED DE LABORATORIOS */
.network-list-container {
    max-width: 1000px;
    margin: 0 auto;
}
.network-head {
    background: var(--dark-blue);
    color: white;
    padding: 20px;
    text-align: center;
    font-weight: 700;
    font-size: 1.2rem;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}
.red-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.red-card {
    background: var(--white);
    border-left: 5px solid var(--primary-blue);
    box-shadow: var(--shadow);
    padding: 20px;
    border-radius: 5px;
}
.red-card h3 {
    color: var(--dark-blue);
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.red-card ul {
    list-style: none;
    padding-left: 5px;
}
.red-card ul li {
    padding: 5px 0;
    font-size: 0.9rem;
    position: relative;
    padding-left: 20px;
}
.red-card ul li::before {
    content: '•';
    color: var(--primary-blue);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* ESTILOS NUEVOS PARA ESTADÍSTICA */
.stats-dashboard {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 50px;
}
.stats-row {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}
.chart-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    flex: 1;
    min-width: 300px;
}
.chart-card h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--dark-gray);
}
.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}
.summary-data {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    gap: 20px;
}
.s-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.s-item span { color: #666; }
.s-item strong { color: var(--primary-blue); font-size: 1.2rem; }

/* Footer */
.footer {
    background-color: var(--dark-blue);
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
}

/* Botón Flotante */
.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--accent-gold);
    color: var(--dark-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 2000;
    transition: var(--transition);
    animation: pulse 2s infinite;
}

.floating-btn:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* Formulario flotante */
.floating-form {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 300px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    z-index: 1999;
    display: none;
    animation: slideUp 0.3s ease;
}

.floating-form.active {
    display: block;
}

.floating-form input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.btn-submit {
    width: 100%;
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

/* MODAL RESULTADO */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.digital-card-container {
    background: white;
    width: 90%;
    max-width: 800px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.card-header-lg {
    background: linear-gradient(135deg, var(--dark-blue), var(--primary-blue));
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header-lg h2 {
    font-size: 1.5rem;
    margin: 0;
}

.card-body-lg {
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    background-image: radial-gradient(#e8f0fe 1px, transparent 1px);
    background-size: 20px 20px;
}

.card-photo-area {
    text-align: center;
}

.photo-placeholder {
    width: 150px;
    height: 180px;
    background: #eee;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    border: 2px dashed #ccc;
    border-radius: 10px;
}

.qr-code-sim {
    width: 100px;
    height: 100px;
    background: #333;
    margin: 0 auto;
    position: relative;
}

.qr-code-sim::after {
    content: 'QR';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-details-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.detail-group {
    margin-bottom: 10px;
}

.detail-group label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-group .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-gray);
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    display: block;
}

.status-badge {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.status-badge.activo {
    background-color: #e8f5e9;
    color: var(--success);
    border: 2px solid var(--success);
}

.status-badge.inactivo {
    background-color: #ffebee;
    color: var(--error);
    border: 2px solid var(--error);
}

.card-footer-lg {
    padding: 15px;
    background: #f9f9f9;
    text-align: right;
    border-top: 1px solid #eee;
}

.btn-close-lg {
    background: #666;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

/* Simple List Modal */
.list-modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.list-modal-content h3 {
    color: var(--primary-blue);
    border-bottom: 2px solid var(--light-blue);
    padding-bottom: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

.list-modal-content ul li {
    list-style: none;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding-top: 70px; }
    .header { height: 70px; }
    
    .logo-diresa, .logo-image { height: 40px; }
    .logo-title { font-size: 0.7rem; }
    .logo-diresa { display: none; }

    .menu-toggle { display: block; }
    
    .nav {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: white;
        box-shadow: 0 10px 10px rgba(0,0,0,0.1);
        padding: 20px;
        transform: translateY(-150%);
        transition: var(--transition);
        z-index: 999;
    }
    
    .nav.active { transform: translateY(0); }
    
    .nav ul {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .search-container { display: none; }

    .hero-title { font-size: 1.8rem; }
    .hero-text { text-align: center; padding: 0; width: 100%; max-width: 100%; }
    .hero { justify-content: center; }
    .hero-controls { display: none; }
    
    .card-body-lg { grid-template-columns: 1fr; }
    .card-details-area { grid-template-columns: 1fr; }
}