:root {
    --primary: #818CF8;
    --primary-dark: #4338CA;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --secondary: #10B981;
    --accent: #F472B6;
    --bg-dark: #0F172A;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #F8FAFC;
    --text-muted: #CBD5E1;
    --gradient-hero: linear-gradient(135deg, #6366F1 0%, #A855F7 100%);
    --shadow-card: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --border-glass: 1px solid rgba(255, 255, 255, 0.1);
    --gold: #F59E0B;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: white;
    padding: 1rem 2rem;
    z-index: 10001;
    transition: top 0.3s ease;
    text-decoration: none;
    border-radius: 0 0 12px 12px;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid white;
    outline-offset: -4px;
}

* {
    margin: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

#main-content {
    min-height: 80vh;
}

/* Background Glow Effect */
.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(79, 70, 229, 0.15) 0%, rgba(15, 23, 42, 0) 50%);
    z-index: -1;
    animation: pulseGlow 15s infinite alternate;
}

@keyframes pulseGlow {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

/* Navbar */
.navbar {
    padding: 1.5rem 5%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: var(--border-glass);
    display: flex;
    justify-content: center;
    /* Center logo for directory focus */
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.nav-logo-img {
    height: 40px;
    width: auto;
}

.logo span {
    color: #818CF8;
}

/* Main Layout */
main {
    padding: 8rem 5% 4rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 80vh;
    /* Keeps layout stable while JS loads */
    contain: layout style;
}

/* Hero Section within Main */
.directory-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.directory-hero h1 {
    font-size: 2.4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-bottom: 10px;
}

.directory-hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.btn-hero {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--primary-dark);
    color: #FFFFFF;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 99px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
    margin-bottom: 2rem;
}

.btn-hero:hover {
    transform: translateY(-2px);
    background: var(--primary);
    color: #0F172A;
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.6);
}

.btn-tag-discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 321px;
    height: 56px;
    background: url('descuento.webp') no-repeat center;
    background-size: contain;
    color: white;
    text-decoration: none;
    font-weight: 900;
    font-size: 1.44rem;
    letter-spacing: 2px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    padding-left: 65px;
    position: relative;
    left: -10px;
    /* padding-left added to center relative to the red body, offsetting the triangular nose */
}

.btn-tag-discount:hover {
    transform: scale(1.05) rotate(-2deg);
    filter: brightness(1.1);
}

.coupon-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 auto 2.5rem;
    opacity: 0.9;
    text-align: center;
}

.coupon-code {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid gray;
    font-weight: 700;
    color: white;
    letter-spacing: 1px;
}

.hero-disclaimers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.hero-disclaimers small {
    display: block;
    font-size: 0.825rem;
    color: #ffffff;
    font-weight: 400;
}

/* Filter Bar */
.filter-bar {
    background: rgba(30, 41, 59, 0.5);
    border: var(--border-glass);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-select {
    background: rgba(15, 23, 42, 0.6);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.6rem 2.2rem 0.6rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 180px;
    outline: none;
    transition: border-color 0.3s;
}

.filter-select:focus {
    border-color: var(--primary);
}

/* Search Bar Styles */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    transition: all 0.3s;
}

.filter-input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.2);
}

.search-icon {
    position: absolute;
    left: 1rem;
    font-size: 0.9rem;
    opacity: 0.5;
    pointer-events: none;
}

/* Grid Layout */
.case-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Card Styles */
.case-card {
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: row;
    /* Horizontal Layout */
    align-items: center;
    text-align: left;
    position: relative;
    overflow: hidden;
    height: 100%;
    gap: 1.5rem;
}

.case-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px -5px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(30, 41, 59, 0.9);
}

.card-logo-area {
    width: 70px;
    height: 70px;
    min-width: 70px;
    /* Prevent shrinking */
    background: rgb(255 255 255 / 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0;
    /* Removing bottom margin */
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Specific overrides for elements inside the horizontal card */
.case-card h3 {
    margin-bottom: 0.25rem;
    color: white;
}

.case-card .client-tag {
    margin-bottom: 0;
}

/* Legacy styles helper - can be removed if not used elsewhere, keeping for safety */
.case-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.btn-card {
    display: none;
    /* Using div in script now */
}

/* Detail View Modal / Overlay */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    z-index: 2000;
    padding: 2rem;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.detail-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.detail-container {
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: 24px;
    width: 100%;
    max-width: 800px;
    padding: 3rem;
    margin-top: 2rem;
    /* Initial margin */
    margin-bottom: 2rem;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.detail-overlay.active .detail-container {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: white;
}

.detail-header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: var(--border-glass);
    padding-bottom: 2rem;
}

.detail-header .detail-logo {
    width: 100px;
    height: 100px;
    background: rgb(255 255 255 / 100%);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.detail-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.detail-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 1rem;
}

.detail-meta span strong {
    color: white;
}

.detail-content h3 {
    color: #818CF8;
    margin: 2rem 0 1rem;
    font-size: 1.3rem;
}

.detail-content p {
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.detail-content ul {
    list-style: none;
    margin-bottom: 1.5rem;
}

.detail-content ul li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.detail-content ul li::before {
    content: '✓';
    color: var(--secondary);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Footer */
footer {
    border-top: var(--border-glass);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .case-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .case-grid {
        grid-template-columns: 1fr;
    }

    .directory-hero h1 {
        font-size: 2rem;
    }

    .detail-container {
        padding: 1.5rem;
        margin-top: 1rem;
    }

    .detail-header h2 {
        font-size: 2rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    /* Modal Mobile Adjustments */
    .modal-content {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }

    .modal-header {
        padding-right: 2rem;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .modal-close {
        top: 1rem;
        right: 1rem;
        font-size: 1.75rem;
    }

    .participation-form .form-group {
        margin-bottom: 1.2rem;
    }

    .participation-form input,
    .participation-form textarea {
        padding: 0.7rem 0.9rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem 1rem;
    }

    .modal-header {
        margin-bottom: 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.3rem;
    }

    .btn-hero {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Participation Modal Styles */
.modal-overlay {
    /* Initially hidden */
    display: flex;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

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

.modal-content {
    background: var(--bg-card);
    border: var(--border-glass);
    padding: 2.5rem 2rem;
    border-radius: 20px;
    width: 95%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: white;
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: white;
}

.modal-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.participation-form .form-group {
    margin-bottom: 1.5rem;
}

.participation-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.participation-form input,
.participation-form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
    outline: none;
}

.participation-form input:focus,
.participation-form textarea:focus {
    border-color: var(--primary);
}

.btn-nav,
.btn-participar {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 99px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-left: auto;
    /* Push to right */
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.btn-nav:hover,
.btn-participar:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    color: white;
}

/* Adjust navbar specifically for this button */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Detail Meta Design */
.detail-meta-grid {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

.meta-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 140px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.meta-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-5px);
}

.meta-card .meta-icon {
    font-size: 1.5rem;
}

.meta-card .meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.meta-card .meta-value {
    font-weight: 600;
    font-size: 1rem;
    color: white;
}



/* Breadcrumb / Back Link */
.breadcrumb-nav {
    margin-bottom: 2rem;
    text-align: right;
}

.back-to-directory {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 99px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    z-index: 9002;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
}

.back-to-directory.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.back-to-directory:hover {
    color: white;
    background: rgba(45, 55, 72, 0.8);
    transform: translateY(-2px);
}

.floating-plans-btn {
    position: fixed;
    bottom: 20px;
    right: 80px;
    /* Swapped from left */
    background: var(--primary);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 99px;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9005;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
}

.floating-plans-btn.visible {
    opacity: 1;
    visibility: visible;
}

.floating-plans-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    color: white;
}

@media (max-width: 600px) {
    .breadcrumb-nav {
        margin-bottom: 1rem;
    }

    .back-to-directory {
        left: 15px;
    }

    .back-to-top {
        bottom: 20px;
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .floating-plans-btn {
        right: 65px;
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
    }
}