/**
 * @copyright © SixPrint. All rights reserved.
 */

/**
 * Designer Styles
 * For the online product designer interface
 */

/* ========================================
   CSS VARIABLES
   ======================================== */

:root {
    --brand-pink: #FF269E;
    --brand-purple: #924EFF;
    --brand-dark: #2D3748;
}

/* ========================================
   PRODUCT SELECTOR MODAL
   ======================================== */

.product-selector-content {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
}

.selector-header {
    text-align: center;
    margin-bottom: 40px;
}

.selector-header h2 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 600;
    color: #333;
}

.selector-header p {
    margin: 0;
    font-size: 16px;
    color: #666;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.product-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover:not(.disabled) {
    border-color: var(--brand-pink);
    box-shadow: 0 8px 20px rgba(255, 38, 158, 0.2);
    transform: translateY(-4px);
}

.product-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.product-card h3 {
    margin: 15px 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.product-card p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.product-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.product-badge.available {
    background: #d4edda;
    color: #155724;
}

.product-badge.coming-soon {
    background: #fff3cd;
    color: #856404;
}

.coming-soon-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
}

.coming-soon-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #666;
    text-align: center;
}

/* ========================================
   SIZE SELECTOR MODAL
   ======================================== */

.size-selector-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
}

.size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.size-option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.size-option:hover {
    border-color: var(--brand-pink);
    transform: translateY(-2px);
}

.size-option.size-excellent {
    border-color: #28a745;
}

.size-option.size-acceptable {
    border-color: #ffc107;
}

.size-name {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.size-dpi {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.size-quality {
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

.size-excellent .size-quality {
    color: #28a745;
}

.size-acceptable .size-quality {
    color: #ffc107;
}

.size-quality-legend {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.size-quality-legend h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.quality-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

.quality-indicator.excellent {
    background: #28a745;
    color: white;
}

.quality-indicator.acceptable {
    background: #ffc107;
    color: #333;
}

/* ========================================
   DESIGNER CONTAINER
   ======================================== */

.designer-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

.designer-header {
    background: white;
    border-bottom: 2px solid #e0e0e0;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.designer-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.size-label {
    display: inline-block;
    margin-left: 12px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #FF269E 0%, #924EFF 100%);
    color: white;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.designer-actions {
    display: flex;
    gap: 12px;
}

/* ========================================
   DESIGNER LAYOUT
   ======================================== */

.designer-layout {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.designer-sidebar,
.designer-validation {
    background: white;
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid #e0e0e0;
}

.designer-validation {
    border-right: none;
    border-left: 1px solid #e0e0e0;
}

.sidebar-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e0e0e0;
}

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

.sidebar-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-pink);
}

.form-group input[readonly] {
    background: #f8f9fa;
    color: #666;
}

.hint {
    font-size: 13px;
    color: #999;
    margin-left: 4px;
}

.size-note,
.border-note {
    font-size: 13px;
    color: #666;
    margin: 8px 0 0 0;
    line-height: 1.4;
}

.current-image {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    text-align: center;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* ========================================
   CANVAS AREA
   ======================================== */

.designer-canvas {
    background: #e0e0e0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

#konvaContainer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
    position: relative;
}

#konvaStage {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.canvas-controls {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.canvas-controls button {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.canvas-controls button:hover {
    border-color: var(--brand-pink);
    color: var(--brand-pink);
}

.zoom-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.zoom-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

#zoomPercentage {
    color: var(--brand-pink);
    font-weight: 600;
}

#zoomSlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #e0e0e0 0%, var(--brand-pink) 100%);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

#zoomSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand-pink);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#zoomSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(255, 38, 158, 0.4);
}

#zoomSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand-pink);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#zoomSlider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(255, 38, 158, 0.4);
}

/* Giclee size sliders - brand purple */
#gicleeWidthSlider,
#gicleeHeightSlider {
    accent-color: var(--brand-purple);
}

/* View toggle buttons (guidelines, border guide) in right panel */
.view-toggles {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.view-toggle-btn {
    flex: 1;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn:hover {
    border-color: var(--brand-pink);
    color: var(--brand-pink);
}

/* Align Controls (transparent PNG positioning) */
.align-controls {
    margin-top: 12px;
}

.align-controls .zoom-label {
    margin-bottom: 8px;
}

.align-buttons {
    display: flex;
    gap: 6px;
}

.align-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 8px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.align-btn:hover {
    border-color: var(--brand-pink);
    color: var(--brand-pink);
}

.align-btn svg {
    flex-shrink: 0;
}

/* ========================================
   VALIDATION PANEL
   ======================================== */

.validation-section {
    margin-bottom: 24px;
}

.validation-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.validation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 14px;
}

.validation-item.pass {
    background: #d4edda;
    color: #155724;
}

.validation-item.warning {
    background: #fff3cd;
    color: #856404;
}

.validation-item.fail {
    background: #f8d7da;
    color: #721c24;
}

.validation-item.pending {
    background: #e7f3ff;
    color: #004085;
}

.validation-icon {
    font-size: 18px;
}

.design-info {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

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

.info-label {
    font-weight: 500;
    color: #666;
}

.dpi-disclaimer {
    margin: 16px 0 0 0;
    padding: 12px;
    background: #fff9e6;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    color: #856404;
}

.dpi-disclaimer strong {
    color: #664d03;
}

.orientation-hint {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* ========================================
   IMAGE LIBRARY PICKER
   ======================================== */

.image-picker-content {
    background: white;
    border-radius: 16px;
    max-width: 1000px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
}

.library-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.library-image-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.library-image-card:hover {
    border-color: var(--brand-pink);
    box-shadow: 0 4px 12px rgba(255, 38, 158, 0.2);
    transform: translateY(-2px);
}

.library-image-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f5f5f5;
}

.library-image-info {
    padding: 12px;
    text-align: center;
}

.library-image-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-image-dimensions {
    font-size: 12px;
    color: #999;
}

/* ========================================
   UPLOAD PROMPT OVERLAY
   ======================================== */

.upload-prompt {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: default;
}

.upload-prompt-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 380px;
    width: 90%;
}

.upload-prompt-icon {
    width: 40px;
    height: 40px;
    color: #bbb;
    margin-bottom: 10px;
}

.upload-prompt-content h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.upload-prompt-content p {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: #999;
}

.upload-options {
    display: flex;
    gap: 12px;
    width: 100%;
}

.upload-option-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.upload-option-library {
    border: 2px solid #e0e0e0;
    color: var(--brand-pink);
}

.upload-option-library:hover {
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 3px rgba(255, 38, 158, 0.1);
}

.upload-option-upload {
    border: 2px dashed #e0e0e0;
    color: var(--brand-purple);
}

.upload-option-upload:hover {
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(146, 78, 255, 0.1);
}

.upload-option-label {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

/* Upload progress indicator */
.upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 15;
}

.upload-progress-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--brand-pink);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.upload-progress-text {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

/* ========================================
   DESIGNER LOGIN MODAL
   ======================================== */

.designer-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.designer-login-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.designer-login-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 420px;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.designer-login-header {
    background: linear-gradient(135deg, var(--brand-pink) 0%, var(--brand-purple) 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

.designer-login-header h2 {
    margin: 0 0 6px 0;
    font-size: 22px;
    font-weight: 600;
}

.designer-login-header p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.designer-login-form {
    padding: 30px;
}

.designer-login-field {
    margin-bottom: 20px;
}

.designer-login-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.designer-login-field input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.designer-login-field input:focus {
    outline: none;
    border-color: var(--brand-pink);
}

.designer-login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.designer-login-footer {
    padding: 0 30px 24px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.designer-login-footer a {
    color: var(--brand-pink);
    text-decoration: none;
    font-weight: 500;
}

.designer-login-footer a:hover {
    text-decoration: underline;
}

.designer-login-content .modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    z-index: 1;
    line-height: 1;
}

.designer-login-content .modal-close:hover {
    color: white;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .designer-layout {
        grid-template-columns: 240px 1fr 280px;
    }
}

@media (max-width: 992px) {
    .designer-layout {
        grid-template-columns: 1fr;
    }

    .designer-sidebar,
    .designer-validation {
        display: none; /* Will need tabs for mobile */
    }
}

/* ========================================
   CENTRING CONFIRMATION MODAL
   Shown before Review & Approve when the artwork is off-centre.
   ======================================== */

.centring-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 32, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    padding: 1rem;
    animation: centringFade 0.18s ease;
}

@keyframes centringFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.centring-modal-card {
    background: #ffffff;
    border-radius: 18px;
    width: 100%;
    max-width: 460px;
    padding: 2.25rem 2rem 1.75rem;
    text-align: center;
    box-shadow: 0 24px 64px rgba(15, 18, 32, 0.28);
    animation: centringPop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes centringPop {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.centring-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 38, 158, 0.12), rgba(146, 78, 255, 0.12));
    color: #FF269E;
}

.centring-modal-icon svg {
    width: 34px;
    height: 34px;
}

.centring-modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2330;
    letter-spacing: -0.01em;
}

.centring-modal-body {
    margin: 0 0 1.5rem;
    color: #5a6072;
    font-size: 0.95rem;
    line-height: 1.5;
}

.centring-modal-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}

.centring-modal-btn {
    flex: 1 1 180px;
    min-width: 0;
    padding: 0.75rem 1.1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    border: 1.5px solid transparent;
    line-height: 1.2;
}

.centring-modal-btn:focus-visible {
    outline: 2px solid #FF269E;
    outline-offset: 2px;
}

.centring-modal-btn-secondary {
    background: #ffffff;
    color: #5a6072;
    border-color: #e3e6ee;
}

.centring-modal-btn-secondary:hover {
    color: #1f2330;
    border-color: #b8bdcc;
    background: #f6f7fb;
}

.centring-modal-btn-primary {
    background: linear-gradient(135deg, #FF269E 0%, #924EFF 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(255, 38, 158, 0.28);
}

.centring-modal-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(255, 38, 158, 0.36);
}

@media (max-width: 480px) {
    .centring-modal-card {
        padding: 1.75rem 1.25rem 1.25rem;
    }
    .centring-modal-actions {
        flex-direction: column-reverse;
    }
    .centring-modal-btn {
        width: 100%;
    }
}
