/**
 * Product Designer for WooCommerce - Editor Styles
 * Astra Theme Compatible
 */

/* Reset Astra theme styles inside editor */
.pdwc-full-editor,
.pdwc-full-editor * {
    box-sizing: border-box !important;
}

/* Override Astra container/wrapper styles */
.site-content .pdwc-full-editor,
.ast-container .pdwc-full-editor,
.entry-content .pdwc-full-editor,
body .pdwc-full-editor {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100vw !important;
    width: 100vw !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
}

/* Reset Astra button styles */
.pdwc-full-editor button,
.pdwc-full-editor .button,
.pdwc-full-editor .ast-button,
.pdwc-full-editor input[type="button"],
.pdwc-full-editor input[type="submit"] {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    margin: 0 !important;
    padding: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
}

.pdwc-full-editor .pdwc-btn {
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #333 !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin: 0 !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.pdwc-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.pdwc-btn:active {
    transform: translateY(1px);
}

.pdwc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pdwc-full-editor .pdwc-btn-primary {
    background: #0073aa !important;
    color: #fff !important;
    border-color: #0073aa !important;
}

.pdwc-btn-primary:hover {
    background: #005a87;
    border-color: #005a87;
}

.pdwc-canvas-container {
    position: relative !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

#pdwc-canvas {
    display: block !important;
    max-width: none !important;
    width: auto !important;
    height: auto !important;
    cursor: crosshair !important;
    transition: transform 0.1s ease-out !important;
}

.pdwc-messages {
    min-height: 30px;
    margin-top: 12px;
}

.pdwc-message {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.pdwc-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.pdwc-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.pdwc-message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Admin order page styles */
.pdwc-design-column {
    width: 200px;
}

.pdwc-design-column img {
    max-width: 150px;
    height: auto;
    border: 1px solid #ddd;
    padding: 5px;
    background: #fff;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.pdwc-design-column img:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    .pdwc-designer-wrapper {
        padding: 10px;
    }
    
    .pdwc-toolbar {
        flex-direction: column;
    }
    
    .pdwc-btn {
        width: 100%;
        text-align: center;
    }
    
    .pdwc-canvas-container {
        padding: 5px;
    }
    
    #pdwc-canvas {
        max-width: 100%;
    }
}

/* Print area indicator styles (handled by Fabric.js) */
/* The print area is drawn on the canvas using Fabric.js Rect */

/* Loading state */
.pdwc-loading {
    position: relative;
}

.pdwc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: pdwc-spin 1s linear infinite;
}

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

/* Modal styles */
.pdwc-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.pdwc-modal-open {
    display: flex;
}

.pdwc-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.pdwc-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    background: #f9f9f9;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 20px 24px;
}

.pdwc-modal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.pdwc-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.pdwc-no-scroll {
    overflow: hidden;
}

.pdwc-helper-text {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

/* New full-page editor layout (Printify-like) */
.pdwc-full-editor {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    background: #f5f5ef !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    isolation: isolate !important;
    overflow: hidden !important;
    z-index: 999999 !important;
}

/* Hide body scroll when editor is active */
body.pdwc-editor-active {
    overflow: hidden !important;
    height: 100vh !important;
}

.pdwc-editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.pdwc-editor-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.pdwc-editor-topbar-right {
    display: flex;
    gap: 8px;
}

.pdwc-btn-secondary {
    background: #f5f5f5;
    border-color: #ddd;
}

.pdwc-editor-mode.is-active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.pdwc-editor-layout {
    display: none;
}

.pdwc-editor-body {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) !important;
    gap: 0 !important;
    align-items: stretch !important;
    min-height: 0 !important;
    flex: 1 !important;
    height: 100vh !important;
    overflow: hidden !important;
}

/* Left vertical toolbar */
.pdwc-left-toolbar {
    background: #f3f2ea !important;
    border-radius: 0 !important;
    padding: 16px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    flex-shrink: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.pdwc-toolbar-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
    align-items: center !important;
}

.pdwc-toolbar-group-bottom {
    margin-top: auto;
}

.pdwc-left-toolbar .pdwc-toolbar-item {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    border-radius: 14px !important;
    border: none !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    cursor: pointer !important;
    transition: background 0.2s ease, transform 0.1s ease !important;
    font-size: 11px !important;
    color: #4a4a35 !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
    vertical-align: middle !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: normal !important;
    line-height: 1 !important;
}

.pdwc-left-toolbar .pdwc-toolbar-item:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04) !important;
}

.pdwc-left-toolbar .pdwc-toolbar-item:active:not(:disabled) {
    transform: translateY(1px) !important;
}

.pdwc-left-toolbar .pdwc-toolbar-item:disabled {
    opacity: 0.4 !important;
    cursor: default !important;
}

.pdwc-toolbar-icon {
    font-size: 15px;
    line-height: 1;
}

.pdwc-toolbar-label {
    font-size: 10px;
}

/* Main canvas area */
.pdwc-main-area {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100vh !important;
    overflow: hidden !important;
    background: #f5f5ef !important;
}

.pdwc-main-canvas-wrapper {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.pdwc-btn-link {
    background: transparent;
    border: none;
    color: #0073aa;
    padding: 0;
    text-align: left;
}

.pdwc-btn-link:hover {
    text-decoration: underline;
}

.pdwc-pill-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pdwc-pill {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
}

.pdwc-pill.is-active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.pdwc-color-swatches {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pdwc-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: #fff;
    display: inline-block;
}

.pdwc-color-swatch:nth-child(2) {
    background: #111;
}

.pdwc-color-swatch:nth-child(3) {
    background: #aaa;
}

.pdwc-color-swatch.is-active {
    box-shadow: 0 0 0 2px #0073aa;
}

.pdwc-product-meta {
    font-size: 13px;
}

/* Bottom bar */
.pdwc-editor-bottombar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
}

.pdwc-bottombar-left,
.pdwc-bottombar-center,
.pdwc-bottombar-right {
    display: flex;
    align-items: center;
}

.pdwc-bottombar-center {
    justify-content: center;
    flex: 1;
}

.pdwc-zoom-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f2ea;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    color: #4a4a35;
}

.pdwc-zoom-btn {
    border: none;
    background: transparent;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    cursor: default;
    font-size: 14px;
}

.pdwc-zoom-value {
    min-width: 40px;
    text-align: center;
}

@media (max-width: 1024px) {
    .pdwc-editor-body {
        grid-template-columns: 56px minmax(0, 1fr);
        gap: 16px;
    }

    .pdwc-full-editor {
        padding: 12px 12px 10px;
    }
}
