/* ─── Reset & base ─────────────────────────────────────────────────────────── */
.ygri-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;
}

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

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

/* ─── Drop zone ─────────────────────────────────────────────────────────────── */
.ygri-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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ─── Canvas / Cropper area ─────────────────────────────────────────────────── */
.ygri-canvas-wrapper {
    margin: 0 0 20px;
}

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

.ygri-canvas-container.has-image {
    border-style: solid;
    border-color: #e0e0e0;
    background: #111;
    min-height: 420px;
}

#ygri-image {
    display: block;
    max-width: 100%;
    max-height: 65vh;
}

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

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

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

/* ── Cropper.js overrides ── */
.ygri-canvas-container .cropper-view-box {
    outline: 2px solid rgba(255,255,255,.85);
}

.ygri-canvas-container .cropper-line {
    background-color: rgba(255,255,255,.6);
}

.ygri-canvas-container .cropper-point {
    background-color: #fff;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.ygri-canvas-container .cropper-dashed {
    border-color: rgba(255,255,255,.3);
}

/* ─── Ratio panel ───────────────────────────────────────────────────────────── */
.ygri-ratio-panel {
    display: none;
    margin-bottom: 20px;
}

.ygri-ratio-panel.is-visible { display: block; }

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

.ygri-ratio-group {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.ygri-ratio-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 10px;
    background: #f7f7f7;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.ygri-ratio-btn small {
    font-size: 0.7rem;
    font-weight: 400;
    color: #999;
}

.ygri-ratio-btn:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.ygri-ratio-btn.active {
    background: #111;
    border-color: #111;
    color: #fff;
}

.ygri-ratio-btn.active small { color: rgba(255,255,255,.6); }

/* Icone proporzionali nei ratio button */
.ygri-ratio-icon {
    display: block;
    border: 2px solid currentColor;
    border-radius: 2px;
    opacity: .7;
}

.ygri-ratio-icon--square  { width: 16px; height: 16px; }
.ygri-ratio-icon--wide    { width: 22px; height: 13px; }
.ygri-ratio-icon--tall    { width: 10px; height: 18px; }
.ygri-ratio-icon--portrait { width: 13px; height: 16px; }
.ygri-ratio-icon--fb      { width: 22px; height: 12px; }
.ygri-ratio-icon--free    { width: 16px; height: 16px; border-style: dashed; }

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

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

.ygri-zoom-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

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

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

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

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

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

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

.ygri-tool-button {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #444;
}

.ygri-tool-button:hover:not(:disabled) { background: #ebebeb; }

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

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

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

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

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

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

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

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

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

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

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

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

    .ygri-ratio-group { grid-template-columns: repeat(3, 1fr); }

    .ygri-zoom-row { flex-direction: column; align-items: flex-start; }
    .ygri-slider  { width: 100%; }

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

    .ygri-canvas-container.has-image { min-height: 280px; }
}
