/* Photo Overlay Generator - Frontend Styles
 *
 * Theming: el plugin usa variables CSS con fallback a su estilo por defecto (claro/naranja).
 * Para integrarlo en otro tema, sobrescribe estas variables en tu CSS:
 *
 *   .pog-container, .pog-gallery {
 *     --pog-accent: #ff4d7e;
 *     --pog-text: #f5f1e8;
 *     ...
 *   }
 */

.pog-container {
    max-width: 600px;
    margin: 20px auto;
    font-family: inherit;
    color: var(--pog-text, #222);
    box-sizing: border-box;
}

.pog-container *,
.pog-container *::before,
.pog-container *::after {
    box-sizing: border-box;
}

/* ===== Step: Upload ===== */
.pog-upload-area {
    border: 2px dashed var(--pog-border-strong, #cbd5e0);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--pog-bg-input, #f9fafb);
    position: relative;
}

.pog-upload-area:hover,
.pog-upload-area:focus,
.pog-upload-area.pog-dragover {
    border-color: var(--pog-accent, #f97316);
    background: var(--pog-accent-soft, #fff7ed);
    outline: none;
}

.pog-upload-icon {
    color: var(--pog-text-faint, #94a3b8);
    margin-bottom: 12px;
}

.pog-upload-area:hover .pog-upload-icon,
.pog-upload-area.pog-dragover .pog-upload-icon {
    color: var(--pog-accent, #f97316);
}

.pog-upload-text {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--pog-text, #1e293b);
}

.pog-upload-hint {
    font-size: 14px;
    color: var(--pog-text-muted, #64748b);
    margin: 0;
}

.pog-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* ===== Step: Crop ===== */
.pog-step-crop h3 {
    font-size: 20px;
    margin: 0 0 6px 0;
    color: var(--pog-text, #1e293b);
}

.pog-crop-hint {
    font-size: 13px;
    color: var(--pog-text-muted, #64748b);
    margin: 0 0 16px 0;
}

.pog-preview-wrapper {
    position: relative;
    width: 100%;
    background: var(--pog-bg-soft, #f1f5f9);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    user-select: none;
    touch-action: none;
    cursor: grab;
}

.pog-preview-wrapper:active {
    cursor: grabbing;
}

.pog-preview-bg,
.pog-preview-canvas,
.pog-preview-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.pog-preview-canvas {
    object-fit: contain;
}

.pog-preview-overlay {
    pointer-events: none;
    object-fit: contain;
}

/* ===== Controles ===== */
.pog-controls label {
    display: block;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--pog-text-secondary, #475569);
    font-weight: 500;
}

.pog-controls label span {
    display: block;
    margin-bottom: 6px;
}

.pog-zoom {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--pog-border, #e2e8f0);
    border-radius: 3px;
    outline: none;
}

.pog-zoom::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--pog-accent, #f97316);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pog-zoom::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--pog-accent, #f97316);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pog-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== Botones ===== */
.pog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    line-height: 1.2;
    flex: 1;
    min-width: 140px;
}

.pog-btn-primary {
    background: var(--pog-accent, #f97316);
    color: #fff;
}

.pog-btn-primary:hover,
.pog-btn-primary:focus {
    background: var(--pog-accent-hover, #ea580c);
    color: #fff;
}

.pog-btn-secondary {
    background: var(--pog-border, #e2e8f0);
    color: var(--pog-text, #1e293b);
}

.pog-btn-secondary:hover,
.pog-btn-secondary:focus {
    background: var(--pog-border-strong, #cbd5e0);
    color: var(--pog-text, #1e293b);
}

/* ===== Loading ===== */
.pog-step-loading {
    text-align: center;
    padding: 60px 20px;
}

.pog-step-loading p {
    color: var(--pog-text-muted, #64748b);
    margin: 16px 0 0 0;
}

.pog-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--pog-border, #e2e8f0);
    border-top-color: var(--pog-accent, #f97316);
    border-radius: 50%;
    margin: 0 auto;
    animation: pog-spin 1s linear infinite;
}

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

/* ===== Step: Result ===== */
.pog-step-result h3 {
    font-size: 22px;
    text-align: center;
    margin: 0 0 16px 0;
    color: var(--pog-text, #1e293b);
}

.pog-result-wrapper {
    text-align: center;
    margin-bottom: 20px;
    background: var(--pog-bg-soft, #f1f5f9);
    padding: 16px;
    border-radius: 8px;
}

.pog-result-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pog-result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* ===== Compartir ===== */
.pog-share {
    border-top: 1px solid var(--pog-border, #e2e8f0);
    padding-top: 20px;
    text-align: center;
}

.pog-share-title {
    font-size: 14px;
    color: var(--pog-text-muted, #64748b);
    margin: 0 0 12px 0;
    font-weight: 500;
}

.pog-share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.pog-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    color: #fff;
    text-decoration: none;
}

.pog-share-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
    color: #fff;
}

.pog-share-whatsapp { background: #25D366; }
.pog-share-facebook { background: #1877F2; }
.pog-share-copy     { background: var(--pog-text-muted, #64748b); }

.pog-share-instagram-note {
    font-size: 12px;
    color: var(--pog-text-faint, #94a3b8);
    margin: 8px 0 0 0;
    font-style: italic;
}

/* ===== Errores ===== */
.pog-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.pog-error {
    color: #b91c1c;
    background: #fef2f2;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .pog-upload-area {
        padding: 40px 16px;
    }
    .pog-upload-text {
        font-size: 16px;
    }
    .pog-btn {
        flex: 1 1 100%;
    }
}

/* ===== Checkbox de compartir a galería ===== */
.pog-gallery-optin {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--pog-accent-soft, #fff7ed);
    border: 1px solid var(--pog-accent-border, #fed7aa);
    border-radius: 8px;
}

.pog-gallery-optin label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--pog-text, #1e293b);
    line-height: 1.4;
}

.pog-gallery-optin input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--pog-accent, #f97316);
    flex-shrink: 0;
    margin-top: 1px;
}

.pog-gallery-optin .pog-optin-text {
    flex: 1;
}

.pog-gallery-optin .pog-optin-title {
    font-weight: 600;
    display: block;
}

.pog-gallery-optin .pog-optin-hint {
    color: var(--pog-text-muted, #64748b);
    font-size: 12px;
    display: block;
    margin-top: 2px;
}

.pog-gallery-name {
    margin-top: 10px;
    transition: max-height 0.2s ease, opacity 0.2s ease, margin-top 0.2s ease;
    overflow: hidden;
}

.pog-gallery-name.pog-hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.pog-gallery-name input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--pog-border-strong, #cbd5e0);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
}

.pog-gallery-name input[type="text"]:focus {
    outline: none;
    border-color: var(--pog-accent, #f97316);
    box-shadow: 0 0 0 3px var(--pog-accent-glow, rgba(249, 115, 22, 0.15));
}

/* ===== Galería pública ===== */
.pog-gallery {
    max-width: 1200px;
    margin: 30px auto;
    font-family: inherit;
}

.pog-gallery-title {
    font-size: 24px;
    margin: 0 0 20px 0;
    text-align: center;
}

.pog-gallery-empty {
    text-align: center;
    color: var(--pog-text-muted, #64748b);
    padding: 60px 20px;
    background: var(--pog-bg-input, #f8fafc);
    border-radius: 8px;
    font-size: 16px;
}

.pog-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--pog-cols, 3), 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .pog-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .pog-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

.pog-gallery-item {
    margin: 0;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: var(--pog-bg-soft, #f1f5f9);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.pog-gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.pog-gallery-link {
    display: block;
    aspect-ratio: 4 / 5;
    overflow: hidden;
}

.pog-gallery-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.pog-gallery-link:hover img {
    transform: scale(1.05);
}

.pog-gallery-caption {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--pog-text-secondary, #475569);
    text-align: center;
    background: #fff;
    border-top: 1px solid var(--pog-bg-soft, #f1f5f9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pog-gallery-pagination {
    text-align: center;
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pog-gallery-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 6px;
    background: var(--pog-bg-soft, #f1f5f9);
    color: var(--pog-text-secondary, #475569);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.pog-gallery-pagination .page-numbers:hover {
    background: var(--pog-border, #e2e8f0);
}

.pog-gallery-pagination .page-numbers.current {
    background: var(--pog-accent, #f97316);
    color: #fff;
}

.pog-gallery-pagination .page-numbers.dots {
    background: transparent;
}

/* ===== Lightbox ===== */
.pog-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pog-lightbox.pog-lightbox-open {
    display: flex;
}

.pog-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    position: relative;
}

.pog-lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    height: auto;
    width: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.pog-lightbox-caption {
    color: #fff;
    margin-top: 14px;
    font-size: 15px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.pog-lightbox-close,
.pog-lightbox-prev,
.pog-lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: background 0.15s ease, transform 0.15s ease;
    line-height: 1;
}

.pog-lightbox-close:hover,
.pog-lightbox-prev:hover,
.pog-lightbox-next:hover {
    background: rgba(255,255,255,0.28);
    transform: scale(1.05);
}

.pog-lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 28px;
}

.pog-lightbox-prev,
.pog-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 32px;
}

.pog-lightbox-prev:hover,
.pog-lightbox-next:hover {
    transform: translateY(-50%) scale(1.05);
}

.pog-lightbox-prev { left: 20px; }
.pog-lightbox-next { right: 20px; }

@media (max-width: 600px) {
    .pog-lightbox-prev { left: 10px; width: 40px; height: 40px; font-size: 28px; }
    .pog-lightbox-next { right: 10px; width: 40px; height: 40px; font-size: 28px; }
    .pog-lightbox-close { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 24px; }
}

/* ===== Mensaje de galería en el paso de resultado ===== */
.pog-gallery-notice {
    margin: 0 0 16px 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

.pog-gallery-notice-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.pog-gallery-notice-pending {
    background: #fefce8;
    border: 1px solid #fde68a;
    color: #a16207;
}
