/**
 * PrintPerfect Frontend Styles
 */

/* Hide default add to cart form for PrintPerfect products */
.pp-printperfect-product form.cart,
.pp-printperfect-product .single_add_to_cart_button,
.pp-printperfect-product .quantity,
.pp-printperfect-product .cart .quantity,
body.pp-printperfect-product form.cart,
body.pp-printperfect-product .single_add_to_cart_button,
body.pp-printperfect-product .quantity {
    display: none !important;
    visibility: hidden !important;
}

/* Upload Button Section */
.pp-upload-section {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
    display: block !important;
    width: 100% !important;
    clear: both !important;
    box-sizing: border-box;
}

.pp-upload-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    background: #0071a1;
    color: white !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

.pp-upload-btn:hover {
    background: #005177 !important;
    color: white !important;
}

.pp-upload-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.pp-upload-description {
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 14px;
    color: #666;
}

/* Modal Base Styles */
.pp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.pp-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
}

.pp-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.pp-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.pp-modal-close:hover {
    opacity: 0.7;
}

.pp-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.pp-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

/* Dropzone Customization */
.pp-dropzone-wrapper {
    margin-bottom: 30px;
}

/* Privacy Notice Bar */
.pp-privacy-notice {
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-left: 4px solid #e74c3c;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.pp-privacy-notice ul {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.pp-privacy-notice li {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.pp-privacy-notice li:first-child {
    margin-top: 0;
}

.pp-privacy-notice li:last-child {
    margin-bottom: 0;
}

#pp-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafafa;
    padding: 28px 20px;
    text-align: center;
    transition: all 0.3s;
    min-height: 140px;
}

#pp-dropzone:hover,
#pp-dropzone.dz-drag-hover {
    border-color: #e74c3c;
    background: #fff5f5;
}

#pp-dropzone .dz-message {
    margin: 0;
}

.pp-upload-icon {
    margin-bottom: 20px;
}

#pp-dropzone h3 {
    margin: 15px 0;
    font-size: 18px;
    color: #666;
}

.pp-upload-pc-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.pp-upload-pc-btn:hover {
    background: #c0392b;
}

/* Hide default Dropzone preview */
#pp-dropzone .dz-preview {
    display: none;
}

/* Uploaded Thumbnails */
.pp-uploaded-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.pp-thumbnail-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #eee;
    transition: border-color 0.3s;
}

.pp-thumbnail-item:hover {
    border-color: #e74c3c;
}

.pp-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pp-thumbnail-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 8px;
    pointer-events: none;
}

.pp-thumbnail-item:hover .pp-thumbnail-actions {
    /* Always visible now */
}

.pp-thumbnail-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    border-radius: 4px;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    pointer-events: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    padding: 0 !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
}

/* Force width on all button elements */
button.pp-thumbnail-btn,
.pp-thumbnail-actions button.pp-thumbnail-btn,
.pp-thumbnail-item button.pp-thumbnail-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
}

.pp-thumbnail-btn:hover {
    background: white;
    transform: scale(1.1);
}

.pp-thumbnail-btn svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    stroke: #333;
    fill: none;
    flex-shrink: 0 !important;
    display: block !important;
    pointer-events: none;
}

/* Ensure SVG is visible */
button.pp-thumbnail-btn svg,
.pp-thumbnail-actions button svg {
    width: 16px !important;
    height: 16px !important;
}

/* Upload Info */
.pp-upload-info {
    margin-top: 20px;
    text-align: center;
}

.pp-image-count {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.pp-image-count span {
    color: #e74c3c;
}

/* Buttons */
.pp-btn-primary {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.pp-btn-primary:hover:not(:disabled) {
    background: #c0392b;
}

.pp-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pp-btn-secondary {
    background: white;
    color: #333;
    border: 2px solid #ddd;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.pp-btn-secondary:hover {
    border-color: #999;
    color: #000;
}

.pp-btn-large {
    width: 100%;
    padding: 16px 30px;
    font-size: 18px;
}

.pp-btn-back {
    width: 100%;
    margin-top: 10px;
}

/* Preview Modal Specific */
.pp-modal-preview .pp-modal-content {
    max-width: 1400px;
    max-height: 95vh;
}

.pp-preview-body {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    padding: 40px;
}

.pp-preview-grid-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pp-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 900px;
    width: 100%;
}

.pp-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0;
    overflow: hidden;
    border: 3px solid #ddd;
    padding: 0;
    background: white;
}

/* Red dotted border for safe area - much smaller margin */
.pp-preview-item::before {
    content: '';
    position: absolute;
    top: 3%;
    left: 3%;
    right: 3%;
    bottom: 3%;
    border: 2px dashed #e74c3c;
    border-radius: 0;
    pointer-events: none;
    z-index: 2;
}

/* Extra image indicator (outside bundle) */
.pp-preview-item.pp-extra-image {
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

.pp-preview-item.pp-extra-image::after {
    content: 'EXTRA';
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff9800;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    z-index: 3;
    letter-spacing: 0.5px;
}

.pp-preview-item-inner {
    width: 100%;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
}

.pp-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pp-preview-item-actions {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    z-index: 3;
}

.pp-preview-item:hover .pp-preview-item-actions {
    /* Always visible now */
}

.pp-preview-item-btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    border-radius: 4px;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s;
    padding: 0 !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
}

/* Force width on all button elements */
button.pp-preview-item-btn,
.pp-preview-item-actions button.pp-preview-item-btn,
.pp-preview-item button.pp-preview-item-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
}

.pp-preview-item-btn:hover {
    background: white;
    transform: scale(1.1);
}

.pp-preview-item-btn svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    stroke: #333;
    fill: none;
    flex-shrink: 0 !important;
    display: block !important;
    pointer-events: none;
}

/* Ensure SVG is visible */
button.pp-preview-item-btn svg,
.pp-preview-item-actions button svg {
    width: 16px !important;
    height: 16px !important;
}

/* Preview Sidebar */
.pp-preview-sidebar {
    display: flex;
    flex-direction: column;
}

.pp-preview-sidebar h3 {
    font-size: 20px;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.pp-preview-notice {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: #fff5f5;
    border-radius: 8px;
    margin-bottom: 20px;
}

.pp-notice-color {
    width: 20px;
    height: 20px;
    background: #e74c3c;
    border-radius: 4px;
    flex-shrink: 0;
}

.pp-preview-notice p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

/* Price Breakdown */
.pp-price-breakdown {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.pp-price-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 15px;
    color: #666;
}

.pp-price-line.pp-extra {
    color: #e74c3c;
    font-weight: 500;
}

.pp-price-total {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 2px solid #ddd;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.pp-selected-count {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #666;
}

.pp-selected-count span {
    color: #e74c3c;
}

/* Loading State */
.pp-loading {
    position: relative;
    pointer-events: none;
}

.pp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #e74c3c;
    border-radius: 50%;
    animation: pp-spin 1s linear infinite;
}

@keyframes pp-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pp-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
    
    .pp-modal-header,
    .pp-modal-body,
    .pp-modal-footer {
        padding: 20px;
    }
    
    .pp-preview-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .pp-preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .pp-preview-sidebar {
        order: -1;
    }
    
    .pp-uploaded-thumbnails {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .pp-modal-footer {
        flex-direction: column-reverse;
    }
    
    .pp-modal-footer button {
        width: 100%;
    }
}

/* Dropzone Error Messages */
.dz-error-message {
    display: none !important;
}

.pp-error-notice {
    background: #fee;
    color: #c00;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 14px;
}

/* Cart Display Styles */
.pp-cart-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 4px 10px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
}

.pp-cart-images-wrapper {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.pp-cart-combined-thumb {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
    transition: border-color 0.3s;
}

.pp-cart-combined-thumb:hover {
    border-color: #e74c3c;
}

.pp-combined-thumb-img {
    display: block;
    max-width: 300px;
    height: auto;
}

.pp-image-count-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.pp-cart-price-breakdown {
    margin-top: 10px;
}

.pp-cart-price-breakdown small {
    color: #666;
    font-size: 13px;
}

/* Mobile Cart Styles */
@media (max-width: 768px) {
    .pp-combined-thumb-img {
        max-width: 200px;
    }
    
    .pp-cart-images-wrapper {
        padding: 10px;
    }
}