/* =============================================================
   WC Photo Upload — Frontend Styles
   ============================================================= */

/* ── Wrapper principal ────────────────────────────────────────── */
.wc-photo-upload-wrapper {
    margin: 24px 0;
    padding: 20px 24px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fdfdfd;
    font-size: 14px;
}

/* ── Cabeçalho ────────────────────────────────────────────────── */
.wpu-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.wpu-icon {
    font-size: 24px;
    line-height: 1;
    color: #555;
}

.wpu-title {
    margin: 0 0 4px !important;
    padding: 0 !important;
    font-size: 16px !important;
    font-weight: 600;
}

.wpu-subtitle {
    margin: 0;
    color: #666;
    font-size: 13px;
}

/* ── Zona de upload ───────────────────────────────────────────── */
.wpu-upload-zone {
    border: 2px dashed #c0c0c0;
    border-radius: 8px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fff;
    position: relative; /* necessário para posicionar o input */
}

.wpu-upload-zone:hover,
.wpu-upload-zone.wpu-drag-over {
    border-color: #0073aa;
    background: #f0f6fb;
}

/* Input invisível mas clicável — cobre toda a zona para mobile */
.wpu-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0; /* evita zoom no iOS */
    z-index: 2;
}

.wpu-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    pointer-events: none; /* o input por cima trata os cliques */
}

/* Textos desktop/mobile */
.wpu-upload-text--mobile { display: none; }
.wpu-upload-text--desktop { display: block; }

@media (hover: none) and (pointer: coarse) {
    /* Dispositivos touch (mobile/tablet) */
    .wpu-upload-text--mobile  { display: block; }
    .wpu-upload-text--desktop { display: none; }
}

.wpu-upload-icon {
    font-size: 36px;
    line-height: 1;
    color: #0073aa;
    display: block;
}

.wpu-upload-text {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.wpu-upload-hint {
    font-size: 12px;
    color: #999;
}

/* ── Container do Cropper ─────────────────────────────────────── */
#wpu-crop-container {
    margin-top: 12px;
}

.wpu-crop-canvas-wrapper {
    max-width: 100%;
    height: 320px;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background: #222;
}

@media (max-width: 480px) {
    .wpu-crop-canvas-wrapper {
        height: 260px;
    }
}

.wpu-crop-canvas-wrapper img {
    display: block;
    max-width: 100%;
}

/* ── Info e legenda ───────────────────────────────────────────── */
.wpu-crop-info {
    margin: 12px 0;
}

.wpu-crop-info p {
    margin: 6px 0;
    color: #555;
    font-size: 13px;
}

.wpu-quality-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wpu-badge-ok {
    background: #eaf7ea;
    color: #2a6e2a;
    border: 1px solid #82c882;
}

.wpu-badge-warn {
    background: #fff8e1;
    color: #7a5c00;
    border: 1px solid #f0c040;
}

.wpu-legend {
    display: flex;
    gap: 16px;
    margin-top: 6px;
    font-size: 12px;
    color: #777;
}

.wpu-legend-outer { color: rgba(255,255,255,0.8); }
.wpu-legend-inner { color: rgba(255,220,0,0.9); }

/* ── Botões de ação ───────────────────────────────────────────── */
.wpu-crop-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.wpu-btn {
    padding: 8px 18px !important;
    font-size: 14px !important;
}

.wpu-btn-sm {
    font-size: 12px !important;
}

/* ── Preview de confirmação ───────────────────────────────────── */
#wpu-confirmed {
    margin-top: 12px;
}

.wpu-confirmed-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #f0faf0;
    border: 1px solid #c3e6c3;
    border-radius: 6px;
    margin-bottom: 10px;
}

.wpu-confirmed-preview img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #46b450;
    flex-shrink: 0;
}

.wpu-confirmed-info {
    font-size: 14px;
    line-height: 1.6;
}

.wpu-check {
    color: #46b450;
    font-size: 16px;
    margin-right: 4px;
}

.wpu-photo-details {
    font-size: 12px;
    color: #666;
}

/* ── Mensagens ────────────────────────────────────────────────── */
.wpu-messages {
    margin-top: 12px;
}

.wpu-messages ul {
    margin: 0;
}

/* ── Loading ──────────────────────────────────────────────────── */
.wpu-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: #555;
    font-size: 14px;
}

/* ── Safe zone overlay circular (desenhado via JS no DOM do Cropper) ── */
.wpu-safe-zone {
    position: absolute;
    pointer-events: none;
    border: 2px dashed rgba(255, 220, 0, 0.9);
    border-radius: 50%;
    box-sizing: border-box;
}

/* ── Admin preview ────────────────────────────────────────────── */
.wc-photo-admin-preview {
    clear: both;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    .wpu-crop-actions {
        flex-direction: column;
    }
    .wpu-confirmed-preview {
        flex-direction: column;
        text-align: center;
    }
}
