/**
 * Sticker Editor Modal Styles
 *
 * @package TLS_Configurator
 */

/* ===========================================
   MODAL OVERLAY
   =========================================== */

.tls-sticker-editor {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tls-editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

/* ===========================================
   DIALOG
   =========================================== */

.tls-editor-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    height: auto;
    max-height: calc(100vh - 80px);
    background: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: tls-editor-slide-in 0.3s ease-out;
}

@keyframes tls-editor-slide-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===========================================
   HEADER
   =========================================== */

.tls-editor-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    background: #242424;
    border-bottom: 1px solid #333;
    position: relative;
}

.tls-editor-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.02em;
}

.tls-editor-close {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #888;
    font-size: 20px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tls-editor-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

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

.tls-editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: hidden;
    background: #1a1a1a;
    min-height: 300px;
}

.tls-editor-canvas-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-height: calc(100% - 80px);
}

.tls-editor-canvas-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

/* Canvas container created by Fabric.js */
.tls-editor-canvas-wrapper .canvas-container {
    margin: 0 auto;
}

/* ===========================================
   DIMENSIONS LABEL
   =========================================== */

.tls-editor-dimensions {
    margin-top: 16px;
    font-size: 14px;
    color: #888;
    text-align: center;
}

.tls-editor-dimensions strong {
    color: #fff;
    font-weight: 600;
}

/* ===========================================
   CONTROLS (ZOOM / RESET)
   =========================================== */

.tls-editor-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    padding: 12px 20px;
    background: #242424;
    border-radius: 12px;
}

.tls-editor-reset {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid #444;
    border-radius: 8px;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tls-editor-reset:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #666;
    color: #fff;
}

.tls-editor-zoom {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tls-zoom-out,
.tls-zoom-in {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #444;
    border-radius: 8px;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tls-zoom-out:hover,
.tls-zoom-in:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #666;
    color: #fff;
}

.tls-editor-zoom input[type="range"] {
    width: 120px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.tls-editor-zoom input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #6b2d7b;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tls-editor-zoom input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.tls-editor-zoom input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #6b2d7b;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* ===========================================
   FOOTER
   =========================================== */

.tls-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #242424;
    border-top: 1px solid #333;
}

.tls-editor-skip {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tls-editor-skip:hover {
    color: #fff;
}

.tls-editor-save {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6b2d7b 0%, #8b3d9b 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tls-editor-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(107, 45, 123, 0.4);
}

.tls-editor-save:active {
    transform: translateY(0);
}

.tls-editor-save:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.tls-editor-save .tls-spinner {
    width: 18px;
    height: 18px;
    animation: tls-spin 1s linear infinite;
}

@keyframes tls-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===========================================
   LEGEND
   =========================================== */

.tls-editor-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    font-size: 12px;
    color: #666;
}

.tls-editor-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tls-editor-legend-line {
    width: 20px;
    height: 2px;
}

.tls-editor-legend-line.cutline {
    background: #6b2d7b;
}

.tls-editor-legend-line.bleed {
    background: repeating-linear-gradient(
        90deg,
        rgba(107, 45, 123, 0.4),
        rgba(107, 45, 123, 0.4) 3px,
        transparent 3px,
        transparent 6px
    );
}

.tls-editor-legend-line.safe {
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.3),
        rgba(255, 255, 255, 0.3) 2px,
        transparent 2px,
        transparent 5px
    );
}

/* ===========================================
   LOADING STATE
   =========================================== */

.tls-editor-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #888;
    font-size: 14px;
}

.tls-editor-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: #6b2d7b;
    border-radius: 50%;
    animation: tls-spin 0.8s linear infinite;
}

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

@media (max-width: 768px) {
    .tls-editor-dialog {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .tls-editor-header {
        padding: 14px 16px;
    }

    .tls-editor-header h2 {
        font-size: 15px;
    }

    .tls-editor-body {
        padding: 16px;
    }

    .tls-editor-controls {
        flex-wrap: wrap;
        gap: 12px;
        padding: 10px 16px;
    }

    .tls-editor-zoom input[type="range"] {
        width: 100px;
    }

    .tls-editor-footer {
        padding: 14px 16px;
    }

    .tls-editor-skip {
        padding: 10px 16px;
        font-size: 13px;
    }

    .tls-editor-save {
        padding: 10px 20px;
        font-size: 14px;
    }

    .tls-editor-legend {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .tls-editor-controls {
        flex-direction: column;
    }

    .tls-editor-zoom {
        width: 100%;
        justify-content: center;
    }

    .tls-editor-zoom input[type="range"] {
        flex: 1;
        max-width: 150px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .tls-editor-body {
        padding: 12px;
    }

    .tls-editor-controls {
        margin-top: 8px;
        padding: 8px 16px;
    }

    .tls-editor-dimensions {
        margin-top: 8px;
        font-size: 12px;
    }
}
