/* ─── Reset & base ─────────────────────────────────────────────────────────── */
.ygpa-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #111;
    box-sizing: border-box;
}

.ygpa-content {
    background: #fff;
    border-radius: 14px;
    padding: 36px 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.06);
}

/* ─── Titolo ────────────────────────────────────────────────────────────────── */
.ygpa-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: #111;
}

.ygpa-subtitle {
    font-size: 0.95rem;
    color: #666;
    margin: 0 0 28px;
    line-height: 1.5;
}

/* ─── Drop zone ─────────────────────────────────────────────────────────────── */
.ygpa-drop-zone {
    border: 1.5px dashed #d0d0d0;
    border-radius: 12px;
    padding: 36px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: center;
    margin-bottom: 24px;
}

.ygpa-drop-zone:hover,
.ygpa-drop-zone.ygpa-drag-over {
    background: #f9f9f9;
    border-color: #999;
}

.ygpa-drop-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    margin-bottom: 4px;
}

.ygpa-drop-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #222;
    margin: 0;
}

.ygpa-drop-hint {
    font-size: 0.8rem;
    color: #999;
    margin: 0;
}

.ygpa-drop-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 220px;
    margin: 4px 0;
}

.ygpa-drop-divider hr {
    flex: 1;
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 0;
}

.ygpa-drop-divider span {
    font-size: 0.78rem;
    color: #bbb;
}

.ygpa-btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity .15s;
}

.ygpa-btn-upload:hover { opacity: 0.82; }

/* ─── Feature strip ─────────────────────────────────────────────────────────── */
.ygpa-feature-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.ygpa-feat {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f7f7f7;
    border-radius: 10px;
    padding: 12px 14px;
}

.ygpa-feat svg { color: #555; flex-shrink: 0; margin-top: 1px; }
.ygpa-feat div { display: flex; flex-direction: column; gap: 2px; }
.ygpa-feat strong { font-size: 0.82rem; font-weight: 600; color: #111; }
.ygpa-feat span   { font-size: 0.78rem; color: #888; line-height: 1.4; }

/* ─── Messaggi ──────────────────────────────────────────────────────────────── */
#ygpa-error-message,
#ygpa-success-message,
#ygpa-loader { display: none; }

.ygpa-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 0 0 16px;
    font-size: 0.875rem;
    font-weight: 500;
}

.ygpa-error   { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.ygpa-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }

/* ─── Loader ────────────────────────────────────────────────────────────────── */
.ygpa-loader {
    text-align: center;
    padding: 32px;
    color: #888;
    font-size: 0.875rem;
}

.ygpa-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: #111;
    border-radius: 50%;
    animation: ygpa-spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

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

/* ─── Privacy Score panel ───────────────────────────────────────────────────── */
.ygpa-score-panel {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #f7f7f7;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ygpa-score-panel.is-visible { display: flex; }

.ygpa-score-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ygpa-score-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 99px;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    white-space: nowrap;
}

.ygpa-score-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ygpa-score-dot--green  { background: #38a169; }
.ygpa-score-dot--yellow { background: #d69e2e; }
.ygpa-score-dot--red    { background: #e53e3e; }

.ygpa-score-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111;
}

.ygpa-score-desc strong {
    font-size: 0.82rem;
    font-weight: 700;
    color: #111;
    display: block;
    margin-bottom: 2px;
}

.ygpa-score-desc p {
    font-size: 0.82rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.ygpa-score-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ygpa-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 99px;
    border: 1px solid;
}

.ygpa-chip--danger  { background: #fff5f5; color: #c53030; border-color: #feb2b2; }
.ygpa-chip--warning { background: #fffff0; color: #975a16; border-color: #f6e05e; }
.ygpa-chip--ok      { background: #f0fff4; color: #276749; border-color: #9ae6b4; }

/* ─── Preview griglia ───────────────────────────────────────────────────────── */
.ygpa-preview-grid {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.ygpa-preview-grid.is-visible { display: grid; }

.ygpa-group-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #888;
    margin: 0 0 8px;
}

.ygpa-preview-col { display: flex; flex-direction: column; }

.ygpa-img-box {
    flex: 1;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

.ygpa-img-box img,
.ygpa-img-box canvas {
    max-width: 100%;
    max-height: 360px;
    width: auto;
    height: auto;
    display: block;
}

/* ─── Metadata table ────────────────────────────────────────────────────────── */
.ygpa-meta-panel {
    display: none;
    margin-bottom: 20px;
}

.ygpa-meta-panel.is-visible { display: block; }

.ygpa-meta-table-wrap {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
}

.ygpa-meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.ygpa-meta-table th {
    background: #f7f7f7;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #e8e8e8;
}

.ygpa-meta-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    vertical-align: middle;
}

.ygpa-meta-table tr:last-child td { border-bottom: none; }
.ygpa-meta-table tr:hover td     { background: #fafafa; }

.ygpa-meta-table td:first-child { font-weight: 500; color: #111; }
.ygpa-meta-table td:nth-child(2) { color: #666; font-family: monospace; font-size: 0.78rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ygpa-removed {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #276749;
    font-weight: 600;
    font-size: 0.78rem;
}

.ygpa-removed::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38a169;
}

/* ─── Opzioni panel ─────────────────────────────────────────────────────────── */
.ygpa-options-panel {
    display: none;
    background: #f7f7f7;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.ygpa-options-panel.is-visible { display: block; }

.ygpa-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.ygpa-option-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ygpa-control-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ygpa-control-row--quality { align-items: center; }

.ygpa-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    min-width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ygpa-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #111;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}

.ygpa-select:focus {
    outline: none;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0,0,0,.07);
}

.ygpa-select:disabled { opacity: .4; cursor: not-allowed; background: #f0f0f0; }

.ygpa-slider {
    flex: 1;
    accent-color: #111;
    height: 4px;
    cursor: pointer;
}

.ygpa-slider:disabled { opacity: .4; cursor: not-allowed; }

.ygpa-quality-badge {
    font-size: 0.8rem;
    font-weight: 600;
    background: #111;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

/* ─── Checkbox ──────────────────────────────────────────────────────────────── */
.ygpa-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.ygpa-checkbox-label small { font-weight: 400; color: #999; }
.ygpa-checkbox { display: none; }

.ygpa-checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, border-color .12s;
    background: #fff;
}

.ygpa-checkbox:checked + .ygpa-checkbox-custom {
    background: #111;
    border-color: #111;
}

.ygpa-checkbox:checked + .ygpa-checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

/* ─── Toolbar ───────────────────────────────────────────────────────────────── */
.ygpa-toolbar {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ygpa-toolbar-right {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

.ygpa-safe-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 18px;
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 10px;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    color: #166534;
    min-width: 160px;
}

.ygpa-safe-button span {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ygpa-safe-button small {
    font-size: 0.72rem;
    color: #4ade80;
    font-weight: 400;
}

.ygpa-safe-button:hover:not(:disabled) {
    background: #dcfce7;
    border-color: #86efac;
}

.ygpa-secondary-button,
.ygpa-primary-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, opacity .12s;
    border: 1px solid transparent;
    white-space: nowrap;
}

.ygpa-secondary-button {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #444;
}

.ygpa-secondary-button:hover:not(:disabled) { background: #ebebeb; }

.ygpa-primary-button {
    background: #111;
    color: #fff;
    border-color: #111;
}

.ygpa-primary-button:hover:not(:disabled) { opacity: .82; }

.ygpa-safe-button:disabled,
.ygpa-secondary-button:disabled,
.ygpa-primary-button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* ─── Istruzioni ────────────────────────────────────────────────────────────── */
.ygpa-instructions {
    background: #f7f7f7;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 8px;
}

.ygpa-instructions strong {
    font-size: 0.82rem;
    font-weight: 600;
    color: #111;
    display: block;
    margin-bottom: 10px;
}

.ygpa-instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ygpa-instructions li {
    display: flex;
    gap: 10px;
    font-size: 0.82rem;
    color: #666;
}

.ygpa-instructions li span {
    font-weight: 600;
    color: #333;
    min-width: 60px;
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.ygpa-footer {
    text-align: center;
    padding-top: 24px;
    margin-top: 32px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.78rem;
    color: #bbb;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .ygpa-content { padding: 24px 20px; }
    .ygpa-feature-strip { grid-template-columns: 1fr; }
    .ygpa-preview-grid  { grid-template-columns: 1fr; }
    .ygpa-options-grid  { grid-template-columns: 1fr; }
    .ygpa-toolbar       { flex-direction: column; }
    .ygpa-toolbar-right { justify-content: stretch; flex-direction: column; }
    .ygpa-toolbar-right button { width: 100%; justify-content: center; }
    .ygpa-safe-button   { width: 100%; }
    .ygpa-score-panel   { flex-direction: column; align-items: flex-start; }
}
