/**
 * Center Distance — Card list per selezione centro
 * Rimpiazza visivamente il <select> con card ordinate per distanza
 */

/* Container */
#centri-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

/* Loading */
.cd-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 13px;
}

/* Card */
.cd-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #ffffff;
    border: 1.5px solid #e0e4ec;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    gap: 12px;
}

.cd-card:hover {
    border-color: #297A38;
    background: #f8fbf9;
    box-shadow: 0 2px 8px rgba(41, 122, 56, 0.08);
    transform: translateY(-1px);
}

.cd-card--selected {
    border-color: #297A38;
    background: #EAF4EC;
    box-shadow: 0 2px 12px rgba(41, 122, 56, 0.12);
}

.cd-card-body {
    flex: 1;
    min-width: 0;
}

.cd-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #2a3042;
    line-height: 1.3;
}

.cd-card-addr {
    font-size: 12px;
    color: #74788d;
    margin-top: 3px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Distance badge */
.cd-card-dist {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: #297A38;
    background: #EAF4EC;
    padding: 2px 10px;
    border-radius: 20px;
    margin-left: 8px;
    vertical-align: middle;
}

.cd-card--selected .cd-card-dist {
    background: #297A38;
    color: white;
}

/* Check indicator */
.cd-card-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.cd-card--selected .cd-card-check {
    background: #297A38;
    border-color: #297A38;
    color: white;
}

/* Hide native select, keep for form */
.centri-select-wrapper {
    position: relative;
}

.centri-select-wrapper select {
    display: none;
}

/* Info label */
.cd-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 12px;
}

.cd-info-icon {
    font-size: 14px;
}

/* Toggle / collapse */
.cd-toggle-wrapper {
    margin-top: 4px;
}

.cd-toggle-btn {
    width: 100%;
    padding: 12px;
    border: 1.5px dashed #297A38;
    border-radius: 12px;
    background: none;
    color: #297A38;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.cd-toggle-btn:hover {
    background: #EAF4EC;
}

.cd-collapsed-section {
    margin-top: 12px;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Expanded search */
.cd-expanded-search {
    position: relative;
    margin-bottom: 8px;
}

.cd-expanded-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

.cd-expanded-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1.5px solid #e0e4ec;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s;
}

.cd-expanded-search-input:focus {
    border-color: #297A38;
}

/* Group labels */
.cd-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #9aa0b3;
    letter-spacing: 0.05em;
    padding: 10px 0 4px 4px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.cd-top-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .cd-card {
        padding: 12px 14px;
    }

    .cd-card-name {
        font-size: 13px;
    }

    .cd-card-addr {
        font-size: 11px;
    }
}
