/**
 * Forest Contributors Plugin Styles
 * Embeddable widget for displaying tree planting contributors
 *
 * Usage: Include this CSS on partner websites along with the JS plugin
 */

/* Container */
.gbt-forest-contributors {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    color: #333;
    box-sizing: border-box;
}

.gbt-forest-contributors *,
.gbt-forest-contributors *::before,
.gbt-forest-contributors *::after {
    box-sizing: border-box;
}

/* Title header */
.gbt-fc-title {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 12px;
    color: white;
}

.gbt-fc-title-text {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gbt-fc-title-text svg {
    width: 28px;
    height: 28px;
}

/* Header with search and filters */
.gbt-fc-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.gbt-fc-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.gbt-fc-search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.gbt-fc-search-input:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.gbt-fc-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.gbt-fc-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gbt-fc-select {
    padding: 10px 32px 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.gbt-fc-select:focus {
    outline: none;
    border-color: #28a745;
}

/* Stats bar */
.gbt-fc-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fff8 0%, #f0f9f0 100%);
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e0f0e0;
}

.gbt-fc-stats-text {
    font-size: 14px;
    color: #555;
}

.gbt-fc-stats-count {
    font-weight: 600;
    color: #28a745;
}

/* Grid layout */
.gbt-fc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Contributor card */
.gbt-fc-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gbt-fc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.gbt-fc-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
}

.gbt-fc-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.gbt-fc-info {
    flex: 1;
    min-width: 0;
}

.gbt-fc-name {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gbt-fc-location {
    font-size: 13px;
    color: #666;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gbt-fc-location-icon {
    color: #999;
}

.gbt-fc-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #888;
}

.gbt-fc-trees {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #28a745;
    font-weight: 500;
}

.gbt-fc-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Table layout (alternative) */
.gbt-fc-table-wrapper {
    overflow-x: auto;
    margin-bottom: 24px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

.gbt-fc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.gbt-fc-table th {
    background: #f8f9fa;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #444;
    border-bottom: 2px solid #e8e8e8;
    white-space: nowrap;
}

.gbt-fc-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.gbt-fc-table tr:last-child td {
    border-bottom: none;
}

.gbt-fc-table tr:hover {
    background: #f8fff8;
}

.gbt-fc-table-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gbt-fc-table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.gbt-fc-table-trees {
    color: #28a745;
    font-weight: 600;
}

/* Pagination */
.gbt-fc-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gbt-fc-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gbt-fc-page-btn:hover:not(:disabled) {
    border-color: #28a745;
    color: #28a745;
}

.gbt-fc-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gbt-fc-page-btn.active {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.gbt-fc-page-ellipsis {
    padding: 0 8px;
    color: #999;
}

/* Loading state */
.gbt-fc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.gbt-fc-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #28a745;
    border-radius: 50%;
    animation: gbt-fc-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* Empty state */
.gbt-fc-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.gbt-fc-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.gbt-fc-empty-text {
    font-size: 16px;
    margin: 0;
}

/* Error state */
.gbt-fc-error {
    text-align: center;
    padding: 40px 20px;
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    color: #c62828;
}

.gbt-fc-error-text {
    margin: 0 0 12px 0;
}

.gbt-fc-retry-btn {
    padding: 8px 20px;
    background: #c62828;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.gbt-fc-retry-btn:hover {
    background: #b71c1c;
}

/* Footer branding */
.gbt-fc-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    margin-top: 8px;
}

.gbt-fc-branding {
    font-size: 12px;
    color: #999;
    text-decoration: none;
    transition: color 0.2s;
}

.gbt-fc-branding:hover {
    color: #28a745;
}

.gbt-fc-branding-logo {
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Responsive */
@media (max-width: 640px) {
    .gbt-fc-header {
        flex-direction: column;
    }

    .gbt-fc-search {
        width: 100%;
    }

    .gbt-fc-filters {
        width: 100%;
        justify-content: space-between;
    }

    .gbt-fc-select {
        flex: 1;
    }

    .gbt-fc-grid {
        grid-template-columns: 1fr;
    }

    .gbt-fc-stats {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .gbt-fc-card {
        padding: 14px;
    }

    .gbt-fc-avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
}

/* Dark mode support (optional - triggered by parent class) */
.gbt-dark .gbt-forest-contributors {
    color: #e0e0e0;
}

.gbt-dark .gbt-fc-title {
    background: linear-gradient(135deg, #1a5a2e 0%, #156b52 100%);
}

.gbt-dark .gbt-fc-card {
    background: #2d2d2d;
    border-color: #404040;
}

.gbt-dark .gbt-fc-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gbt-dark .gbt-fc-name {
    color: #fff;
}

.gbt-dark .gbt-fc-search-input,
.gbt-dark .gbt-fc-select {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

.gbt-dark .gbt-fc-stats {
    background: linear-gradient(135deg, #1a2f1a 0%, #1f3d1f 100%);
    border-color: #2d4a2d;
}

.gbt-dark .gbt-fc-table th {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #404040;
}

.gbt-dark .gbt-fc-table td {
    border-color: #333;
}

.gbt-dark .gbt-fc-table tr:hover {
    background: #1a2f1a;
}

.gbt-dark .gbt-fc-page-btn {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}
