/**
 * BeachBus Affiliate Styles
 *
 * Standalone CSS for affiliate shortcodes.
 * These styles are enqueued only when shortcodes are used.
 *
 * @package BeachBus_Functions
 * @version 2.0.0
 */

/* ==========================================================================
   CSS VARIABLES (fallbacks if not defined in parent)
   ========================================================================== */

.bb-affiliate-container,
.bb-partner-container {
    --bb-primary: #0f172a;
    --bb-primary-hover: #334155;
    --bb-accent: #f97316;
    --bb-accent-hover: #ea580c;
    --bb-success: #16a34a;
    --bb-background: #f8fafc;
    --bb-surface: #ffffff;
    --bb-surface-hover: #f1f5f9;
    --bb-border: #e2e8f0;
    --bb-text: #1e293b;
    --bb-text-secondary: #475569;
    --bb-text-muted: #64748b;
    --bb-text-light: #94a3b8;
    --bb-space-xs: 0.25rem;
    --bb-space-sm: 0.5rem;
    --bb-space-md: 1rem;
    --bb-space-lg: 1.5rem;
    --bb-space-xl: 2rem;
    --bb-radius-sm: 4px;
    --bb-radius-md: 8px;
    --bb-radius-lg: 12px;
    --bb-radius-full: 9999px;
    --bb-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --bb-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07);
    --bb-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08);
    --bb-transition: 0.2s ease;
}

/* ==========================================================================
   AFFILIATE CONTAINER & SEARCH
   ========================================================================== */

.bb-affiliate-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--bb-space-lg) 0;
}

.bb-affiliate-search {
    width: 100%;
    max-width: 500px;
    padding: var(--bb-space-md) var(--bb-space-xl);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius-full);
    background: var(--bb-surface);
    font-size: 1rem;
    color: var(--bb-text);
    transition: all var(--bb-transition);
    margin-bottom: var(--bb-space-xl);
}

.bb-affiliate-search:focus {
    outline: none;
    border-color: var(--bb-accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.bb-affiliate-search::placeholder {
    color: var(--bb-text-light);
}

/* ==========================================================================
   AFFILIATE GRID & CARDS
   ========================================================================== */

.bb-affiliate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--bb-space-lg);
}

.bb-affiliate-card {
    background: var(--bb-surface);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius-lg);
    padding: var(--bb-space-xl);
    text-align: center;
    transition: all var(--bb-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 280px;
    box-shadow: var(--bb-shadow-sm);
}

.bb-affiliate-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--bb-shadow-lg);
    border-color: var(--bb-border);
}

.bb-affiliate-card:focus-within {
    box-shadow: 0 0 0 2px var(--bb-accent), var(--bb-shadow-lg);
}

/* ==========================================================================
   AFFILIATE HEADER
   ========================================================================== */

.bb-affiliate-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bb-affiliate-avatar {
    margin-bottom: var(--bb-space-md);
}

.bb-affiliate-avatar img {
    width: 90px;
    height: 90px;
    border-radius: var(--bb-radius-full);
    object-fit: cover;
    border: 4px solid var(--bb-surface);
    box-shadow: var(--bb-shadow-md);
    background: var(--bb-surface);
}

.bb-affiliate-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--bb-text);
    margin: 0 0 var(--bb-space-xs) 0;
    line-height: 1.3;
}

.bb-affiliate-badge {
    display: inline-block;
    background: #fff7ed;
    color: #c2410c;
    padding: var(--bb-space-xs) var(--bb-space-sm);
    border-radius: var(--bb-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* ==========================================================================
   AFFILIATE ACTIONS
   ========================================================================== */

.bb-affiliate-actions {
    width: 100%;
    margin-top: var(--bb-space-lg);
}

.bb-affiliate-link-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

.bb-affiliate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--bb-space-sm);
    width: 100%;
    padding: var(--bb-space-sm) var(--bb-space-md);
    background: var(--bb-primary);
    color: var(--bb-surface);
    border: none;
    border-radius: var(--bb-radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--bb-transition);
}

.bb-affiliate-btn:hover {
    background: var(--bb-primary-hover);
}

.bb-affiliate-btn:focus-visible {
    outline: 2px solid var(--bb-accent);
    outline-offset: 2px;
}

.bb-affiliate-btn.bb-copied {
    background: var(--bb-success);
}

.bb-affiliate-btn.bb-error {
    background: #dc2626;
}

.bb-affiliate-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.bb-affiliate-no-link {
    color: var(--bb-text-light);
    font-size: 0.875rem;
    margin: var(--bb-space-md) 0 0 0;
}

/* ==========================================================================
   PARTNER VENDOR STYLES
   ========================================================================== */

.bb-partner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--bb-space-lg) 0;
}

.bb-partner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--bb-space-xl);
}

.bb-partner-card {
    background: var(--bb-surface);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius-lg);
    overflow: hidden;
    transition: all var(--bb-transition);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--bb-shadow-sm);
}

.bb-partner-card:hover {
    box-shadow: var(--bb-shadow-lg);
    border-color: var(--bb-border);
    transform: translateY(-2px);
}

/* Partner Banner */
.bb-partner-banner {
    height: 120px;
    background-size: cover;
    background-position: center;
    background-color: var(--bb-background);
    position: relative;
}

.bb-partner-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.1), rgba(15, 23, 42, 0.3));
}

/* Partner Avatar */
.bb-partner-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--bb-radius-full);
    border: 4px solid var(--bb-surface);
    box-shadow: var(--bb-shadow-md);
    overflow: hidden;
    position: absolute;
    top: 80px;
    left: var(--bb-space-lg);
    z-index: 2;
    background: var(--bb-surface);
}

.bb-partner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Partner Body */
.bb-partner-body {
    padding: var(--bb-space-xl);
    padding-top: 50px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.bb-partner-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 var(--bb-space-xs) 0;
    line-height: 1.3;
}

.bb-partner-title a {
    text-decoration: none;
    color: var(--bb-text);
    transition: color var(--bb-transition);
}

.bb-partner-title a:hover {
    color: var(--bb-accent);
}

.bb-partner-label {
    display: inline-block;
    background: #fff7ed;
    color: #c2410c;
    font-size: 0.75rem;
    font-weight: 600;
    padding: var(--bb-space-xs) var(--bb-space-sm);
    border-radius: var(--bb-radius-sm);
    margin-bottom: var(--bb-space-lg);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Partner Actions */
.bb-partner-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--bb-space-sm);
}

.bb-btn-store {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--bb-space-xs);
    padding: var(--bb-space-sm) var(--bb-space-md);
    background: var(--bb-surface);
    color: var(--bb-text);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all var(--bb-transition);
}

.bb-btn-store:hover {
    background: var(--bb-surface-hover);
    border-color: var(--bb-text-light);
}

.bb-btn-store .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.bb-btn-partner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--bb-space-xs);
    padding: var(--bb-space-sm) var(--bb-space-md);
    background: var(--bb-accent);
    color: var(--bb-surface);
    border: none;
    border-radius: var(--bb-radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--bb-transition);
}

.bb-btn-partner:hover {
    background: var(--bb-accent-hover);
}

.bb-btn-partner.bb-copied {
    background: var(--bb-success);
}

.bb-partner-link-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

.bb-partner-no-link {
    color: var(--bb-text-light);
    font-size: 0.875rem;
    text-align: center;
    margin: var(--bb-space-sm) 0 0 0;
}

/* ==========================================================================
   NO RESULTS MESSAGE
   ========================================================================== */

.bb-no-results {
    text-align: center;
    padding: var(--bb-space-xl);
    color: var(--bb-text-muted);
    font-size: 1rem;
    grid-column: 1 / -1;
}

/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 992px) {
    .bb-affiliate-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .bb-partner-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 768px) {
    .bb-affiliate-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--bb-space-md);
    }

    .bb-affiliate-card {
        padding: var(--bb-space-md);
        min-height: auto;
    }

    .bb-affiliate-avatar img {
        width: 60px;
        height: 60px;
    }

    .bb-affiliate-name {
        font-size: 0.9375rem;
    }

    .bb-partner-grid {
        grid-template-columns: 1fr;
    }

    .bb-partner-avatar {
        width: 70px;
        height: 70px;
        top: 85px;
        left: var(--bb-space-md);
    }

    .bb-partner-body {
        padding: var(--bb-space-md);
        padding-top: 45px;
    }
}

@media (max-width: 480px) {
    .bb-affiliate-grid {
        grid-template-columns: 1fr;
    }

    .bb-affiliate-card,
    .bb-partner-card {
        padding: var(--bb-space-md);
    }

    .bb-affiliate-search {
        padding: var(--bb-space-sm) var(--bb-space-md);
        font-size: 0.9375rem;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .bb-affiliate-card,
    .bb-partner-card,
    .bb-affiliate-btn,
    .bb-btn-partner,
    .bb-btn-store,
    .bb-affiliate-search {
        transition: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {

    .bb-affiliate-card,
    .bb-partner-card {
        border-width: 2px;
        border-color: #000;
    }
}