/* Custom CSS Variables */
:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    --light-bg: #f8fafc;
    --dark-text: #1f2937;
    --gray-bg: #c2c0c6;
    --pink-color: #ec4899;
}

/* Hero Section Styles */
.hero-pattern {
    background-image: radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(30, 64, 175, 0.1) 0%, transparent 50%);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-title {
    font-size: 3.5rem;
}

/* Card Animations */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.research-card {
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.research-card:hover {
    border-left-color: var(--secondary-color);
    background-color: var(--light-bg);
}

/* Navigation Styles */
.nav-pills .nav-link {
    color: var(--dark-text);
    border-radius: 0;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
}

.nav-pills .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.nav-pills .nav-link:hover::after,
.nav-pills .nav-link.active::after {
    width: 100%;
}

.nav-pills .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-pills .nav-link:hover:not(.active) {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

/* Section Display Control */
.section-hidden {
    display: none;
}

.section-active {
    display: block;
}

/* Statistics Section */
.stats-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

/* Badge Styles */
.group-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.fade-in.show {
    opacity: 1;
    transform: translateY(0);
}

/* Modal Customizations */
.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-header .bg-warning {
    background: var(--warning-color) !important;
    color: var(--dark-text) !important;
}

.modal-header.bg-warning .btn-close {
    filter: none;
}

.modal-header.bg-info {
    background: var(--info-color) !important;
}

/* Custom Alert Styles */
.alert {
    border-radius: 0.5rem;
    border: 1px solid;
}

.alert-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Button Enhancements */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

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

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

/* Form Enhancements */
.form-control:focus,
.form-select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Toast Container */
.toast-container {
    z-index: 1055;
}

/* Custom Color Classes */
.text-purple {
    color: var(--purple-color) !important;
}

.bg-purple {
    background-color: var(--purple-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.icon-bg {
    background-color: var(--gray-bg);
    color: var(--dark-text);
    padding: 10px;
    border-radius: 8px;
    display: inline-block;
}

/* Sticky Navigation Offset */
.sticky-top {
    z-index: 1020;
}

/* Carousel base class */
.carousel {
    margin-bottom: 4rem;
}

/* Since positioning the image, we need to help out the caption */
.carousel-caption {
    bottom: 2rem;
    z-index: 10;
}

/* Declare heights because of positioning of img element */
#groupsCarousel .carousel-item {
    height: 25rem;
}

#groupsCarousel .img {
    height: 25rem;
}

#opcionesCarousel {
    height: 18rem;
}

.carousel-container {
    width: 100%;
    overflow: hidden;
    height: 20rem;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-card {
    flex: 0 0 calc(100% / 3);
    padding: 0 10px;
    box-sizing: border-box;
}

.carousel-card .card {
    height: 100%;
}

#semilleros {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#semilleros .bd-placeholder-img-lg,
#semilleros .featurette-image {
    height: 25rem;
    width: 25rem;
}

#our_groups {
    color: white;
    top: 20% !important;
}

#our_groups h4::before,
#our_groups h2::before {
    content: '';
    position: absolute;
    top: 5%;
    left: -2%;
    width: 30%;
    height: 25%;
    background: linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.25) 0%,
            rgba(0, 0, 0, 0.25) 50%,
            rgba(0, 0, 255, 0) 100%
    );
    z-index: -1;
    border-radius: 4px;
}

.groups-slide h3::before,
.groups-slide h5::before,
.groups-slide p::before {
    content: '';
    position: absolute;
    top: 8%;
    left: -2%;
    width: 104%;
    height: 60%;
    background: linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.10) 0%,
            rgba(255, 255, 255, 0.35) 50%,
            rgba(255, 255, 255, 0.10) 100%
    );
    z-index: -1;
    border-radius: 4px;
}

/* Improved Spacing */
.section-padding {
    padding: 4rem 0;
}

/* Custom Shadows */
.shadow-custom {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-custom-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Control buttons positioning */
.carousel-control-prev,
.carousel-control-next {
    width: 60px;
    height: 60px;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background-color: #e0e7ff;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

.carousel-control-prev {
    left: -5px !important;
}

.carousel-control-next {
    right: -5px !important;
}

/* Focus Styles for Better Accessibility */
.btn:focus,
.nav-link:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Loading Animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading 1.5s infinite;
}

/* Mobile Optimizations */
@media (max-width: 992px) {
    .stats-number {
        font-size: 2rem;
    }

    .hero-title {
        font-size: 2.5rem !important;
    }

    .card-body {
        padding: 1rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .carousel-caption p {
        margin-bottom: 1.25rem;
        font-size: 1.25rem;
        line-height: 1.4;
    }

    #groupsCarousel .bd-placeholder-img-lg,
    #groupsCarousel .featurette-image {
        height: 25rem;
        width: 100%;
        object-fit: cover;
        object-position: center;
    }

    .carousel-card {
        flex: 0 0 100%; /* Show 1 card on mobile */
        box-sizing: border-box;
    }

    .carousel-track {
        width: 100%; /* All cards in mobile */
    }

    #our_groups h4::before,
    #our_groups h2::before {
        top: 5%;
        left: -4%;
        width: 50%;
        height: 25%;
    }

    .groups-slide h3::before,
    .groups-slide h5::before,
    .groups-slide p::before {
        top: 7%;
        height: 65%;
    }
}

@media (max-width: 768px) {
    .stats-number {
        font-size: 2rem;
    }

    .hero-title {
        font-size: 2.5rem !important;
    }

    .card-body {
        padding: 1rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .carousel-caption p {
        margin-bottom: 1.25rem;
        font-size: 1.25rem;
        line-height: 1.4;
    }


    #groupsCarousel .bd-placeholder-img-lg,
    #groupsCarousel .featurette-image {
        height: 25rem;
        width: 100%;
        object-fit: cover;
        object-position: center;
    }

    .carousel-card {
        flex: 0 0 100%; /* Show 1 card on mobile */
        box-sizing: border-box;
    }

    .carousel-track {
        width: 100%; /* All cards in mobile */
    }

    #our_groups h4::before,
    #our_groups h2::before {
        top: 5%;
        left: -4%;
        width: 60%;
        height: 22.5%;
    }

    .groups-slide h3::before,
    .groups-slide h5::before,
    .groups-slide p::before {
        top: 6%;
        height: 70%;
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 2rem !important;
    }

    .stats-number {
        font-size: 1.75rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .carousel-caption p {
        margin-bottom: 1rem;
        font-size: 1rem;
        line-height: 1.4;
    }

    #groupsCarousel {
        height: 25rem;
    }

    #groupsCarousel .bd-placeholder-img-lg,
    #groupsCarousel .featurette-image {
        height: 25rem;
        width: 100%;
        object-fit: cover;
        object-position: center;
    }

    .carousel-card {
        flex: 0 0 100%; /* Show 1 card on mobile */
    }

    .carousel-track {
        width: 100%; /* All cards in mobile */
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 60px !important;
        height: 60px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }

    /* Position adjustments for better visibility */
    .carousel-control-prev {
        left: -5px; /* Slightly extend outside container */
    }

    .carousel-control-next {
        right: -5px; /* Slightly extend outside container */
    }

    #our_groups h4::before,
    #our_groups h2::before {
        top: 5%;
        left: -4%;
        width: 60%;
        height: 22.5%;
    }

    .groups-slide h3::before,
    .groups-slide h5::before,
    .groups-slide p::before {
        top: 6%;
        height: 70%;
    }

    .lead {
        font-size: 1rem;
    }

    .h3 {
        font-size: 0.8rem; !important; /* Smaller text for better readability */
    }
    .h5 {
        font-size: 0.6rem; !important; /* Smaller text for better readability */
    }

    .p {
        font-size: 0.4rem; !important;/* Smaller text for better readability */
    }

    .fa-solid {
        font-size: 0rem; !important; /* Smaller icons for better readability */
    }
}

/* Print Styles */
@media print {
    .sticky-top,
    .btn,
    .modal,
    footer {
        display: none !important;
    }

    .section-hidden {
        display: block !important;
    }

    .card {
        border: 1px solid #dee2e6 !important;
        break-inside: avoid;
    }

    .bg-light {
        background-color: #f8f9fa !important;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .card-hover,
    .fade-in,
    .btn,
    .nav-pills .nav-link::after {
        transition: none;
    }

    .card-hover:hover {
        transform: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .gradient-text {
        background: none;
        -webkit-background-clip: unset;
        -webkit-text-fill-color: unset;
        color: var(--primary-color);
        font-weight: 700;
    }

    .card {
        border: 2px solid var(--dark-text);
    }
}

/* Dark Mode Support (if needed in future) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here for future implementation */
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}