/* Button Styles */
.wc-live-preview-button-container {
    margin: 20px 0;
}

.customize-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.customize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Modal Styles */
.wc-live-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: white;
    margin: 2% auto;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

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

.wc-live-preview-container {
    display: flex;
    gap: 30px;
    height: 100%;
}

.customization-controls {
    flex: 1;
    min-width: 300px;
}

.preview-container {
    flex: 1;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-primary {
    background: #007cba;
    color: white;
}

/* Summary Styles */
.customization-summary {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007cba;
}

.summary-content {
    margin: 10px 0;
}

.btn-link {
    background: none;
    border: none;
    color: #007cba;
    text-decoration: underline;
    cursor: pointer;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .wc-live-preview-container {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        height: 95%;
        margin: 2.5% auto;
    }
}

/* Enhanced Upload Area */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
}

.upload-area:hover {
    border-color: #007cba;
    background-color: #f0f8ff;
}

.upload-area.dragover {
    border-color: #007cba;
    background-color: #e6f3ff;
    transform: scale(1.02);
}

.upload-area.uploaded {
    border-color: #28a745;
    background-color: #f0fff4;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.upload-text h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2em;
}

.upload-text p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 1em;
}

.upload-text small {
    color: #999;
    font-size: 0.8em;
}

.browse-link {
    color: #007cba;
    text-decoration: underline;
    font-weight: bold;
}

.upload-progress {
    margin-top: 15px;
    height: 25px;
    background-color: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-weight: bold;
    font-size: 0.9em;
}

/* Instructions */
.preview-instructions {
    background-color: #e8f4f8;
    border: 1px solid #b8e2f0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.preview-instructions p {
    margin: 0 0 10px 0;
    color: #2c5f7a;
    font-weight: bold;
}

.preview-instructions ul {
    margin: 0;
    padding-left: 20px;
    color: #2c5f7a;
}

/* WooCommerce Live Preview Styles */
.wc-live-preview-container {
    margin: 20px 0;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: linear-gradient(135deg, #f9f9f9 0%, #f5f5f5 100%);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.wc-live-preview-container h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.4em;
    text-align: center;
    margin-bottom: 25px;
}

.custom-field-group {
    margin-bottom: 25px;
}

.custom-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.preview-container {
    margin: 20px 0;
    text-align: center;
}

.product-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.base-product-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.custom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.custom-design-image {
    position: absolute;
    max-width: 40%;
    max-height: 40%;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transition: transform 0.1s ease;
    z-index: 10;
}

.custom-design-image:hover {
    filter: brightness(1.1);
}

.position-controls {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.position-controls h4 {
    margin-top: 0;
    color: #333;
    font-size: 1.1em;
}

.position-controls label {
    display: block;
    margin: 10px 0;
    font-weight: normal;
    color: #555;
}

.position-controls input[type="range"] {
    width: 100%;
    margin-left: 10px;
    vertical-align: middle;
}

.position-controls button {
    background-color: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.position-controls button:hover {
    background-color: #005a87;
}

.position-controls button:active {
    transform: translateY(1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .wc-live-preview-container {
        padding: 15px;
    }
    
    .product-preview {
        max-width: 100%;
    }
    
    .custom-design-image {
        max-width: 50%;
        max-height: 50%;
    }
    
    .position-controls {
        padding: 10px;
    }
    
    .position-controls label {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .wc-live-preview-container {
        padding: 10px;
    }
    
    .position-controls input[type="range"] {
        width: calc(100% - 20px);
        margin-left: 5px;
    }
    
    .position-controls button {
        width: 100%;
        margin-top: 10px;
    }
}

/* Cart and Order Display */
.custom-design-preview {
    margin: 10px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.custom-design-preview img {
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Loading States */
.custom-field-group input[type="file"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error States */
.error-message {
    color: #d63384;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Success States */
.success-message {
    color: #198754;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Accessibility */
.custom-design-image:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

input[type="range"]:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Animation for smooth interactions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.position-controls {
    animation: fadeIn 0.3s ease-in-out;
}

.custom-design-image {
    animation: fadeIn 0.3s ease-in-out;
}

/* Tab Navigation */
.customization-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.tab-button:hover {
    color: #007cba;
    background-color: #f0f8ff;
}

.tab-button.active {
    color: #007cba;
    border-bottom-color: #007cba;
    background-color: #f0f8ff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Text Input Styles */
.custom-field-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.custom-field-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.word-counter {
    text-align: right;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.word-counter.warning {
    color: #ff6b35;
}

.word-counter.error {
    color: #d63384;
}

.text-style-controls {
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.style-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.style-row:last-child {
    margin-bottom: 0;
}

.style-row label {
    min-width: 100px;
    margin-right: 10px;
    margin-bottom: 0;
    font-weight: 500;
}

.style-row input[type="color"] {
    width: 50px;
    height: 35px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.style-row select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.add-text-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s ease;
    width: 100%;
}

.add-text-button:hover {
    background-color: #218838;
}

.add-text-button:active {
    transform: translateY(1px);
}

.add-text-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Text Overlay Styles */
.custom-text-overlay {
    position: absolute;
    color: #000000;
    font-size: 16px;
    font-weight: normal;
    white-space: pre-wrap;
    word-wrap: break-word;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: grab;
    z-index: 15;
    text-align: center;
    line-height: 1.2;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    transition: transform 0.1s ease;
}

.custom-text-overlay:hover {
    filter: brightness(1.1);
}

.custom-text-overlay:active {
    cursor: grabbing;
}

/* Enhanced Upload Area */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #007cba;
    background-color: #f0f8ff;
}

.upload-area.dragover {
    border-color: #007cba;
    background-color: #e6f3ff;
    transform: scale(1.02);
}

.upload-area.uploaded {
    border-color: #28a745;
    background-color: #f0fff4;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.upload-text h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2em;
}

.upload-text p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 1em;
}

.upload-text small {
    color: #999;
    font-size: 0.8em;
}

.browse-link {
    color: #007cba;
    text-decoration: underline;
    font-weight: bold;
}

.upload-progress {
    margin-top: 15px;
    height: 25px;
    background-color: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-weight: bold;
    font-size: 0.9em;
}

/* Instructions */
.preview-instructions {
    background-color: #e8f4f8;
    border: 1px solid #b8e2f0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.preview-instructions p {
    margin: 0 0 10px 0;
    color: #2c5f7a;
    font-weight: bold;
}

.preview-instructions ul {
    margin: 0;
    padding-left: 20px;
    color: #2c5f7a;
}

/* WooCommerce Live Preview Styles */
.wc-live-preview-container {
    margin: 20px 0;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: linear-gradient(135deg, #f9f9f9 0%, #f5f5f5 100%);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.wc-live-preview-container h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.4em;
    text-align: center;
    margin-bottom: 25px;
}

.custom-field-group {
    margin-bottom: 25px;
}

.custom-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.preview-container {
    margin: 20px 0;
    text-align: center;
}

.product-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.base-product-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.custom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.custom-design-image {
    position: absolute;
    max-width: 40%;
    max-height: 40%;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transition: transform 0.1s ease;
    z-index: 10;
}

.custom-design-image:hover {
    filter: brightness(1.1);
}

.position-controls {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.position-controls h4 {
    margin-top: 0;
    color: #333;
    font-size: 1.1em;
}

.position-controls label {
    display: block;
    margin: 10px 0;
    font-weight: normal;
    color: #555;
}

.position-controls input[type="range"] {
    width: 100%;
    margin-left: 10px;
    vertical-align: middle;
}

.position-controls button {
    background-color: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.position-controls button:hover {
    background-color: #005a87;
}

.position-controls button:active {
    transform: translateY(1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .wc-live-preview-container {
        padding: 15px;
    }
    
    .customization-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .product-preview {
        max-width: 100%;
    }
    
    .custom-design-image {
        max-width: 50%;
        max-height: 50%;
    }
    
    .position-controls {
        padding: 10px;
    }
    
    .position-controls label {
        font-size: 0.9em;
    }
    
    .style-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .style-row label {
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .wc-live-preview-container {
        padding: 10px;
    }
    
    .position-controls input[type="range"] {
        width: calc(100% - 20px);
        margin-left: 5px;
    }
    
    .position-controls button {
        width: 100%;
        margin-top: 10px;
    }
}

/* Cart and Order Display */
.custom-design-preview {
    margin: 10px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.custom-design-preview img {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.custom-text-preview {
    margin: 10px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.custom-text-preview span {
    font-style: italic;
    color: #333;
}

/* Loading States */
.custom-field-group input[type="file"]:disabled,
.custom-field-group textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error States */
.error-message {
    color: #d63384;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Success States */
.success-message {
    color: #198754;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Accessibility */
.custom-design-image:focus,
.custom-text-overlay:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

input[type="range"]:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Animation for smooth interactions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.position-controls {
    animation: fadeIn 0.3s ease-in-out;
}

.custom-design-image,
.custom-text-overlay {
    animation: fadeIn 0.3s ease-in-out;
}

/* Prevent text selection on interactive elements */
.custom-design-image,
.custom-text-overlay {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Text overlay pointer events */
.custom-text-overlay {
    pointer-events: auto;
}