* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #e0e0e0; /* Changed to a slightly darker gray as requested */
    color: #333;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.brands-container {
    max-width: 1200px;
    width: 100%;
    margin: 40px auto;
    padding: 30px;
    border-radius: 20px;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-header-img {
    height: 80px;
    width: auto;
    vertical-align: middle;
}

.header-text {
    font-size: 2.8rem;
    color: #7b037f;
}

.header p {
    font-size: 1.2rem;
    color: #555;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.header::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #7b037f, #d6d6d6);
    margin: 20px auto;
    border-radius: 2px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.control-btn {
    background: #7b037f;
    border: none;
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(123, 3, 127, 0.3);
    gap: 8px;
    text-decoration: none;
}

.control-btn:hover {
    background: #d6d6d6;
    color: #000;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.brand-card {
    background: #f5f5f5;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    position: relative;
    border: 1px solid #eaeaea;
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

.brand-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.brand-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #7b037f, #d6d6d6);
}

/* Contenedor cuadrado para imágenes */
.image-container {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Relación 1:1 para cuadrado perfecto */
    overflow: hidden;
    border-radius: 15px 15px 0 0;
}

.brand-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.brand-card:hover .brand-image {
    transform: scale(1.05);
}

.brand-content {
    padding: 20px;
    text-align: center;
}

.brand-name {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 15px;
}

/* Botones de marca con fondo #7b037f y letras blancas */
.brand-btn {
    display: inline-flex;
    align-items: center;
    background: #7b037f;
    color: white;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 5px 15px rgba(123, 3, 127, 0.3);
}

.brand-btn i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

/* Efecto hover: fondo gris con letras negras */
.brand-btn:hover {
    background: #d6d6d6;
    color: #000;
    transform: scale(1.05);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.15);
}

.brand-btn:hover i {
    transform: translateX(4px);
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.counter {
    text-align: center;
    margin-top: 30px;
    color: #777;
    font-size: 1rem;
}

.footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
    color: #666;
    font-size: 0.9rem;
}

/* Footer logo text styling - specific to the footer */
.footer .logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #7b037f, #d6d6d6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- TOOLTIP STYLES START --- */
.image-tooltip {
    position: absolute;
    bottom: 0; /* Position at the bottom of the image container */
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.75); /* Semi-transparent black background */
    color: white;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
    opacity: 0; /* Initially hidden */
    visibility: hidden; /* Hidden for accessibility and layout */
    transform: translateY(100%); /* Start off-screen below the image */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s; /* Smooth transition */
    display: flex; /* Use flexbox to center content easily */
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Allows clicks to pass through when hidden */
    z-index: 10; /* Ensure it's above the image */
    border-radius: 0 0 15px 15px; /* Match the bottom border-radius of the card */
    min-height: 25%; /* Ensure enough height for the text */
}

.tooltip-text {
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0 5px; /* Add some horizontal padding for text */
}

/* Desktop Hover Effect */
.brand-card:hover .image-tooltip {
    opacity: 1; /* Fade in */
    visibility: visible; /* Make visible */
    transform: translateY(0); /* Slide up into view */
    pointer-events: auto; /* Allow clicks on the tooltip if needed */
}

/* Mobile Active State (triggered by JavaScript) */
.image-tooltip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
/* --- TOOLTIP STYLES END --- */


/* Responsive */
@media (max-width: 768px) {
    .brands-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    .header-text {
        font-size: 2.2rem;
    }
    .logo-header-img {
        height: 70px;
    }
    .brand-name {
        font-size: 1.3rem;
    }
    .image-tooltip { /* Adjust tooltip font size for smaller screens */
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header-text {
        font-size: 1.8rem;
    }
    .logo-header-img {
        height: 60px;
    }
    .brands-grid {
        grid-template-columns: 1fr;
    }

    .control-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .logo-link {
        text-decoration: none;
        display: inline-block;
    }

    .logo-link:hover .logo {
        opacity: 0.8;
    }
}