﻿/* ---------------- FiBEST V3 BRAND SYSTEM ---------------- */

:root {
    --fibest-white: #FFFFFF;
    --fibest-light-blue: #80BCDE;
    --fibest-brand-blue: #0078BF;
    --fibest-dark-blue: #003C60;
    --fibest-grey-blue: #80A0BF;
    --fibest-text-dark: #000F1B;
    --fibest-bg-subtle: #F5F8FA;
    --font-heading: 'Exo', sans-serif;
    --font-body: 'Spectral', serif;
}

.fibest-virtual-stands-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 2rem 1rem;
    color: var(--fibest-text-dark);
}

/* ---------------- GRID LAYOUTS ---------------- */
.fibest-company-grid {
    display: grid;
    row-gap: 1.25rem; /* Reduced space between rows */
    column-gap: 1.5rem;
    padding: 1rem 0;
    align-items: start;
}

.fibest-grid-participantes, .fibest-grid-all {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
}

.fibest-grid-promotores {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    max-width: 750px; /* Reduced container width to shrink boxes */
    margin: 0 auto;
}

/* ---------------- CARD COMPONENT ---------------- */

.fibest-company-card {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    cursor: default; /* Default for div/link="none" */
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem !important; /* Balanced spacing between box and name label below */
    width: 100%;
    margin-bottom: 1rem;
}

.fibest-company-card:hover {
    transform: translateY(-5px);
}

/* Cursor pointer only for interactive cards (buttons for modals or <a> for pages) */
a.fibest-company-card, 
button.fibest-company-card {
    cursor: pointer;
}

.fibest-card-square-box {
    background: var(--fibest-white);
    border: 1px solid var(--fibest-grey-blue);
    border-radius: 12px; /* Smoother corners */
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden; /* Ensure logo wrapper offsets are strictly respected */
}

.fibest-company-card:hover .fibest-card-square-box {
    border-color: var(--fibest-brand-blue);
    box-shadow: 0 10px 20px rgba(0, 120, 191, 0.12);
}

/* Internal Space (El "Aire" solicitado) */
.fibest-card-logo-wrapper {
    position: absolute !important;
    top: 1rem !important;    /* Reduced space from top */
    left: 1rem !important;   /* Reduced space from left */
    right: 1rem !important;  /* Reduced space from right */
    bottom: 1rem !important; /* Reduced space from bottom */
    display: flex;
    align-items: center;
    justify-content: center;
}

.fibest-card-logo {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    transition: transform 0.4s ease;
}

.fibest-company-card:hover .fibest-card-logo {
    transform: scale(1.1);
}

.fibest-card-name-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--fibest-text-dark);
    line-height: 1.3;
    max-width: 100%;
}

/* Fallback text for box logo */
.fibest-card-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--fibest-dark-blue);
    text-align: center;
}

/* ---------------- MODAL SYSTEM ---------------- */

.fibest-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(0, 15, 27, 0.65);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.fibest-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.fibest-modal-wrapper {
    background: var(--fibest-white);
    width: 92%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.fibest-modal-overlay.is-open .fibest-modal-wrapper {
    transform: scale(1) translateY(0);
}

.fibest-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f0f3f5;
    border: none;
    font-size: 2.2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--fibest-dark-blue);
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.fibest-modal-close:hover {
    background: var(--fibest-brand-blue);
    color: #fff;
    transform: rotate(90deg);
}

.fibest-modal-content {
    overflow-y: auto;
    padding: 0;
    flex: 1;
}

/* Custom Scrollbar */
.fibest-modal-content::-webkit-scrollbar { width: 8px; }
.fibest-modal-content::-webkit-scrollbar-thumb { background: var(--fibest-grey-blue); border-radius: 4px; }

/* Detail View Styles */
.fibest-detail-view {
    display: none;
    padding: 4rem;
}

.fibest-detail-view.is-active {
    display: block;
    animation: fbFadeInUp 0.5s ease both;
}

@keyframes fbFadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fibest-detail-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #f0f3f5;
}

.fibest-detail-logo-wrapper {
    margin-bottom: 1.5rem;
}

.fibest-detail-logo {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    max-height: 120px;
    overflow: hidden;
}

.fibest-detail-logo img {
    max-height: 120px !important; /* Strict limit to prevent overflow */
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.fibest-detail-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--fibest-dark-blue);
    margin: 0 0 0.5rem 0;
}

.fibest-detail-meta {
    font-size: 1rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Profile / Description Boxes */
.fibest-section {
    margin-bottom: 2.5rem;
}

.fibest-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--fibest-dark-blue);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fibest-box {
    background: #f9fbfc;
    padding: 2rem;
    border-radius: 12px;
    border-left: 5px solid var(--fibest-brand-blue);
}

.fibest-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Buttons */
.fibest-btn-primary {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--fibest-brand-blue);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-weight: 700;
    transition: opacity 0.2s;
}

.fibest-btn-primary:hover {
    opacity: 0.9;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .fibest-grid-participantes, .fibest-grid-all {
        grid-template-columns: repeat(2, 1fr) !important;
        column-gap: 1rem;
    }
    .fibest-detail-view { padding: 5rem 1.5rem 2rem; }
    .fibest-detail-title { font-size: 1.8rem; }
    
    /* Make logos even larger on mobile due to smaller card size */
    .fibest-card-logo-wrapper {
        top: 0.5rem !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        bottom: 0.5rem !important;
    }
}
/* ---------------- 404 PAGE ---------------- */
.fibest-404-wrapper {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1rem;
    background-color: var(--fibest-bg-subtle);
}

.fibest-404-content {
    max-width: 600px;
    animation: fbFadeInUp 0.6s ease both;
}

.fibest-404-error-code {
    font-size: 8rem;
    font-weight: 900;
    color: var(--fibest-light-blue);
    line-height: 1;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    opacity: 0.5;
}

.fibest-404-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--fibest-dark-blue);
    margin-bottom: 1.5rem;
}

.fibest-404-text {
    font-size: 1.2rem;
    color: var(--fibest-text-dark);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.fibest-404-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

@media (max-width: 600px) {
    .fibest-404-error-code { font-size: 5rem; }
    .fibest-404-title { font-size: 1.8rem; }
}
