/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --color-primary: #1e3a5f;      /* Azul corporativo oscuro */
    --color-secondary: #2c5282;    /* Azul medio */
    --color-accent: #2d8659;       /* Verde confianza */
    --color-light: #f8f9fa;
    --color-dark: #1a1a1a;
    --color-text: #212529;
    --color-muted: #6c757d;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);
    --radius-card: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: #ffffff;
    overflow-x: hidden;
}

/* =========================================
   2. NAVBAR & HEADER
   ========================================= */
.navbar-custom {
    background-color: var(--color-dark) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    padding: 1rem 0;
}

/* Enlaces del menú claros y legibles */
.navbar-dark .navbar-nav .nav-link {
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #e2e8f0 !important;
    transform: translateY(-1px);
}

/* Logo en el Navbar */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-logo {
    height: 40px;        /* Altura fija para la barra */
    width: auto;         /* El ancho se ajusta automáticamente */
    object-fit: contain; /* Mantiene proporción sin deformar */
    display: block;
    transition: transform 0.3s ease;
}

.navbar-brand:hover .navbar-logo {
    transform: scale(1.05);
}

.navbar-brand-text {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    text-decoration: none;
}

/* =========================================
   3. HERO SECTION
   ========================================= */
header.hero {
    background: linear-gradient(135deg, #f5f7fa 0%, #e2e8f0 100%);
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

header.hero h1 {
    letter-spacing: -0.02em;
    color: var(--color-primary);
    font-weight: 800;
}

header.hero .lead {
    color: var(--color-muted);
    font-size: 1.25rem;
}

/* =========================================
   4. SERVICIOS (TARJETAS CON LOGOS)
   ========================================= */
#servicios {
    padding: 5rem 0;
    background-color: #ffffff;
}

.service-card {
    border: none;
    border-radius: var(--radius-card);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Efecto Hover: Elevación */
.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

/* Contenedor del Logo (Círculo/Recuadro central) */
.logo-container {
    width: 240px;
    min-height: 240px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 20px; /* Bordes redondeados suaves */
    border: 2px solid rgba(30, 58, 95, 0.05);
    transition: var(--transition);
    padding: 15px;
    box-sizing: border-box;
}

.service-card:hover .logo-container {
    transform: scale(1.08);
    border-color: rgba(30, 58, 95, 0.2);
    background: #ffffff;
}

/* ESTILO CLAVE PARA LOGOS PNG/WEBP */
/* Evita que se deformen y respeta el ancho natural */
.service-logo {
    max-width: 100%;       /* No se sale del contenedor */
    width: auto;           /* Ancho automático */
    max-height: 200px;      /* Altura máxima controlada */
    height: auto !important; /* IMPORTANTE: Altura flexible */
    object-fit: contain;   /* Asegura que se vea completo */
    display: block;
    transition: transform 0.3s ease;
}

.service-card:hover .service-logo {
    transform: scale(1.1);
}

.service-card .card-body {
    padding: 0 1.5rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.service-card .card-title {
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.service-card .card-text {
    color: var(--color-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    flex-grow: 1; /* Empuja el botón hacia abajo */
}

.service-btn {
    border-width: 2px;
    font-weight: 600;
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    transition: var(--transition);
}

.service-btn:hover {
    background-color: var(--color-primary);
    color: #fff;
    transform: translateX(5px);
}

/* Barras de color inferior por servicio */
.card-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
}
.bg-abogados { background: linear-gradient(90deg, #1e3a5f, #2c5282); }
.bg-desarrollos { background: linear-gradient(90deg, #2c5282, #3b82f6); }
.bg-psicologia { background: linear-gradient(90deg, #2d8659, #10b981); }

/* =========================================
   5. FORMULARIO DE CONTACTO
   ========================================= */
#contacto {
    background-color: var(--color-light);
    padding: 5rem 0;
}

#contacto .form-control,
#contacto .form-select {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    transition: var(--transition);
    background-color: #ffffff;
}

#contacto .form-control:focus,
#contacto .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
    outline: none;
}

#contacto .btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    padding: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

#contacto .btn-primary:hover {
    background-color: var(--color-secondary);
    transform: translateY(-2px);
}

/* =========================================
   6. FOOTER
   ========================================= */
footer {
    background-color: var(--color-dark);
    color: #adb5bd;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-legal-link {
    transition: color 0.2s;
    font-size: 0.85rem;
}

.footer-legal-link:hover {
    color: #ffffff !important;
}

.footer-admin-link {
    opacity: 0.8;
    border-color: rgba(255,255,255,0.3) !important;
    color: #fff !important;
    transition: var(--transition);
}

.footer-admin-link:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
    color: #fff !important;
    transform: translateY(-2px);
}

/* =========================================
   7. RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    header.hero { padding: 3rem 0; }
    .service-card { margin-bottom: 1rem; }
    .navbar-brand-text { font-size: 1rem; }
    .navbar-logo { height: 32px; }
    
    /* Ajustar logos en móvil */
    .logo-container {
        width: 110px;
        min-height: 110px;
        padding: 12px;
    }
    .service-logo {
        max-height: 85px;
    }
}
/* ===== WATERMARK (LOGO GIGANTE EN HEADER) ===== */
/* El contenedor que envuelve el logo gigante */
/* ===== HERO SECTION: Posición arriba-izquierda ===== */
.hero-section {
    min-height: 50vh;
    padding-top: 1.1rem;   /* ⬆️ Sube el contenido (ajusta entre 2rem y 5rem si quieres más/menos) */
    padding-bottom: 5rem;
    display: flex;
    align-items: flex-start; /* 🔝 Alineación superior */
}

.hero-content {
    text-align: left;      /* ⬅️ Alineación izquierda */
}

/* El watermark se mantiene igual, pero asegúrate de que tenga esto: */
.hero-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    max-width: 700px;
    opacity: 0.15;         /* Ajusta opacidad a tu gusto */
    pointer-events: none;
    z-index: 1;
}
.hero-watermark img { width: 100%; height: auto; display: block; }

/* Responsive: en móvil se centra un poco más para no perder legibilidad */
@media (max-width: 768px) {
    .hero-section {
        padding-top: 2.5rem;
        align-items: center; /* En móvil queda mejor centrado verticalmente */
        text-align: center;
    }
    .hero-content { text-align: center; }
    .hero-watermark { width: 85%; opacity: 0.03; }
}
/* Título siempre en una sola línea */
.hero-title {
    white-space: nowrap !important;
    /* Escalado fluido: mínimo 1.6rem, ideal 3.5vw, máximo 3rem */
    font-size: clamp(1.6rem, 3.5vw, 3rem) !important;
    line-height: 1.2;
    color: var(--color-primary);
}

/* En móviles muy pequeños, reducimos ligeramente para garantizar una línea */
@media (max-width: 576px) {
    .hero-title {
        font-size: clamp(1.3rem, 5vw, 1.8rem) !important;
    }
}
/* Solo el subtítulo baja 150px en escritorio */
.subtitle-col {
    margin-top: 150px;
}

/* En tablet/móvil se resetea para que se apile bien */
@media (max-width: 991px) {
    .subtitle-col {
        margin-top: 1.5rem !important;
        text-align: center !important;
    }
}
@media (max-width: 576px) {
    .hero-watermark img {
        width: 90% !important;
        max-width: 350px;
    }
}
/* ===== SECCIÓN INNOVACIÓN / PROPIEDAD INDUSTRIAL ===== */

/* Tarjeta principal (logo + acceso) */
.innovation-card {
    border-radius: var(--radius-card) !important;
    transition: var(--transition);
}
.innovation-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md) !important;
}

/* Logo OEPM: tamaño controlado y centrado */
.oemp-logo {
    max-width: 180px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: grayscale(20%);
    transition: filter 0.3s ease;
}
.innovation-card:hover .oemp-logo {
    filter: grayscale(0%);
}

/* Items individuales de novedades */
.innovation-item {
    border-radius: 12px !important;
    border: 1px solid rgba(30, 58, 95, 0.08) !important;
    transition: var(--transition);
}
.innovation-item:hover {
    border-color: var(--color-primary) !important;
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm) !important;
}

/* Badge de tipo (Patentes, Marcas, etc.) */
.innovation-item .badge {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Enlaces dentro de contenido dinámico */
.innovation-item a:not(.btn) {
    color: var(--color-secondary) !important;
    text-decoration: none;
    border-bottom: 1px dashed rgba(44, 82, 130, 0.4);
    transition: border-color 0.2s;
}
.innovation-item a:not(.btn):hover {
    border-bottom-color: var(--color-primary);
    color: var(--color-primary) !important;
}

/* Responsive: apilar en móvil */
@media (max-width: 768px) {
    .innovation-card { margin-bottom: 1rem; }
    .oemp-logo { max-width: 140px; }
}
/* Wrapper del logo OEPM: fuerza el centrado y tamaño */
.oemp-logo-wrapper {
    width: 100%;
    max-width: 200px;
    margin: 0 auto 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 2px solid rgba(30, 58, 95, 0.1);
}

/* Fallback si la imagen no carga */
.oemp-fallback {
    font-size: 3rem;
    color: var(--color-primary);
    font-weight: 700;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 8px;
    line-height: 1.2;
}
.oemp-fallback small {
    display: block;
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}
/* Badge de cantidad: "15 Patentes" */
.badge-count {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #fff !important;
    padding: 0.4rem 0.9rem;
    border-radius: 10px;
    font-weight: 600;
    min-width: 75px;
    box-shadow: 0 3px 10px rgba(30, 58, 95, 0.25);
}

.count-number {
    font-size: 1.3rem;
    line-height: 1;
    display: block;
}

.count-label {
    font-size: 0.7rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Hover sutil */
.innovation-item:hover .badge-count {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Responsive: más compacto en móvil */
@media (max-width: 576px) {
    .badge-count {
        padding: 0.3rem 0.7rem;
        min-width: 65px;
    }
    .count-number { font-size: 1.1rem; }
    .count-label { font-size: 0.65rem; }
}
/* Logo OEPM centrado y contenido */
.oemp-logo {
    max-width: 160px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Badge de cantidad en tarjetas */
.badge-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--color-primary);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    line-height: 1;
}

.count-number {
    font-size: 1.4rem;
    font-weight: 700;
}

.count-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    opacity: 0.9;
}

/* Efecto hover en items */
.innovation-item:hover {
    border: 1px solid var(--color-primary) !important;
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .oemp-logo { max-width: 120px; }
    .badge-count { padding: 2px 8px; }
    .count-number { font-size: 1.2rem; }
}
/* ===== SECCIÓN INNOVACIÓN: Estilo "Portfolio DRMCH" ===== */

.innovation-item {
    border: 1px solid rgba(30, 58, 95, 0.1) !important;
    transition: var(--transition);
}

.innovation-item:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary) !important;
    box-shadow: var(--shadow-md) !important;
}

/* Badge DRMCH dentro del item */
.innovation-item .badge {
    background-color: var(--color-primary) !important;
    letter-spacing: 1px;
}

/* Caja de detalles (el fondo gris clarito con la lista) */
.innovation-item .bg-light {
    font-family: monospace; /* Estilo "técnico" */
    font-size: 0.9rem !important;
}

/* Hover para los enlaces dentro de la lista */
.innovation-item a:not(.btn) {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted var(--color-primary);
}
/* =========================================
   📱 MOBILE OPTIMIZATIONS (max-width: 768px)
   ========================================= */

@media (max-width: 768px) {
    
    /* === 1. HERO SECTION: Título más arriba y adaptable === */
    
    .hero-section {
        min-height: auto;
        padding: 2rem 0 3rem !important; /* Reducimos padding superior */
        align-items: flex-start !important;
    }
    
    .hero-title {
        /* Permitir 2 líneas en móvil si es necesario, pero con tamaño más pequeño */
        white-space: normal !important;
        font-size: clamp(1.4rem, 5.5vw, 1.8rem) !important; /* Más pequeño para que quepa */
        line-height: 1.15 !important; /* Más compacto */
        margin-bottom: 1rem !important; /* Menos espacio bajo el título */
    }
    
    /* Subtítulo: resetear margen grande y centrar */
    .subtitle-col {
        margin-top: 1rem !important;
        text-align: center !important;
        width: 100%;
    }
    
    .hero-content {
        text-align: center !important;
        padding-top: 0.5rem;
    }
    
    /* Watermark: MÁS VISIBLE en móvil */
    .hero-watermark {
        opacity: 0.12 !important; /* Antes: 0.03-0.08 → Ahora más visible */
        width: 90% !important;
        max-width: 400px;
        top: 45% !important; /* Un poco más arriba para equilibrar */
    }
    
    /* === 2. SERVICIOS: Logos a pantalla completa === */
    
    .logo-container {
        width: 100% !important;           /* Ocupa todo el ancho disponible */
        max-width: 100% !important;
        min-height: 160px !important;     /* Altura mínima para que no colapse */
        margin: 0 auto 1.5rem !important;
        padding: 20px !important;
        border-radius: 16px !important;
    }
    
    .service-logo {
        max-width: 100% !important;       /* Logo ocupa el 100% del contenedor */
        max-height: 140px !important;     /* Altura máxima controlada */
        width: auto !important;
        height: auto !important;
        object-fit: contain;
    }
    
    /* Tarjeta de servicio: padding ajustado para móvil */
    .service-card .card-body {
        padding: 0 1rem 1.5rem !important;
    }
    
    .service-card .card-title {
        font-size: 1.15rem !important;
    }
    
    .service-card .card-text {
        font-size: 0.95rem !important;
    }
    
    /* === 3. INNOVACIÓN / OEPM: Logo a pantalla completa === */
    
    .oemp-logo {
        max-width: 100% !important;       /* Logo OEPM ocupa todo el ancho */
        width: 100% !important;
        height: auto !important;
        max-height: 120px !important;     /* Altura máxima para no ser exagerado */
        margin: 0 auto !important;
    }
    
    .innovation-card .card-body {
        padding: 1.5rem 1rem !important;
    }
    
    /* Items de innovación: apilado vertical en móvil */
    .innovation-item {
        margin-bottom: 0.5rem;
    }
    
    /* Badge de cantidad: más compacto en móvil */
    .badge-count {
        padding: 3px 8px !important;
        min-width: 60px !important;
    }
    
    .count-number {
        font-size: 1.2rem !important;
    }
    
    .count-label {
        font-size: 0.6rem !important;
    }
    
    /* === 4. NAVBAR: Ajustes menores === */
    
    .navbar-logo {
        height: 32px !important;
    }
    
    .navbar-brand-text {
        font-size: 1rem !important;
        display: none; /* Opcional: ocultar ".ES" en móviles muy pequeños si aprieta */
    }
}

/* 📱 Móvil muy pequeño (max-width: 400px) - Ajustes extra */
@media (max-width: 400px) {
    .hero-title {
        font-size: 1.3rem !important;
        line-height: 1.1 !important;
    }
    
    .logo-container {
        min-height: 140px !important;
        padding: 15px !important;
    }
    
    .service-logo {
        max-height: 120px !important;
    }
    
    .oemp-logo {
        max-height: 100px !important;
    }
    
    .navbar-brand-text {
        display: none !important; /* Ocultar texto para ganar espacio */
    }
}

/* Banner Inferior */
.cookie-banner-wrapper {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1e3a5f;
    color: white;
    padding: 20px 0;
    z-index: 1000;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
    display: none; /* Se activa con JS */
}

/* Modal Overlay */
.cookie-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    backdrop-filter: blur(4px);
}

.cookie-modal-card {
    background: white;
    width: 90%;
    max-width: 450px;
    border-radius: 12px;
    overflow: hidden;
}

.modal-header-custom { padding: 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: #f8fafc; color: #1e3a5f; }
.modal-body-custom { padding: 20px; max-height: 400px; overflow-y: auto; }
.modal-footer-custom { padding: 15px 20px; background: #f8fafc; }

.cookie-option {
    padding: 15px;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff;
}

.btn-close-custom { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #666; }
/* ===== WATERMARK: FIX PARA MÓVIL MUY PEQUEÑO (mchm-gg, mchm-gm) ===== */

/* Para pantallas menores a 576px (móviles estándar) */
@media (max-width: 576px) {
    
    /* Contenedor del watermark: más pequeño y centrado */
    .hero-watermark,
    .hero-section-gg .hero-watermark,
    .hero-section-gm .hero-watermark {
        width: 70% !important;
        max-width: 280px !important;  /* Límite absoluto para móviles */
        opacity: 0.06 !important;     /* Un poco más sutil para no molestar */
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        pointer-events: none;
    }
    
    /* Imagen dentro del watermark: que nunca exceda el contenedor */
    .hero-watermark img,
    .hero-section-gg .hero-watermark img,
    .hero-section-gm .hero-watermark img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        display: block;
        object-fit: contain;
    }
    
    /* Si el hero tiene fondo de imagen (como en mchm-gg), asegurar que el watermark quede detrás */
    .hero-section-gg,
    .hero-section-gm {
        position: relative !important;
    }
    
    .hero-section-gg .hero-watermark,
    .hero-section-gm .hero-watermark {
        z-index: 1 !important;
    }
    
    /* Contenido del hero por encima del watermark */
    .hero-section-gg .container,
    .hero-section-gm .container {
        position: relative !important;
        z-index: 2 !important;
    }
}

/* Para móviles muy pequeños (menos de 380px de ancho) */
@media (max-width: 380px) {
    .hero-watermark,
    .hero-section-gg .hero-watermark,
    .hero-section-gm .hero-watermark {
        width: 60% !important;
        max-width: 220px !important;
        opacity: 0.05 !important;
    }
}
/* 📱 HERO DRMCH.ES: AJUSTES FINALES MÓVIL (Sobreescribe todo lo anterior) */
@media (max-width: 768px) {
    .hero-section {
        min-height: 320px !important;
        padding: 3rem 0 !important;
        align-items: flex-start !important;
    }

    .hero-content {
        text-align: center !important;
        padding-top: 0.5rem;
    }

    .hero-title {
        white-space: normal !important;
        font-size: clamp(1.4rem, 5.5vw, 1.8rem) !important;
        line-height: 1.15 !important;
        margin-top: 0 !important;
        margin-bottom: 1rem !important;
    }

    /* ⬇️ Subtítulo baja 80px en móvil */
    .subtitle-col,
    .hero-content .lead {
        margin-top: 120px !important;
    }

    /* 🖼️ Watermark: más visible, subido 15px, proporcional */
    .hero-watermark {
        width: 85% !important;
        max-width: 300px !important;
        top: calc(50% - 15px) !important; /* 🔝 Sube 15px exactos respecto al centro */
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        opacity: 0.4 !important; /* 👁️ Más visible que antes */
        pointer-events: none;
    }

    .hero-watermark img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain; /* ✅ Se adapta sin recortarse ni deformarse */
        display: block;
    }
}