/**
 * Webisport Dashboard - Projects Section Styles
 *
 * Project-specific styles only.
 * Shared components (tables, badges, detail-layout, etc.) are in components.css
 */

/* ================================================
   Project Thumbnail (Table View)
   ================================================ */

.webisport-dashboard .webisport-project-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--ws-radius-sm);
    overflow: hidden;
    background: var(--ws-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.webisport-dashboard .webisport-project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.webisport-dashboard .webisport-project-thumb .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--ws-text-muted);
}

/* Clickable title in table */
.webisport-dashboard .webisport-project-title-link {
    color: var(--ws-primary-ink);
    cursor: pointer;
    transition: color var(--ws-transition);
}

.webisport-dashboard .webisport-project-title-link:hover {
    color: var(--ws-primary-dark, #5a3d8a);
    text-decoration: underline;
}

/* Progress bar base styles live in components.css — project-specific overrides below. */

/* ================================================
   Projects Grid (Card View)
   ================================================ */

.webisport-dashboard .webisport-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--ws-space-5);
    padding: var(--ws-space-2) 0;
}

/* ================================================
   Project Card
   ================================================ */

.webisport-dashboard .webisport-project-card {
    background: var(--ws-white);
    border: none;
    border-radius: var(--ws-radius);
    overflow: hidden;
    box-shadow: var(--ws-shadow);
    transition: all var(--ws-transition);
    display: flex;
    flex-direction: column;
}

.webisport-dashboard .webisport-project-card:hover {
    box-shadow: var(--ws-shadow-md);
    transform: translateY(-2px);
}

/* Card Image */
.webisport-dashboard .webisport-project-card-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--ws-bg-light);
}

.webisport-dashboard .webisport-project-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.webisport-dashboard .webisport-project-card:hover .webisport-project-card-image img {
    transform: scale(1.03);
}

.webisport-dashboard .webisport-project-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webisport-dashboard .webisport-project-card-placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: var(--ws-text-light, #ccc);
}

/* Status badge overlay on card image */
.webisport-dashboard .webisport-project-card-overlay-badge {
    position: absolute;
    top: var(--ws-space-3);
    right: var(--ws-space-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Card Body */
.webisport-dashboard .webisport-project-card-body {
    padding: var(--ws-space-4) var(--ws-space-5);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-3);
}

.webisport-dashboard .webisport-project-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ws-text);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Progress */
.webisport-dashboard .webisport-project-card-progress {
    margin: 0;
}

/* Card Meta */
.webisport-dashboard .webisport-project-card-meta {
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-1);
}

.webisport-dashboard .webisport-project-meta-item {
    display: flex;
    align-items: center;
    gap: var(--ws-space-2);
    font-size: 12px;
    color: var(--ws-text-muted);
}

.webisport-dashboard .webisport-project-meta-item .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Card Actions */
.webisport-dashboard .webisport-project-card-actions {
    padding: var(--ws-space-3) var(--ws-space-5);
    border-top: 1px solid var(--ws-border-light);
    display: flex;
    justify-content: flex-end;
}

/* ================================================
   Muted helper text
   ================================================ */

.webisport-dashboard .webisport-text-muted {
    color: var(--ws-text-muted);
}

/* ================================================
   Responsive
   ================================================ */

@media (max-width: 768px) {
    .webisport-dashboard .webisport-projects-grid {
        grid-template-columns: 1fr;
    }

    .webisport-dashboard .webisport-project-card-image {
        height: 140px;
    }
}

/* ================================================
   Project Detail — Rich Content
   ================================================ */

.webisport-dashboard .webisport-project-rich-content {
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-5);
}

.webisport-dashboard .webisport-rich-content-block {
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-4);
}

.webisport-dashboard .webisport-rich-content-block+.webisport-rich-content-block {
    padding-top: var(--ws-space-5);
    border-top: 1px solid var(--ws-border-light);
}

.webisport-dashboard .webisport-rich-content-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ws-text);
}

.webisport-dashboard .webisport-rich-content-text p {
    margin: 0 0 0.5em;
}

.webisport-dashboard .webisport-rich-content-text p:last-child {
    margin-bottom: 0;
}

/* Rich content photo gallery */
.webisport-dashboard .webisport-rich-content-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--ws-space-3);
}

.webisport-dashboard .webisport-rich-content-photo {
    border-radius: var(--ws-radius-sm);
    overflow: hidden;
    background: var(--ws-bg-light);
}

.webisport-dashboard .webisport-rich-content-photo img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.webisport-dashboard .webisport-rich-content-legend {
    display: block;
    padding: var(--ws-space-2) var(--ws-space-3);
    font-size: 12px;
    color: var(--ws-text-muted);
    text-align: center;
}

/* Rich content YouTube embed */
.webisport-dashboard .webisport-rich-content-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--ws-radius-sm);
}

.webisport-dashboard .webisport-rich-content-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Cover image card in general tab */
.webisport-dashboard .webisport-project-image-card img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-radius: var(--ws-radius);
}

/* Result image */
.webisport-dashboard .webisport-project-result-image {
    margin-bottom: var(--ws-space-4);
}

.webisport-dashboard .webisport-project-result-image img {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: var(--ws-radius-sm);
}

/* ================================================
   Project Detail — Sidebar Progress
   ================================================ */

.webisport-dashboard .webisport-project-sidebar-progress {
    padding: var(--ws-space-4) var(--ws-space-5);
}

.webisport-dashboard .webisport-project-sidebar-progress .webisport-progress-bar {
    height: 10px;
    margin-bottom: var(--ws-space-2);
}

/* ================================================
   Project Detail — Tab Header
   ================================================ */

.webisport-dashboard .webisport-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--ws-space-4);
    gap: var(--ws-space-3);
}

.webisport-dashboard .webisport-tab-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ws-text);
}

.webisport-dashboard .webisport-tab-header-actions {
    display: flex;
    align-items: center;
    gap: var(--ws-space-2);
}

/* ================================================
   Project Detail — User Cell (Benevoles)
   ================================================ */

.webisport-dashboard .webisport-user-cell {
    display: flex;
    align-items: center;
    gap: var(--ws-space-3);
}

.webisport-dashboard .webisport-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.webisport-dashboard .webisport-user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ws-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.webisport-dashboard .webisport-user-avatar-placeholder .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: var(--ws-text-muted);
}

/* Checkbox column */
.webisport-dashboard .webisport-th-checkbox,
.webisport-dashboard .webisport-td-checkbox {
    width: 40px;
    text-align: center;
}

/* ================================================
   Project Detail — Donations Summary
   ================================================ */

.webisport-dashboard .webisport-donation-summary {
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-5);
}

.webisport-dashboard .webisport-donation-progress {
    padding: var(--ws-space-2) 0;
}

.webisport-dashboard .webisport-progress-lg {
    height: 14px;
    border-radius: 7px;
}

.webisport-dashboard .webisport-progress-lg .webisport-progress-fill {
    border-radius: 7px;
}

.webisport-dashboard .webisport-donation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--ws-space-4);
}

.webisport-dashboard .webisport-donation-stat-item {
    display: flex;
    align-items: center;
    gap: var(--ws-space-3);
    padding: var(--ws-space-3);
    background: var(--ws-bg-light);
    border-radius: var(--ws-radius-sm);
}

.webisport-dashboard .webisport-donation-stat-item .dashicons,
.webisport-dashboard .webisport-donation-stat-item .ti {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--ws-primary-ink);
}

.webisport-dashboard .webisport-donation-stat-item div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.webisport-dashboard .webisport-donation-stat-item strong {
    font-size: 15px;
    color: var(--ws-text);
}

.webisport-dashboard .webisport-donation-stat-item small {
    font-size: 11px;
    color: var(--ws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ================================================
   Responsive — Detail Page
   ================================================ */

@media (max-width: 768px) {
    .webisport-dashboard .webisport-rich-content-gallery {
        grid-template-columns: 1fr;
    }

    .webisport-dashboard .webisport-donation-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .webisport-dashboard .webisport-tab-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ================================================
   Image Picker
   ================================================ */

.webisport-image-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.webisport-image-picker-preview {
    position: relative;
    width: 100%;
    max-width: 200px;
    border-radius: var(--ws-radius-sm);
    overflow: hidden;
    border: 1px solid var(--ws-border);
}

.webisport-image-picker-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.webisport-image-picker-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webisport-image-picker-remove:hover {
    background: rgba(220, 53, 69, 0.9);
}

/* ================================================
   Rich Blocks Editor
   ================================================ */

.webisport-rich-blocks-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.webisport-rich-blocks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.webisport-rich-block {
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius-sm);
    padding: 0.75rem;
    background: var(--ws-bg-light, #fafafa);
}

.webisport-rich-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.webisport-rich-block-drag {
    cursor: grab;
    color: var(--ws-text-muted);
}

.webisport-rich-block .webisport-form-group {
    margin-bottom: 0.5rem;
}

.webisport-rich-block .webisport-form-group:last-child {
    margin-bottom: 0;
}

.webisport-rich-block-photos {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.webisport-rich-block-photo {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.webisport-rich-block-photo .webisport-rich-block-photo-legend {
    flex: 1;
}

.webisport-dashboard .webisport-project-editor-template {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    pointer-events: none !important;
}

.webisport-dashboard .webisport-rich-block .webisport-tagged-posts-rich-editor-wrapper {
    background: #fff;
}

/* ================================================
   Create / edit modal — multi-section scroll
   ================================================ */

.webisport-dashboard #webisport-project-edit-modal .webisport-modal-content.webisport-modal-large {
    max-width: min(52rem, calc(100vw - 2rem));
    width: 100%;
}

.webisport-dashboard #webisport-project-edit-modal .project-edit-modal-body {
    max-height: min(75vh, 44rem);
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.webisport-dashboard #webisport-project-edit-modal .memberships-pr-rule-form {
    max-width: 46rem;
    margin: 0 auto;
}

.webisport-dashboard #webisport-project-edit-modal .webisport-textarea {
    min-height: 6rem;
    resize: vertical;
}

.webisport-dashboard #webisport-project-edit-modal .webisport-image-picker-btn,
.webisport-dashboard #webisport-project-edit-modal .webisport-rich-blocks-add {
    width: auto;
    padding: 0.4812rem 1.25rem;
}

.webisport-dashboard .webisport-project-tab-hint {
    margin: 0 0 var(--ws-space-3);
}

/* Benevoles table checkboxes — beat input { width:100% } */
.webisport-dashboard .webisport-benevoles-table .webisport-th-checkbox input[type="checkbox"],
.webisport-dashboard .webisport-benevoles-table .webisport-td-checkbox input[type="checkbox"],
.webisport-dashboard .webisport-select-all-benevoles,
.webisport-dashboard .webisport-benevole-checkbox {
    appearance: auto;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    display: inline-block;
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    max-width: 1rem !important;
    max-height: 1rem !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    accent-color: var(--ws-primary);
    cursor: pointer;
    vertical-align: middle;
}

/* Search modals */
.webisport-dashboard .project-search-modal-body .pr-field-hint {
    margin: 0 0 var(--ws-space-3);
}

.webisport-dashboard .project-search-modal-body .webisport-search-results .webisport-btn {
    width: auto;
    flex-shrink: 0;
    padding: 0.4812rem 1.25rem;
}

/* ================================================
   Search Modal — Results List
   ================================================ */

.webisport-search-results {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius-sm);
    margin-top: 0.5rem;
}

.webisport-search-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: var(--ws-text-muted);
    text-align: center;
}

.webisport-search-placeholder .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.webisport-search-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

.webisport-search-results-list {
    display: flex;
    flex-direction: column;
}

.webisport-search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--ws-border);
    gap: 0.75rem;
    transition: background var(--ws-transition);
}

.webisport-search-result-item:last-child {
    border-bottom: none;
}

.webisport-search-result-item:hover {
    background: var(--ws-bg-light, #f8f7fa);
}

.webisport-search-result-item.webisport-already-linked {
    opacity: 0.55;
    background: var(--ws-bg-light, #f8f7fa);
}

.webisport-search-result-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.webisport-search-result-info strong {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.webisport-search-result-meta {
    font-size: 0.8rem;
    color: var(--ws-text-muted);
}

/* User-style result row (avatar + name) */
.webisport-search-result-user {
    flex-wrap: nowrap;
}

.webisport-search-result-user>div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.webisport-search-result-user .webisport-user-avatar,
.webisport-search-result-user .webisport-user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.webisport-search-result-user .webisport-user-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ws-bg-light);
}

/* Small badge variant used in search results */
.webisport-badge-small {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
}

/* ================================================
   Donations Tab
   ================================================ */

.webisport-dashboard .webisport-donation-summary {
    display: flex;
    flex-direction: column;
    gap: var(--ws-space-5);
}

.webisport-dashboard .webisport-donation-progress {
    max-width: 600px;
}

.webisport-dashboard .webisport-donation-progress .webisport-progress-bar {
    height: 14px;
    border-radius: 7px;
}

.webisport-dashboard .webisport-donation-progress .webisport-progress-fill {
    border-radius: 7px;
}

.webisport-dashboard .webisport-donation-progress .webisport-progress-text {
    font-size: 13px;
    margin-top: 8px;
}

.webisport-dashboard .webisport-donation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--ws-space-4);
}

.webisport-dashboard .webisport-donation-stat-item {
    display: flex;
    align-items: center;
    gap: var(--ws-space-3);
    padding: var(--ws-space-4);
    background: var(--ws-bg-light);
    border-radius: var(--ws-radius);
}

.webisport-dashboard .webisport-donation-stat-item .dashicons,
.webisport-dashboard .webisport-donation-stat-item .ti {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: var(--ws-primary-ink);
    flex-shrink: 0;
}

.webisport-dashboard .webisport-donation-stat-item div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.webisport-dashboard .webisport-donation-stat-item strong {
    font-size: 16px;
    color: var(--ws-text);
    line-height: 1.2;
}

.webisport-dashboard .webisport-donation-stat-item small {
    font-size: 11px;
    color: var(--ws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

@media (max-width: 768px) {
    .webisport-dashboard .webisport-donation-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}
