/* Custom Product Designer Frontend Styles */

/* Designer Button */
.cpd-designer-btn {
    background-color: #0073aa;
    color: white;
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 0;
    transition: background-color 0.3s ease;
    display: inline-block;
}

.cpd-designer-btn:hover {
    background-color: #005177;
    color: white;
}

/* Modal Styles */
.cpd-modal {
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpd-modal-content {
    background-color: #fefefe;
    padding: 15px 20px;
    border: 1px solid #888;
    width: 96%;
    max-width: 1400px;
    height: 96vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cpd-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.cpd-close:hover,
.cpd-close:focus {
    color: #000;
}

#cpd-designer-heading {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 24px;
    color: #333;
    flex-shrink: 0;
}

/* Designer Container */
.cpd-designer-container {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Toolbar */
.cpd-toolbar {
    flex: 0 0 280px;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    overflow-y: auto;
    height: 100%;
}

.cpd-tool-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.cpd-tool-section:last-child {
    border-bottom: none;
}

.cpd-tool-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    text-transform: uppercase;
    font-weight: 600;
}

/* Buttons */
.cpd-btn {
    background-color: #0073aa;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    margin-bottom: 8px;
    transition: background-color 0.3s ease;
}

.cpd-btn:hover {
    background-color: #005177;
}

.cpd-btn-small {
    background-color: #555;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
    transition: background-color 0.3s ease;
}

.cpd-btn-small:hover {
    background-color: #333;
}

.cpd-btn-primary {
    background-color: #28a745;
}

.cpd-btn-primary:hover {
    background-color: #218838;
}

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

.cpd-btn-secondary:hover {
    background-color: #5a6268;
}

.cpd-btn-danger {
    background-color: #dc3545;
}

.cpd-btn-danger:hover {
    background-color: #c82333;
}

.cpd-btn-warning {
    background-color: #ffc107;
    color: #333;
}

.cpd-btn-warning:hover {
    background-color: #e0a800;
}

.cpd-btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

/* Options Panels */
.cpd-options {
    background: white;
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}

.cpd-options label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.cpd-options input[type="text"],
.cpd-options input[type="number"],
.cpd-options select {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.cpd-options input[type="color"] {
    width: 100%;
    height: 40px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.cpd-text-style,
.cpd-text-align {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

/* Clipart Grid */
.cpd-clipart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.cpd-clipart-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 5px;
    transition: border-color 0.3s ease;
}

.cpd-clipart-item:hover {
    border-color: #0073aa;
}

.cpd-clipart-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Canvas Wrapper */
.cpd-canvas-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.cpd-side-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.cpd-side-btn {
    flex: 1;
    padding: 12px;
    background-color: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cpd-side-btn.active {
    background-color: #0073aa;
    color: white;
}

.cpd-side-btn:hover:not(.active) {
    background-color: #d0d0d0;
}

/* Canvas Container */
.cpd-canvas-container {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

#cpd-canvas-front,
#cpd-canvas-back {
    border: 1px solid #ccc;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
}

/* Canvas Actions */
.cpd-canvas-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    justify-content: center;
    flex-shrink: 0;
}

/* Cart Preview */
.cpd-cart-preview {
    margin-top: 10px;
}

.cpd-preview-item {
    margin-bottom: 10px;
}

.cpd-preview-item strong {
    display: block;
    margin-bottom: 5px;
}

/* Loading Spinner */
.cpd-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.cpd-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: cpd-spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes cpd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .cpd-designer-container {
        flex-direction: column;
    }

    .cpd-toolbar {
        flex: 0 0 auto;
        max-height: 250px;
    }

    .cpd-canvas-wrapper {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .cpd-modal-content {
        width: 98%;
        height: 98vh;
        padding: 10px;
    }

    #cpd-designer-heading {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .cpd-toolbar {
        padding: 10px;
        max-height: 200px;
    }

    .cpd-canvas-container {
        padding: 10px;
    }

    .cpd-canvas-actions {
        flex-direction: column;
        gap: 10px;
    }

    .cpd-canvas-actions button {
        width: 100%;
    }

    .cpd-side-toggle {
        margin-bottom: 8px;
    }
}

/* Notification */
.cpd-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 100000;
    animation: cpd-slideIn 0.3s ease;
}

.cpd-notification.error {
    background-color: #dc3545;
}

@keyframes cpd-slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Order Design Preview */
.cpd-order-design {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.cpd-design-preview {
    margin-bottom: 10px;
}

.cpd-design-preview strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
}
