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

.ygir-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 ────────────────────────────────────────────────────────────────── */
.ygir-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: #111;
}

.ygir-subtitle {
    font-size: 0.95rem;
    color: #666;
    margin: 0 0 28px;
}

/* ─── Drop zone ─────────────────────────────────────────────────────────────── */
.ygir-drop-zone {
    position: relative;
    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;
}

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

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

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

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

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

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

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

.ygir-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;
}

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

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

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

.ygir-feat svg {
    color: #555;
    flex-shrink: 0;
    margin-top: 1px;
}

.ygir-feat div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ygir-feat strong {
    font-size: 0.82rem;
    font-weight: 600;
    color: #111;
}

.ygir-feat span {
    font-size: 0.78rem;
    color: #888;
    line-height: 1.4;
}

/* ─── Messaggi (nascosti di default) ────────────────────────────────────────── */
#ygir-error-message,
#ygir-success-message,
#ygir-loader {
    display: none;
}

.ygir-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;
}

.ygir-error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
}

.ygir-success {
    background: #f0fff4;
    color: #276749;
    border: 1px solid #c6f6d5;
}

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

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

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

/* ─── Canvas ────────────────────────────────────────────────────────────────── */
.ygir-canvas-wrapper {
    margin: 0 0 24px;
}

.ygir-canvas-container {
    width: 100%;
    min-height: 240px;
    border: 1.5px dashed #d0d0d0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    overflow: hidden;
    box-sizing: border-box;
}

.ygir-canvas-container.has-image {
    border-style: solid;
    border-color: #e0e0e0;
    background: #fff;
    padding: 16px;
}

#ygir-canvas {
    max-width: 100%;
    max-height: 560px;
    width: auto;
    height: auto;
    display: none;
    border-radius: 6px;
}

.ygir-canvas-container.has-image #ygir-canvas {
    display: block;
}

.ygir-canvas-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #bbb;
    font-size: 0.875rem;
}

.ygir-canvas-overlay svg { opacity: .6; }

.ygir-canvas-container.has-image .ygir-canvas-overlay {
    display: none;
}

/* ─── Pannello controlli ────────────────────────────────────────────────────── */
.ygir-controls-panel {
    display: none;
    background: #f7f7f7;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.ygir-controls-panel.is-visible { display: block; }

.ygir-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
}

.ygir-control-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

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

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

.ygir-input,
.ygir-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;
}

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

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

/* ─── Slider qualità ────────────────────────────────────────────────────────── */
.ygir-control-row--quality { align-items: center; }

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

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

.ygir-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 ──────────────────────────────────────────────────────────────── */
.ygir-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.ygir-checkbox { display: none; }

.ygir-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;
}

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

.ygir-checkbox:checked + .ygir-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);
}

/* ─── Info panel ────────────────────────────────────────────────────────────── */
.ygir-info-panel {
    display: flex;
    gap: 0;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.ygir-info-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-right: 1px solid #e8e8e8;
}

.ygir-info-item:last-child { border-right: none; }

.ygir-info-item span {
    font-size: 0.75rem;
    color: #999;
}

.ygir-info-item strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111;
}

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

.ygir-secondary-button,
.ygir-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;
}

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

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

.ygir-primary-button {
    background: #111;
    color: #fff;
    border-color: #111;
    flex: 1;
    justify-content: center;
}

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

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

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

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

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

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

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

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.ygir-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) {
    .ygir-content { padding: 24px 20px; }

    .ygir-feature-strip { grid-template-columns: 1fr; }

    .ygir-controls-grid { grid-template-columns: 1fr; }

    .ygir-info-panel { flex-direction: column; }
    .ygir-info-item { border-right: none; border-bottom: 1px solid #e8e8e8; }
    .ygir-info-item:last-child { border-bottom: none; }

    .ygir-control-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .ygir-label { min-width: auto; }

    .ygir-input,
    .ygir-select,
    .ygir-slider { width: 100%; }

    .ygir-toolbar { flex-direction: column; }
    .ygir-toolbar button { width: 100%; justify-content: center; }
}
