/* Container principale */
.clinical-trials-container { 
    margin: 20px 0; 
    width: 100%;
}

.clinical-trials-container h3 {
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
    margin: 0 0 16px 0;
}

/* TRIAL CARD - ACCORDION */
.trial-card { 
    background: #fff; 
    border: 1px solid #e5e7eb;
    border-radius: 8px; 
    margin-bottom: 12px; 
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.trial-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* HEADER - Sempre visibile e cliccabile */
.trial-header { 
    padding: 12px 14px; 
    color: #fff; 
     cursor: pointer;
    position: relative;
}

.trial-header:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a3f92 100%);
}

/* Header top: badge e link sulla stessa riga */
.trial-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;    width: 95%;
}

/* Colori per status */
.trial-header.recruiting { 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
}

.trial-header.active-not-recruiting,
.trial-header.active_not_recruiting { 
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); 
}

.trial-header.completed { 
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); 
}

/* Badge status */
.trial-status-badge { 
    background: rgba(255,255,255,0.25); 
    padding: 3px 8px; 
    border-radius: 3px; 
    font-size: 9px; 
    font-weight: 700;
    text-transform: uppercase; 
    display: inline-block;
    letter-spacing: 0.5px;
}

/* Titolo */
.trial-title { 
    color: #fff; 
    margin: 8px 0 10px 0; 
    font-size: 14px; 
    font-weight: 600;
    line-height: 1.3;
}

/* Info Grid - label inline */
.trial-essential-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.trial-info-item {
    font-size: 11px;
    color: rgba(255,255,255,0.95);
}

.trial-info-item strong {
    display: inline;
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-right: 4px;
    letter-spacing: 0.3px;
}

/* Link esterno compatto */
.trial-study-link-compact { 
    color: #fff; 
    text-decoration: none;
    font-size: 10px; 
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.trial-study-link-compact:hover {
    background: rgba(255,255,255,0.3);
}

/* Icona espandi */
.trial-expand-icon {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 18px;
    transition: transform 0.3s ease;
    pointer-events: none;
    opacity: 0.8;
}

.trial-card.is-open .trial-expand-icon {
    transform: rotate(180deg);
}

/* CONTENUTO ESPANDIBILE */
.trial-body {
    display: none;
}

.trial-card.is-open .trial-body {
    display: block;
}

/* TABS */
.trial-tabs { 
    display: flex; 
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.trial-tab { 
    padding: 10px 14px; 
    background: none; 
    border: none; 
    border-bottom: 2px solid transparent;
    cursor: pointer; 
    font-weight: 600; 
    font-size: 12px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.trial-tab:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

.trial-tab.is-active { 
    color: #fff; 
        border-bottom-color: #9E9E9E;
    background-color: #9E9E9E;
}

/* CONTENUTO TABS */
.trial-content { 
    padding: 12px; 
    background: #fff;
}

.trial-tab-panel { 
    display: none; 
}

.trial-tab-panel.is-active { 
    display: block;
}

/* AI Rationale */
.ai-rationale-box { 
    background: #fffbeb; 
    border-left: 3px solid #f59e0b; 
    padding: 10px; 
    margin-bottom: 12px; 
    border-radius: 4px;
}

.ai-rationale-box h4 { 
    margin: 0 0 5px 0; 
    color: #92400e; 
    font-size: 13px;
    font-weight: 700;
}

.ai-rationale-box p {
    margin: 0;
    color: #78350f;
    line-height: 1.5;
    font-size: 12px;
}

/* Summary */
.trial-summary {
    color: #374151;
    line-height: 1.5;
    font-size: 12px;
}

/* Criteri */
.criteria-text { 
    white-space: pre-wrap; 
    font-family: 'Monaco', 'Consolas', monospace; 
    font-size: 11px; 
    background: #f3f4f6; 
    padding: 10px; 
    border-radius: 5px; 
    max-height: 300px; 
    overflow-y: auto;
    color: #1f2937;
    line-height: 1.5;
    border: 1px solid #e5e7eb;
}

/* Locations */
.location-item {
    padding: 8px; 
    margin-bottom: 8px; 
    background: #f9fafb; 
    border-left: 3px solid #667eea; 
    border-radius: 4px;
}

.location-item strong {
    color: #1f2937; 
    display: block; 
    margin-bottom: 3px;
    font-size: 12px;
}

.location-item .location-details {
    font-size: 11px; 
    color: #6b7280;
}

.location-status {
    margin-left: 6px; 
    padding: 2px 6px; 
    background: #dbeafe; 
    color: #1e40af; 
    border-radius: 3px; 
    font-size: 9px; 
    font-weight: 600;
}

/* Locations con mappa */
.locations-wrapper {
    display: flex;
    gap: 12px;
}

.locations-list {
    flex: 1;
    max-height: 250px;
    overflow-y: auto;
}

.locations-map {
    flex: 1;
    min-height: 250px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.location-item {
    cursor: pointer;
    transition: background 0.15s;
}

.location-item:hover,
.location-item.active {
    background: #eef2ff;
}

.more-locations {
    margin-top: 8px;
    color: #6b7280;
    font-size: 11px;
    font-style: italic;
}

.no-locations {
    color: #6b7280;
    font-style: italic;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .trial-header {
        padding: 16px;
    }
    
    .trial-title {
        font-size: 15px;
    }
    
    .trial-essential-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .trial-expand-icon {
        right: 16px;
        font-size: 20px;
    }
    
    .trial-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .trial-tab {
        padding: 12px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .trial-content {
        padding: 16px;
    }
    
    .locations-wrapper {
        flex-direction: column;
    }
    
    .locations-list {
        max-height: 180px;
    }
    
    .locations-map {
        min-height: 180px;
    }
}
