/**
 * Partner Management CSS
 * Version: 1.0.0
 * Author: blueMARKETING
 */

/* =============================================
   MAIN WRAPPER
   ============================================= */
.partner-listing-wrapper {
    margin: 2rem 0;
    position: relative;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* =============================================
   FILTER BUTTONS
   ============================================= */
.partner-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.partner-filter-btn {
    padding: 1rem 1.5rem;
    background-color: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #333;
    font-family: inherit;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
}

.partner-filter-btn:hover,
.partner-filter-btn:focus {
    background-color: #e0e0e0;
    border-color: #999;
    outline: none;
    transform: translateY(-2px);
}

.partner-filter-btn:focus {
    box-shadow: 0 0 0 3px rgba(46, 163, 242, 0.3);
}

.partner-filter-btn.active {
    background-color: #2ea3f2;
    border-color: #2ea3f2;
    color: white;
}

.partner-filter-btn:active {
    transform: translateY(0);
}

/* =============================================
   GRID LAYOUT
   ============================================= */
.partner-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 2rem;
    width: 100%;
}

.partner-grid.columns-1 {
    grid-template-columns: repeat(1, 1fr);
}
.partner-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}
.partner-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}
.partner-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}
.partner-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}
.partner-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Responsive Grid Breakpoints */
@media (max-width: 1200px) {
    .partner-grid.columns-5,
    .partner-grid.columns-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .partner-grid.columns-4,
    .partner-grid.columns-5,
    .partner-grid.columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .partner-grid.columns-3,
    .partner-grid.columns-4,
    .partner-grid.columns-5,
    .partner-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .partner-filter {
        gap: 1rem;
    }

    .partner-filter-btn {
        padding: 8px 16px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .partner-grid {
        grid-template-columns: 1fr !important;
    }

    .partner-filter-btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }
}

/* =============================================
   PARTNER ITEM
   ============================================= */
.partner-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.partner-item:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
    border-color: var(--secondary);
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
}

.partner-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary-2), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.partner-item:hover::before {
    transform: scaleX(1);
}

/* =============================================
   PARTNER LINK
   ============================================= */
.partner-link,
.partner-link-disabled {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.partner-link {
    cursor: pointer;
}

.partner-link:focus {
    outline: 2px solid var(--primary-2);
    outline-offset: 4px;
    border-radius: 4px;
}

.partner-link-disabled {
    cursor: default;
    opacity: 1;
}

/* =============================================
   PARTNER LOGO
   ============================================= */
.partner-logo-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.partner-logo {
    max-width: 100%;
    height: 5rem;
    max-height: 120px;
    object-fit: contain;
    transition:
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.partner-link:hover .partner-logo {
    opacity: 0.85;
    transform: scale(1.05);
}

/* Logo Loading State */
.partner-logo[loading='lazy'] {
    opacity: 0;
    animation: fadeIn 0.4s ease-in forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Logo Placeholder */
.partner-logo-placeholder {
    width: 120px;
    height: 120px;
    background-color: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #999;
    text-align: center;
    padding: 10px;
    word-break: break-word;
    font-weight: 500;
}

/* =============================================
   PARTNER TITLE
   ============================================= */
.partner-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #333;
    line-height: 1.4;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    word-break: break-word;
    hyphens: auto;
}

.partner-link:hover .partner-title {
    color: #2ea3f2;
}

/* =============================================
   LOADING SPINNER
   ============================================= */
.partner-loading {
    text-align: center;
    padding: 40px 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.partner-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(46, 163, 242, 0.2);
    border-left-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   NO PARTNERS MESSAGE
   ============================================= */
.no-partners {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
    grid-column: 1 / -1;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

/* =============================================
   ANIMATIONS
   ============================================= */
.partner-item {
    animation: slideUp 0.5s ease-out backwards;
}

.partner-item:nth-child(1) {
    animation-delay: 0.05s;
}
.partner-item:nth-child(2) {
    animation-delay: 0.1s;
}
.partner-item:nth-child(3) {
    animation-delay: 0.15s;
}
.partner-item:nth-child(4) {
    animation-delay: 0.2s;
}
.partner-item:nth-child(5) {
    animation-delay: 0.25s;
}
.partner-item:nth-child(6) {
    animation-delay: 0.3s;
}
.partner-item:nth-child(n + 7) {
    animation-delay: 0.35s;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .partner-item:hover {
        transform: none;
    }
}

/* =============================================
   DIVI BUILDER COMPATIBILITY
   ============================================= */
.et_pb_module .partner-listing-wrapper {
    margin: 0;
}

.et_pb_bg_layout_dark .partner-item {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.et_pb_bg_layout_dark .partner-title {
    color: white;
}

.et_pb_bg_layout_dark .partner-filter-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.et_pb_bg_layout_dark .partner-filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.et_pb_bg_layout_dark .partner-filter-btn.active {
    background-color: #2ea3f2;
    border-color: #2ea3f2;
    color: white;
}

/* =============================================
   HIGH DPI / RETINA DISPLAYS
   ============================================= */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .partner-logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
    .partner-filter {
        display: none;
    }

    .partner-item {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }

    .partner-link {
        color: inherit !important;
    }
}
