/**
 * Print Laguna Designer - Front-end Styles
 * Styles for the "Personalizar" button, preview area, and FPD overrides.
 */

/* ============================================
   Wrapper
   ============================================ */
#pldesigner-wrapper {
    margin: 16px 0;
    padding: 0;
}

/* ============================================
   Main Button - "Personalizar este producto"
   ============================================ */
.pldesigner-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #6c5ce7 0%, #a855f7 50%, #ec4899 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.35);
    position: relative;
    overflow: hidden;
}

.pldesigner-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.pldesigner-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
}

.pldesigner-btn:hover::before {
    left: 100%;
}

.pldesigner-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.3);
}

.pldesigner-btn-icon {
    font-size: 20px;
}

.pldesigner-btn-text {
    text-transform: uppercase;
}

/* Small variant (edit button) */
.pldesigner-btn.pldesigner-btn-sm {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
    margin-top: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ============================================
   Design Preview
   ============================================ */
#pldesigner-preview {
    margin-top: 16px;
    padding: 16px;
    border: 2px dashed #a855f7;
    border-radius: 10px;
    background: #faf5ff;
    text-align: center;
}

.pldesigner-preview-label {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #6c5ce7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#pldesigner-preview-img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
    border: 1px solid #e9d5ff;
}

.pldesigner-preview-hint {
    margin: 10px 0 0 0;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* ============================================
   FPD Modal Overrides (z-index fix for PS themes)
   ============================================ */
.fpd-modal-overlay {
    z-index: 99999 !important;
}

.fpd-modal-product-designer {
    z-index: 100000 !important;
}

/* Make the modal full-width on mobile */
@media (max-width: 768px) {
    .fpd-modal-product-designer {
        width: 98vw !important;
        height: 90vh !important;
        top: 5vh !important;
        left: 1vw !important;
    }

    .pldesigner-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* ============================================
   AI Text Generator - Sidebar Button
   ============================================ */
.plai-sidebar-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 15px;
    margin-bottom: 10px;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
    transition: all 0.3s ease;
    animation: plai-sidebar-pulse 2.5s ease-in-out infinite;
}
.plai-sidebar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.6);
}
@keyframes plai-sidebar-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4); }
    50%      { box-shadow: 0 4px 25px rgba(240, 147, 251, 0.6); }
}

/* ============================================
   AI Modal Overlay
   ============================================ */
.plai-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.plai-modal-content {
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    background: #1e1e2e;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
}
.plai-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.plai-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #f093fb;
}
.plai-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.plai-close:hover { color: #fff; }

.plai-modal-body {
    padding: 20px;
}
.plai-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.plai-input,
.plai-select {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: #2a2a3e;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.plai-input:focus,
.plai-select:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.25);
}
.plai-select option {
    background: #2a2a3e;
    color: #fff;
}

/* Preview */
.plai-preview-area {
    margin: 12px 0;
    text-align: center;
    padding: 12px;
    border: 2px dashed rgba(240, 147, 251, 0.3);
    border-radius: 12px;
    background: rgba(240, 147, 251, 0.05);
}
.plai-preview-area img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
}

/* Error */
.plai-error {
    margin: 8px 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    font-size: 13px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Spinner */
.plai-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: #aaa;
    font-size: 13px;
}
.plai-spinner-ring {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #f093fb;
    border-radius: 50%;
    animation: plai-spin 0.8s linear infinite;
}
@keyframes plai-spin {
    to { transform: rotate(360deg); }
}

/* Footer Buttons */
.plai-modal-footer {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.plai-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.plai-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.plai-btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}
.plai-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}
.plai-btn-secondary {
    background: #3a3a50;
    color: #ddd;
}
.plai-btn-secondary:hover {
    background: #4a4a60;
}
.plai-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}
.plai-btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

@media (max-width: 480px) {
    .plai-modal-content {
        width: 98vw;
        border-radius: 12px;
    }
    .plai-float-btn {
        bottom: 10px;
        right: 10px;
        font-size: 12px;
        padding: 10px 14px;
    }
    .plai-modal-footer {
        flex-direction: column;
    }
}
