/* ============================
   HEADER E RICERCA
============================ */
.explore-header {
    text-align: center;
    margin-bottom: 3.5rem;
    padding: 2rem 1rem;
}

.explore-header h1 {
    font-size: 2.8rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.explore-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}


.search-bar {
    display: flex;
    width: 100%; /* Aggiunto: obbliga la barra a non superare lo schermo */
    max-width: 600px;
    margin: 0 auto;
    gap: 0.5rem;
    background-color: var(--surface-color);
    padding: 0.5rem;
    border-radius: 50px;
    border: 1px solid #334155;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    box-sizing: border-box; /* Aggiunto: include il padding nella larghezza totale */
}

.search-bar input {
    flex: 1;
    min-width: 0; /* TRUCCO MAGICO: permette all'input di restringersi su mobile senza sfondare */
    background: transparent;
    border: none;
    padding: 0.8rem 1.5rem;
    color: var(--text-main);
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    box-shadow: none;
}

.search-bar .btn-primary {
    border-radius: 40px;
    padding: 0.8rem 2rem;
    margin-top: 0;
    white-space: nowrap; /* Aggiunto: impedisce al testo "Cerca" di andare a capo e rompere il bottone */
}

/* Regole specifiche per gli schermi piccoli (Mobile) */
@media (max-width: 576px) {
    .search-bar {
        padding: 0.3rem;
    }
    .search-bar input {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    .search-bar .btn-primary {
        padding: 0.6rem 1.2rem;
    }
}


/* ============================
   GRID DEI PROGETTI
============================ */
.projects-grid {
    display: grid;
    /* Adatta automaticamente le colonne. Minimo 320px, massimo 1 frazione */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    align-items: stretch; /* Tutte le card della stessa riga avranno la stessa altezza */
}

/* ============================
   CARD DEL PROGETTO
============================ */
.project-card {
    background-color: var(--surface-color);
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Effetto di luce in alto alla card al passaggio del mouse */
.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary-color), #a855f7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    border-color: #475569;
}

.project-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* Colori difficoltà */
.diff-easy { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.diff-medium { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.diff-hard { background-color: rgba(239, 68, 68, 0.15); color: #f87171; }

.card-body {
    flex: 1; /* Spinge il footer in basso */
}

.card-body h3 {
    font-size: 1.35rem;
    color: var(--text-main);
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.looking-for {
    background-color: rgba(15, 23, 42, 0.5);
    border-left: 3px solid var(--primary-color);
    padding: 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.looking-for strong {
    color: var(--text-main);
}

/* ============================
   CARD FOOTER E AVATAR OVERLAP
============================ */
.card-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-info {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Magia CSS per sovrapporre gli avatar */
.avatar-group {
    display: flex;
    align-items: center;
}

.avatar-overlap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--surface-color); /* Crea il bordo ritagliato */
    object-fit: cover;
    margin-left: -10px; /* Li sposta a sinistra per sovrapporli */
    transition: transform 0.2s;
}

.avatar-overlap:first-child {
    margin-left: 0;
}

.avatar-overlap:hover {
    transform: translateY(-3px);
    z-index: 10;
}

.no-avatar-micro {
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    position: relative; /* Necessario per lo z-index */
}

.more-members {
    background-color: #334155;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    position: relative;
}

.spots-left {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-apply {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    margin-top: 0;
    border-radius: 8px;
}

/* Stati Vuoti */
.empty-state-large {
    grid-column: 1 / -1; /* Occupa tutta la larghezza della griglia */
    text-align: center;
    padding: 5rem 2rem;
    background-color: var(--surface-color);
    border-radius: 16px;
    border: 1px dashed #475569;
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state-large h3 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Trasformiamo il link in un bottone solido */
.btn-apply {
    display: inline-block;
    text-align: center;
    text-decoration: none !important; /* Rimuove la sottolineatura blu */
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    color: white !important; /* Forza il testo bianco */
    padding: 0.7rem 1.4rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-apply:hover {
    background: linear-gradient(135deg, #2563eb, var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4);
    color: white !important;
}

.btn-apply:active {
    transform: translateY(0);
}

/* ============================
   PAGINAZIONE
============================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #334155;
}

.btn-page {
    background-color: var(--surface-color);
    border: 1px solid #475569;
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-page:not(.disabled):hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-page.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.text-main {
    color: var(--text-main);
}