/* 
 * Servicios Legales - Cards Design
 * Cards rectangulares con modal genérico
 * Responsive design con JavaScript vanilla
 */

/* Container principal */
.servicios-legales-container {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Grid de servicios */
.servicios-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* Columnas de servicios */
.servicios-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Cards de servicios */
.servicio-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 30px 25px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Efecto de brillo en hover */
.servicio-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(0, 255, 204, 0.3), 
        transparent, 
        rgba(31, 121, 113, 0.3), 
        transparent
    );
    background-size: 300% 300%;
    border-radius: 15px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Estados de hover para las cards */
.servicio-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(31, 121, 113, 0.4);
    box-shadow: 
        0 20px 40px rgba(31, 121, 113, 0.2),
        0 10px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.servicio-card:hover::before {
    opacity: 1;
}

/* Icono de la card */
.card-icon {
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.card-icon i {
    font-size: 3rem;
    color: #1f7971;
    text-shadow: 0 2px 8px rgba(31, 121, 113, 0.3);
    transition: all 0.3s ease;
}

.servicio-card:hover .card-icon i {
    transform: scale(1.15);
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(31, 121, 113, 0.5);
}

/* Contenido de la card */
.card-content {
    position: relative;
    z-index: 2;
}

.card-content h4 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.servicio-card:hover .card-content h4 {
    color: #fefefe;
    text-shadow: 0 1px 4px rgba(31, 121, 113, 0.4);
}

/* Overlay de la card */
.card-overlay {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 121, 113, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 15px;
}

.servicio-card:hover .card-overlay {
    opacity: 1;
}

.click-text {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

/* MODAL STYLES */

/* Overlay del modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container del modal */
.modal-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 2px solid rgba(31, 121, 113, 0.4);
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 50px rgba(31, 121, 113, 0.15);
    transform: scale(0.8) translateY(50px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

/* Header del modal */
.modal-header {
    background: linear-gradient(135deg, rgba(31, 121, 113, 0.1) 0%, rgba(31, 121, 113, 0.05) 100%);
    padding: 25px 30px;
    border-bottom: 1px solid rgba(31, 121, 113, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #1f7971;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 4px rgba(31, 121, 113, 0.3);
}

/* Botón cerrar modal */
.modal-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 0, 0, 0.2);
    color: #ff4444;
    transform: scale(1.1);
}

/* Body del modal */
.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-body p {
    color: #ffffff;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
    text-align: justify;
}

/* Efectos de entrada del modal */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .servicios-grid {
        gap: 30px;
    }
    
    .servicios-column {
        gap: 25px;
    }
    
    .servicio-card {
        padding: 25px 20px;
        min-height: 120px;
    }
    
    .card-content h4 {
        font-size: 1.2rem;
    }
}

@media (max-width: 992px) {
    .servicios-legales-container {
        padding: 30px 15px;
    }
    
    .servicios-grid {
        gap: 25px;
    }
    
    .servicio-card {
        padding: 20px 15px;
        min-height: 110px;
    }
    
    .card-icon i {
        font-size: 2.5rem;
    }
    
    .card-content h4 {
        font-size: 1.1rem;
    }
    
    .modal-container {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 20px 25px;
    }
    
    .modal-header h3 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 25px;
    }
}

@media (max-width: 768px) {
    .servicios-legales-container {
        padding: 25px 10px;
    }
    
    .servicios-grid {
        gap: 20px;
    }
    
    .servicios-column {
        gap: 20px;
    }
    
    .servicio-card {
        padding: 18px 12px;
        min-height: 100px;
    }
    
    .card-icon {
        margin-bottom: 15px;
    }
    
    .card-icon i {
        font-size: 2.2rem;
    }
    
    .card-content h4 {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .modal-container {
        width: 95%;
        max-height: 90vh;
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 18px 20px;
    }
    
    .modal-header h3 {
        font-size: 1.3rem;
    }
    
    .modal-close {
        font-size: 1.8rem;
        width: 35px;
        height: 35px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: 70vh;
    }
    
    .modal-body p {
        font-size: 1rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .servicios-legales-container {
        padding: 20px 8px;
    }
    
    .servicios-grid {
        gap: 15px;
    }
    
    .servicios-column {
        gap: 15px;
    }
    
    .servicio-card {
        padding: 15px 10px;
        min-height: 90px;
        border-radius: 12px;
    }
    
    .card-icon {
        margin-bottom: 12px;
    }
    
    .card-icon i {
        font-size: 2rem;
    }
    
    .card-content h4 {
        font-size: 0.95rem;
    }
    
    .click-text {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .modal-container {
        width: 98%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px 18px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-close {
        font-size: 1.6rem;
        width: 32px;
        height: 32px;
    }
    
    .modal-body {
        padding: 18px;
    }
    
    .modal-body p {
        font-size: 0.95rem;
    }
}

/* Animaciones de carga */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.servicio-card {
    animation: cardFadeIn 0.6s ease-out;
}

.servicio-card:nth-child(1) { animation-delay: 0.1s; }
.servicio-card:nth-child(2) { animation-delay: 0.2s; }
.servicio-card:nth-child(3) { animation-delay: 0.3s; }

/* Efectos de partículas de fondo */
.servicios-legales-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(0, 255, 204, 0.1), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(31, 121, 113, 0.1), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(0, 255, 204, 0.1), transparent);
    background-size: 150px 100px;
    animation: particleFloat 15s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particleFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

/* Asegurar que el contenido esté por encima de las partículas */
.servicios-grid {
    position: relative;
    z-index: 1;
}

/* Mejoras de accesibilidad */
.servicio-card:focus {
    outline: 2px solid #00ffcc;
    outline-offset: 3px;
}

.modal-close:focus {
    outline: 2px solid #00ffcc;
    outline-offset: 2px;
}

/* Soporte para modo de alto contraste */
@media (prefers-contrast: high) {
    .servicio-card {
        border: 3px solid #00ffcc;
        background: rgba(0, 0, 0, 0.9);
    }
    
    .modal-container {
        border: 3px solid #00ffcc;
        background: #000000;
    }
    
    .card-content h4,
    .modal-body p {
        color: #ffffff !important;
        text-shadow: none;
    }
}

/* Soporte para movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .servicio-card,
    .modal-container,
    .modal-overlay {
        animation: none !important;
        transition: none !important;
    }
    
    .servicio-card:hover {
        transform: none !important;
    }
    
    .servicio-card::before {
        animation: none !important;
    }
}

/* Scroll personalizado para el modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 204, 0.5);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 204, 0.7);
}

/* ================================================
   ESTILOS PARA CONTENIDO FLEXIBLE DEL MODAL  
   ================================================ */

/* Textos del modal */
.modal-text {
    margin: 0 0 15px 0;
    line-height: 1.6;
    color: #333;
    font-size: 16px;
}

.modal-text:last-child {
    margin-bottom: 0;
}

/* Subtítulos en el modal */
.modal-subtitle {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    margin: 25px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(31, 121, 113, 0.3);
    position: relative;
}

.modal-subtitle:first-child {
    margin-top: 10px;
}

.modal-subtitle::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: linear-gradient(135deg, #1f7971, #2d8a7f);
    border-radius: 1px;
}

/* Listas con viñetas */
.modal-list {
    margin: 15px 0;
    padding-left: 0;
    list-style: none;
}

.modal-list-item {
    position: relative;
    padding: 8px 0 8px 25px;
    margin-bottom: 8px;
    line-height: 1.5;
    color: #444;
    transition: all 0.3s ease;
}

.modal-list-item::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 8px;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #1f7971, #2d8a7f);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.modal-list-item:hover {
    color: #2c3e50;
    padding-left: 30px;
}

.modal-list-item:hover::before {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(31, 121, 113, 0.3);
}

/* Listas numeradas */
.modal-ordered-list {
    margin: 15px 0;
    padding-left: 0;
    list-style: none;
    counter-reset: modal-counter;
}

.modal-ordered-list .modal-list-item {
    counter-increment: modal-counter;
}

.modal-ordered-list .modal-list-item::before {
    content: counter(modal-counter);
    background: linear-gradient(135deg, #3498db, #2980b9);
    font-size: 14px;
}

/* Contenido destacado */
.modal-highlight {
    background: linear-gradient(135deg, rgba(31, 121, 113, 0.1), rgba(31, 121, 113, 0.05));
    border-left: 4px solid #1f7971;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
    position: relative;
    overflow: hidden;
}

.modal-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #1f7971, #2d8a7f, transparent);
}

.modal-highlight p {
    margin: 0;
    color: #2c3e50;
    font-weight: 500;
}

/* Separador */
.modal-separator {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(31, 121, 113, 0.5), transparent);
    margin: 25px 0;
    border-radius: 1px;
}

/* Citas */
.modal-quote {
    margin: 20px 0;
    padding: 20px 25px;
    background: rgba(52, 152, 219, 0.05);
    border-left: 4px solid #3498db;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #2c3e50;
    position: relative;
}

.modal-quote::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 15px;
    font-size: 60px;
    color: rgba(52, 152, 219, 0.2);
    line-height: 1;
}

/* Código */
.modal-code {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    color: #e83e8c;
    display: inline-block;
    margin: 5px 0;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .modal-text {
        font-size: 15px;
        line-height: 1.5;
    }
    
    .modal-subtitle {
        font-size: 18px;
        margin: 20px 0 12px 0;
    }
    
    .modal-list-item {
        padding: 6px 0 6px 22px;
        font-size: 15px;
    }
    
    .modal-list-item::before {
        width: 16px;
        height: 16px;
        font-size: 11px;
        top: 6px;
    }
    
    .modal-highlight {
        padding: 12px 15px;
        margin: 15px 0;
    }
    
    .modal-quote {
        padding: 15px 20px;
        margin: 15px 0;
    }
    
    .modal-quote::before {
        font-size: 40px;
        top: -5px;
        left: 10px;
    }
}

/* Animaciones para el contenido */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-text,
.modal-subtitle,
.modal-list,
.modal-highlight,
.modal-quote {
    animation: fadeInUp 0.5s ease-out;
}
