/* ================================================================
   T-Shirt Designer - Styles
   ================================================================ */

/* --- Open Button --- */
#tshirt-designer-open-btn {
    margin: 15px 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 24px;
    border-radius: 6px;
    background: #232f3e;
    border-color: #232f3e;
    transition: background .2s;
}
#tshirt-designer-open-btn:hover {
    background: #37475a;
    border-color: #37475a;
}

/* --- Modal Overlay --- */
.tshirt-designer-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.tshirt-designer-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 1100px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* --- Header --- */
.designer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}
.designer-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
}
.designer-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0 4px;
}
.designer-close:hover { color: #c0392b; }

/* --- Body Layout --- */
.designer-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* --- Sidebar --- */
.designer-sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid #e8e8e8;
    overflow-y: auto;
    padding: 16px;
    background: #fdfdfd;
}

.designer-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}
.designer-section:last-child { border-bottom: none; }
.designer-section h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    margin: 0 0 10px;
}

/* View Selector */
.view-selector {
    display: flex;
    gap: 6px;
}
.btn-view {
    flex: 1;
    padding: 6px;
    font-size: 13px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all .15s;
}
.btn-view.active {
    background: #232f3e;
    color: #fff;
    border-color: #232f3e;
}

/* Color Swatches */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: transform .15s, border-color .15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: #232f3e; box-shadow: 0 0 0 2px #232f3e40; }

/* Text Controls */
.text-controls { display: flex; flex-direction: column; gap: 8px; }
.text-options { display: flex; flex-direction: column; gap: 6px; }
.text-size-color { display: flex; gap: 6px; }
.text-size-color input[type="number"] { width: 70px; }
.text-size-color input[type="color"] { width: 42px; padding: 2px; height: 34px; }
.text-style-btns { display: flex; gap: 4px; }
.text-style-btns .btn {
    width: 32px; height: 32px;
    padding: 0; display: flex;
    align-items: center; justify-content: center;
    border: 1px solid #ccc; background: #fff;
    border-radius: 4px; cursor: pointer;
}
.text-style-btns .btn.active { background: #232f3e; color: #fff; border-color: #232f3e; }

#designer-add-text {
    background: #2ecc71;
    border-color: #2ecc71;
    color: #fff;
    font-weight: 600;
}
#designer-add-text:hover { background: #27ae60; }

/* Upload Area */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload-area:hover,
.upload-area.dragover {
    border-color: #3498db;
    background: #ecf5ff;
}
.upload-area p { margin: 0 0 4px; font-size: 13px; color: #555; }
.upload-area small { color: #999; font-size: 11px; }

/* Clipart Gallery */
.clipart-gallery { max-height: 200px; overflow-y: auto; }
.clipart-category h5 { font-size: 12px; color: #777; margin: 8px 0 4px; }
.clipart-items { display: flex; flex-wrap: wrap; gap: 6px; }
.clipart-item {
    width: 48px; height: 48px;
    object-fit: contain;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.clipart-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52,152,219,0.3);
}

/* Element Properties */
.prop-group { margin-bottom: 10px; }
.prop-group > label { font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; display: block; }
.prop-row { display: flex; align-items: center; gap: 4px; }
.prop-row label { font-size: 11px; color: #888; min-width: 14px; }
.prop-row input { width: 70px; }
.layer-btns { display: flex; gap: 4px; }
.layer-btns .btn { padding: 4px 10px; font-size: 14px; border: 1px solid #ccc; background: #fff; border-radius: 4px; cursor: pointer; }
.layer-btns .btn:hover { background: #f0f0f0; }
#prop-rotation { width: 100%; }
#prop-rotation-val { font-size: 12px; color: #888; }
#prop-delete { margin-top: 8px; width: 100%; }

/* --- Canvas Area --- */
.designer-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f4f4f4;
    min-width: 0;
    position: relative;
}

.canvas-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tshirt-mockup {
    position: relative;
    width: 420px;
    height: 504px;
}

#tshirt-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
}

/* Design zone overlays on the printable area of the shirt */
.design-zone {
    position: absolute;
    top: 100px;
    left: 115px;
    width: 190px;
    height: 250px;
    /* faint outline showing printable area */
    border: 1px dashed rgba(0,0,0,0.12);
    border-radius: 2px;
}

/* --- Photo-Based Mockup --- */
.mockup-photo-wrap {
    position: relative;
    width: 420px;
    height: 420px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.mockup-photo {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    pointer-events: none;
}

.mockup-color-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 2;
    mix-blend-mode: multiply;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s;
}

.mockup-color-overlay.active {
    opacity: 1;
}

.mockup-photo-wrap .design-zone {
    z-index: 3;
    /* Position will be set dynamically by JS from design zone data */
}

.design-zone canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Canvas Actions */
.canvas-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}
.canvas-actions .btn {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}
.canvas-actions .btn:hover { background: #f0f0f0; }

/* --- Footer --- */
.designer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-top: 1px solid #e8e8e8;
    background: #fafafa;
}
.design-price-info {
    font-size: 14px;
    color: #555;
}
.design-price-info strong { color: #c0392b; font-size: 16px; }
.designer-footer-actions { display: flex; gap: 8px; }
#designer-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    padding: 8px 24px;
}

/* --- Preview Thumbnail --- */
#tshirt-design-preview {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    display: inline-block;
}
#tshirt-design-preview h4 { margin: 0 0 8px; font-size: 14px; }
#tshirt-design-preview-img {
    max-width: 160px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* --- Loading Spinner --- */
.designer-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.designer-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #232f3e;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Responsive --- */
@media (max-width: 768px) {
    .designer-body {
        flex-direction: column;
    }
    .designer-sidebar {
        width: 100%;
        min-width: unset;
        max-height: 260px;
        border-right: none;
        border-bottom: 1px solid #e8e8e8;
    }
    .tshirt-mockup {
        width: 300px;
        height: 360px;
    }
    .design-zone {
        top: 72px;
        left: 82px;
        width: 136px;
        height: 178px;
    }
    .tshirt-designer-modal-content {
        max-height: 98vh;
    }
}
