/* =============================================================================
   Organization & Fund Panels - Premium Enhancement Layer
   Refined styling for org-directors and course-fund sections
   Built on top of the Luminous Panel system from event-panels.css
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Design Tokens - Section-Specific
   ----------------------------------------------------------------------------- */
:root {
    /* Organization - Emerald palette */
    --org-accent: #10b981;
    --org-accent-light: #34d399;
    --org-accent-glow: rgba(16, 185, 129, 0.15);
    --org-accent-subtle: rgba(16, 185, 129, 0.08);

    /* Course Fund - Lime/Gold palette (growth & prosperity) */
    --fund-accent: #84cc16;
    --fund-accent-light: #a3e635;
    --fund-accent-gold: #eab308;
    --fund-accent-glow: rgba(132, 204, 22, 0.15);
    --fund-accent-subtle: rgba(132, 204, 22, 0.08);

    /* Shared */
    --card-shine: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
}

[data-bs-theme="dark"] {
    --org-accent-glow: rgba(52, 211, 153, 0.2);
    --org-accent-subtle: rgba(52, 211, 153, 0.1);
    --fund-accent-glow: rgba(163, 230, 53, 0.2);
    --fund-accent-subtle: rgba(163, 230, 53, 0.1);
    --card-shine: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        transparent 50%,
        rgba(255, 255, 255, 0.02) 100%
    );
}

/* =============================================================================
   ORGANIZATION & DIRECTORS SECTION
   ============================================================================= */

/* Inline preview thumbnails in collapsed header */
.org-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.org-inline__thumb {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--panel-bg-elevated);
    border: 2px solid var(--panel-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition:
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.org-inline__thumb:hover {
    transform: scale(1.1) translateY(-2px);
    border-color: var(--org-accent);
    box-shadow: 0 4px 12px var(--org-accent-glow);
    z-index: 2;
}

.org-inline__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.org-inline__thumb--small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-left: -8px;
}

.org-inline__thumb--small:first-of-type {
    margin-left: 0.25rem;
}

.org-inline__more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--org-accent-subtle);
    border: 2px solid var(--org-accent);
    color: var(--org-accent);
    font-size: 0.6875rem;
    font-weight: 700;
    margin-left: -8px;
    transition:
        background-color 0.2s ease,
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.org-inline__more:hover {
    background: var(--org-accent);
    color: white;
    transform: scale(1.1);
}

/* Organization cards grid */
.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.org-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card-shine), var(--panel-bg-elevated);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    transition:
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.org-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 24px rgba(16, 185, 129, 0.12),
        0 0 0 1px var(--org-accent);
    border-color: var(--org-accent);
}

[data-bs-theme="dark"] .org-card:hover {
    box-shadow:
        0 8px 24px rgba(52, 211, 153, 0.15),
        0 0 0 1px var(--org-accent-light);
}

.org-logo {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.org-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.org-card:hover .org-logo img {
    transform: scale(1.08);
}

.org-text {
    flex: 1;
    min-width: 0;
}

.org-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--org-accent);
    margin-bottom: 0.25rem;
}

[data-bs-theme="dark"] .org-label {
    color: var(--org-accent-light);
}

.org-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--theme-text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-bs-theme="dark"] .org-name {
    color: var(--theme-text-primary, #f1f5f9);
}

.org-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.org-name a:hover {
    color: var(--org-accent);
}

[data-bs-theme="dark"] .org-name a:hover {
    color: var(--org-accent-light);
}

/* Director list */
.director-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.director-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem 0.625rem 0.625rem;
    background: var(--card-shine), var(--panel-bg-elevated);
    border: 1px solid var(--panel-border);
    border-radius: 100px;
    transition:
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.director-chip:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px var(--org-accent-glow);
    border-color: var(--org-accent);
}

.director-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--org-accent);
    box-shadow: 0 0 0 3px var(--org-accent-subtle);
    flex-shrink: 0;
}

.director-avatar img,
.director-avatar .player-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.director-meta {
    min-width: 0;
}

.director-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--theme-text-primary, #0f172a);
    line-height: 1.3;
}

[data-bs-theme="dark"] .director-name {
    color: var(--theme-text-primary, #f1f5f9);
}

.director-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.director-name a:hover {
    color: var(--org-accent);
}

[data-bs-theme="dark"] .director-name a:hover {
    color: var(--org-accent-light);
}

.director-email {
    font-size: 0.75rem;
    color: var(--theme-text-secondary, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

[data-bs-theme="dark"] .director-email {
    color: var(--theme-text-secondary, #94a3b8);
}

/* =============================================================================
   COURSE IMPROVEMENT FUND SECTION
   ============================================================================= */

/* Header icon styling for course fund */
.stack-card[data-section="course-fund"] .stack-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--fund-accent-subtle);
    border: 2px solid var(--fund-accent);
    padding: 6px;
    box-shadow: 0 0 0 4px var(--fund-accent-subtle);
}

.stack-card[data-section="course-fund"] .stack-card__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Header main layout */
.stack-card__header-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
}

.stack-card__header-main .stack-card__icon {
    flex-shrink: 0;
}

.stack-card__header-main .stack-card__eyebrow,
.stack-card__header-main .stack-card__title,
.stack-card__header-main .stack-card__summary {
    flex-basis: 100%;
}

/* Course fund expanded content */
.course-fund {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 576px) {
    .course-fund {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.course-fund__image {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: var(--fund-accent-subtle);
    border: 2px solid var(--fund-accent);
    padding: 12px;
    box-shadow:
        0 4px 16px var(--fund-accent-glow),
        0 0 0 4px var(--fund-accent-subtle);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.course-fund__image:hover {
    transform: rotate(-5deg) scale(1.05);
}

.course-fund__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 576px) {
    .course-fund__image {
        width: 64px;
        height: 64px;
        padding: 10px;
        margin: 0 auto;
    }
}

.course-fund__content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Fund stat pills */
.course-fund__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.fund-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fund-pill:hover {
    transform: translateY(-2px);
}

.fund-pill--balance {
    background: linear-gradient(135deg, var(--fund-accent-subtle) 0%, rgba(132, 204, 22, 0.15) 100%);
    border: 1px solid var(--fund-accent);
    color: var(--fund-accent);
}

.fund-pill--balance:hover {
    box-shadow: 0 4px 12px var(--fund-accent-glow);
}

[data-bs-theme="dark"] .fund-pill--balance {
    background: linear-gradient(135deg, rgba(163, 230, 53, 0.15) 0%, rgba(163, 230, 53, 0.08) 100%);
    color: var(--fund-accent-light);
}

.fund-pill--goal {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(234, 179, 8, 0.05) 100%);
    border: 1px solid var(--fund-accent-gold);
    color: var(--fund-accent-gold);
}

.fund-pill--goal:hover {
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.2);
}

[data-bs-theme="dark"] .fund-pill--goal {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.15) 0%, rgba(250, 204, 21, 0.08) 100%);
    color: #facc15;
}

/* Progress bar - premium styling */
.course-fund__progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.course-fund__track {
    position: relative;
    height: 12px;
    background: var(--panel-bg-elevated);
    border-radius: 100px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .course-fund__track {
    background: rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.course-fund__bar {
    position: relative;
    height: 100%;
    min-width: 8px;
    background: linear-gradient(
        90deg,
        var(--fund-accent) 0%,
        var(--fund-accent-light) 50%,
        var(--fund-accent-gold) 100%
    );
    border-radius: 100px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 12px var(--fund-accent-glow);
}

/* Animated shine effect on progress bar */
.course-fund__bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(200%);
    }
}

.course-fund__progress-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fund-accent);
}

.course-fund__progress-label::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--fund-accent);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

[data-bs-theme="dark"] .course-fund__progress-label {
    color: var(--fund-accent-light);
}

[data-bs-theme="dark"] .course-fund__progress-label::before {
    background: var(--fund-accent-light);
}

/* Note text */
.course-fund__note {
    font-size: 0.875rem;
    color: var(--theme-text-secondary, #64748b);
    line-height: 1.5;
    padding: 0.75rem 1rem;
    background: var(--fund-accent-subtle);
    border-radius: 8px;
    border-left: 3px solid var(--fund-accent);
}

[data-bs-theme="dark"] .course-fund__note {
    color: var(--theme-text-secondary, #94a3b8);
    background: rgba(163, 230, 53, 0.08);
}

/* Fund request card */
.fund-request {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 12px;
}

[data-bs-theme="dark"] .fund-request {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.12) 0%, rgba(96, 165, 250, 0.06) 100%);
    border-color: rgba(96, 165, 250, 0.3);
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */

@media (max-width: 767px) {
    .org-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .org-card {
        padding: 0.875rem 1rem;
    }

    .org-logo {
        width: 48px;
        height: 48px;
        border-radius: 10px;
    }

    .director-list {
        gap: 0.5rem;
    }

    .director-chip {
        padding: 0.5rem 0.875rem 0.5rem 0.5rem;
        gap: 0.625rem;
    }

    .director-avatar {
        width: 36px;
        height: 36px;
    }

    .director-email {
        max-width: 140px;
    }

    .fund-pill {
        padding: 0.375rem 0.875rem;
        font-size: 0.75rem;
    }

    .course-fund__track {
        height: 10px;
    }
}

/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    .org-inline__thumb,
    .org-inline__more,
    .org-card,
    .director-chip,
    .course-fund__image,
    .fund-pill,
    .course-fund__bar {
        transition: none;
    }

    .course-fund__bar::after {
        animation: none;
    }

    .course-fund__progress-label::before {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .org-card,
    .director-chip,
    .fund-pill {
        border-width: 2px;
    }

    .course-fund__track {
        border-width: 2px;
    }
}
