/* ==========================================================================
   Pending Tournament Invitations Cards
   Themed cards for series invitational invitations (qualified, not registered)
   Mirrors open-registration.css structure with .pi-* BEM prefix
   All color surfaces driven by series theme via CSS custom properties
   ========================================================================== */

/* ============================================
   CSS Variables (defaults; overridden per-card
   by inline style from ThemeTokens)
   ============================================ */
.pending-invitations-section {
    --pi-radius: 1rem;
    --pi-radius-sm: 0.5rem;
    --pi-radius-pill: 2rem;

    --pi-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    --pi-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.25);
    --pi-shadow-pill: 0 2px 8px rgba(0, 0, 0, 0.3);

    --pi-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Fallback theme colors (each card overrides via inline style) */
    --pi-primary: #4a90e2;
    --pi-gradient: #357abd;
    --pi-contrast: #ffffff;
    --pi-text: #ffffff;
    --pi-contrast-text: #000000;
    --pi-accent1: #e74c3c;
    --pi-accent2: #f39c12;
    --pi-primary-rgb: 74, 144, 226;
    --pi-gradient-rgb: 53, 122, 189;
    --pi-contrast-rgb: 255, 255, 255;

    /* Glass effect */
    --pi-glass: rgba(0, 0, 0, 0.55);
    --pi-glass-border: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Section Container
   ============================================ */
.pending-invitations-section {
    padding: 1.5rem 0;
}

.pending-invitations-section .section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.pending-invitations-section .section-header h4 {
    font-family: 'Karla', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--theme-text-primary, #1a1a1a);
}

.pending-invitations-section .section-header i {
    color: var(--theme-primary, #00A69C);
    font-size: 1.25rem;
}

/* Dark mode header */
[data-bs-theme="dark"] .pending-invitations-section .section-header h4 {
    color: #ffffff;
}

/* ============================================
   Card Grid
   ============================================ */
.pi-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .pi-grid {
        grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
        gap: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .pi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Card Base — gradient background from series
   ============================================ */
.pi-card {
    position: relative;
    border-radius: var(--pi-radius);
    overflow: hidden;
    box-shadow: var(--pi-shadow);
    transition: var(--pi-transition);
    background: linear-gradient(135deg, var(--pi-primary), var(--pi-gradient));
    display: flex;
    flex-direction: column;
}

.pi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pi-shadow-hover);
}

/* Card-level animated background pattern */
.pi-card > .tiled-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
}

/* ============================================
   Hero Section — Horizontal Layout
   ============================================ */
.pi-hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
}

/* Image wrapper — themed glow ring from series contrast color */
.pi-hero-image-wrap {
    flex-shrink: 0;
    border-radius: var(--pi-radius);
    overflow: hidden;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        0 0 0 3px rgba(var(--pi-contrast-rgb), 0.35);
    line-height: 0;
    align-self: flex-start;
}

.pi-hero-image {
    display: block;
    max-width: 200px;
    height: auto;
    transition: var(--pi-transition);
}

.pi-card:hover .pi-hero-image {
    transform: scale(1.05);
}

/* Info section (right side) */
.pi-hero-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

/* ============================================
   Title Section
   ============================================ */
.pi-title {
    position: relative;
    z-index: 1;
    padding: 0.125rem 1rem 0.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.175rem;
}

.pi-tournament-name {
    font-family: 'Karla', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin: 0;
    line-height: 1.2;
}

.pi-series-name {
    font-family: 'Karla', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    margin: 0;
    opacity: 0.9;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Qualified Badge — dark glass over card gradient
   ============================================ */
.pi-invited-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: 'Karla', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--pi-radius-sm);
    box-shadow: var(--pi-shadow-pill);
}

.pi-invited-badge i {
    color: #ffd700;
}

/* ============================================
   Info Pills (Date, Course, Urgency)
   ============================================ */
.pi-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.4rem;
}

.pi-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: var(--pi-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--pi-glass-border);
    border-radius: var(--pi-radius-pill);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.pi-pill i {
    font-size: 0.7rem;
    opacity: 0.85;
}

/* Urgency pill variants */
.pi-pill--urgent {
    background: rgba(220, 53, 69, 0.85);
    border-color: rgba(220, 53, 69, 0.4);
    font-weight: 600;
}

.pi-pill--soon {
    background: rgba(255, 165, 0, 0.8);
    border-color: rgba(255, 165, 0, 0.4);
    font-weight: 600;
}

.pi-pill--plenty {
    background: rgba(40, 167, 69, 0.7);
    border-color: rgba(40, 167, 69, 0.3);
}

/* ============================================
   Pot Pills (Added Cash / Ace Pot)
   ============================================ */
.pi-pot-pills {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    position: relative;
    z-index: 1;
    padding: 0 1rem;
    margin-bottom: 0.125rem;
}

.pi-pot-pill {
    flex: 1 1 calc(50% - 0.25rem);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: rgba(var(--pi-contrast-rgb), 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(var(--pi-contrast-rgb), 0.2);
    border-radius: var(--pi-radius-sm);
    color: #fff;
    font-family: 'Karla', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
}

.pi-pot-pill i {
    font-size: 0.9rem;
    opacity: 0.9;
}

.pi-pot-pill--cash i {
    color: #4ade80;
}

.pi-pot-pill--ace i {
    color: #ffd700;
}

.pi-pot-label {
    opacity: 0.85;
    font-weight: 500;
}

.pi-pot-amount {
    font-weight: 700;
    color: #fff;
}

/* ============================================
   Action Bar — themed separator
   ============================================ */
.pi-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.75rem;
    background: transparent;
    border-top: 1px solid rgba(var(--pi-contrast-rgb), 0.15);
}

/* Action Buttons */
.pi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-radius: var(--pi-radius-sm);
    font-family: 'Karla', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--pi-transition);
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.pi-btn i {
    font-size: 0.8rem;
}

/* Primary CTA — dark gradient for guaranteed contrast */
.pi-btn--primary {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    flex: 1 1 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pi-btn--primary:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    color: #fff;
    text-decoration: none;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 767px) {
    .pending-invitations-section {
        padding-top: 0.25rem;
    }

    .pi-hero {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .pi-hero-image {
        max-width: 140px;
    }

    .pi-hero-info {
        gap: 0.3rem;
    }

    .pi-pills {
        flex-direction: column;
        gap: 0.3rem;
        max-width: 100%;
    }

    .pi-pill {
        padding: 0.3rem 0.6rem;
        font-size: clamp(0.65rem, 2.5vw, 0.75rem);
        justify-content: center;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .pi-tournament-name {
        font-size: 1.1rem;
    }

    .pi-series-name {
        font-size: 0.8rem;
    }

    .pi-pot-pills {
        flex-direction: column;
        gap: 0.35rem;
    }

    .pi-pot-pill {
        flex: 1 1 100%;
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ============================================
   Dark Mode
   ============================================ */
[data-bs-theme="dark"] .pending-invitations-section .section-header i {
    color: var(--theme-primary, #00A69C);
}
