/**
 * Designer CSS - TeamShirtsPrint
 * Professional Multi-Position Designer Interface
 * Version: 6.1 - Mit Lucide Icons Support
 */

/* ============================================================================
   LUCIDE ICONS
   ============================================================================ */
[data-lucide] {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    flex-shrink: 0;
}

.sidebar-title [data-lucide] {
    color: #3b82f6;
}

.btn-icon [data-lucide] {
    width: 18px;
    height: 18px;
}

.quantity-hint [data-lucide] {
    width: 16px;
    height: 16px;
    color: #3b82f6;
}

/* ============================================================================
   MAIN LAYOUT - 3 Column Grid
   ============================================================================ */
.designer-main {
    display: grid;
    grid-template-columns: 320px 1fr 380px;
    height: calc(100vh - 80px);
    background: #f8f9fa;
    gap: 0;
    margin: 0;
    padding: 0;
}

/* ============================================================================
   SIDEBARS - Left & Right
   ============================================================================ */
.designer-sidebar {
    background: #ffffff;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

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

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-content {
    padding: 20px;
    flex: 1;
}

/* ============================================================================
   TOOL GROUPS
   ============================================================================ */
.tool-group {
    margin-bottom: 24px;
}

.tool-btn {
    width: 100%;
    padding: 14px 16px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #1a202c;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.tool-btn:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
    color: #3b82f6;
}

.tool-btn:hover [data-lucide] {
    color: #3b82f6;
}

.tool-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
}

.tool-btn-primary [data-lucide] {
    color: white;
}

.tool-btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #2563eb;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tool-btn-primary:hover [data-lucide] {
    color: white;
}

.tool-btn-secondary {
    background: #ffffff;
}

.tool-btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}

.tool-btn-danger [data-lucide] {
    color: #ef4444;
}

.tool-btn-danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

.tool-btn-danger:hover [data-lucide] {
    color: #dc2626;
}

/* ============================================================================
   TOOL OPTIONS
   ============================================================================ */
.tool-options {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Icon Color Options Styling */
#iconColorOptions {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

#iconColorOptions .option-group:last-child {
    margin-bottom: 0;
}

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

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 8px;
}

.option-group select,
.option-group input[type="text"],
.option-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.2s;
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.option-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.option-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    transition: all 0.2s;
}

.option-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.option-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: 8px;
}

.btn-icon {
    flex: 1;
    padding: 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
}

.btn-icon:hover [data-lucide] {
    color: #3b82f6;
}

.tool-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 8px;
}

/* ============================================================================
   CANVAS AREA - Center Column
   ============================================================================ */
.designer-canvas-area {
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
    height: 100%;
    overflow: hidden;
}

/* Canvas Header */
.canvas-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.product-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-selector label {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    white-space: nowrap;
}

.product-selector select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
    background: white;
}

/* Position Tabs */
.position-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.position-tab {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.position-tab:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.position-tab.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    color: white;
}

.position-cost {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.8;
}

.position-tab.active .position-cost {
    opacity: 1;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    min-height: 0;
}

.canvas-wrapper {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 100%;
    max-height: 100%;
}

#designCanvas {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.canvas-info {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.canvas-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

/* Canvas Footer */
.canvas-footer {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.canvas-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-canvas-action {
    padding: 8px 16px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-canvas-action:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
    color: #3b82f6;
}

.btn-canvas-action:hover [data-lucide] {
    color: #3b82f6;
}

.zoom-level {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    padding: 0 8px;
}

/* ============================================================================
   RIGHT SIDEBAR - Configuration
   ============================================================================ */
.config-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.config-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 16px 0;
}

/* Product Info */
.product-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.product-image {
    width: 80px;
    height: 80px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-details {
    flex: 1;
}

.product-details h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 4px 0;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #3b82f6;
    margin: 0;
}

/* Variant Selection */
.variant-group {
    margin-bottom: 16px;
}

.variant-group:last-child {
    margin-bottom: 0;
}

.variant-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 8px;
}

.variant-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.color-option:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.color-option.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* Quantity Selector */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.quantity-selector button {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-selector button:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
}

.quantity-selector button:hover [data-lucide] {
    color: #3b82f6;
}

.quantity-selector input {
    flex: 1;
    text-align: center;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
}

.quantity-hint {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

/* Positions Summary */
.positions-summary {
    font-size: 13px;
}

.no-positions {
    color: #9ca3af;
    text-align: center;
    padding: 20px;
    margin: 0;
}

.position-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.position-item:last-child {
    margin-bottom: 0;
}

.position-item-name {
    font-weight: 500;
    color: #1a202c;
}

.position-item-price {
    font-weight: 600;
    color: #3b82f6;
}

/* Price Breakdown */
.price-breakdown {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #4b5563;
}

.price-row-discount {
    color: #10b981;
}

.price-row.price-total {
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
    padding-top: 12px;
}

.price-divider {
    height: 1px;
    background: #d1d5db;
    margin: 12px 0;
}

.discount {
    color: #10b981;
    font-weight: 600;
}

/* Action Buttons */
.btn-designer-primary,
.btn-designer-secondary {
    width: 100%;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.btn-designer-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
}

.btn-designer-primary [data-lucide] {
    color: white;
}

.btn-designer-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-designer-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-designer-secondary {
    background: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    margin-bottom: 0;
}

.btn-designer-secondary [data-lucide] {
    color: #3b82f6;
}

.btn-designer-secondary:hover {
    background: #f0f7ff;
    border-color: #2563eb;
    color: #2563eb;
}

.btn-designer-secondary:hover [data-lucide] {
    color: #2563eb;
}

/* ============================================================================
   MODALS
   ============================================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    max-height: 80vh;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1a202c;
}

.modal-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Clipart Grid */
.clipart-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    background: #e5e7eb;
}

.category-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.clipart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.clipart-item {
    aspect-ratio: 1;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    overflow: hidden;
}

.clipart-item:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.clipart-item [data-lucide] {
    flex-shrink: 0;
}

.clipart-name {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
    line-height: 1.2;
}

.clipart-item:hover .clipart-name {
    color: #3b82f6;
}

.clipart-item img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

/* Help Modal */
.help-section {
    margin-bottom: 24px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 12px 0;
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-list li {
    padding: 8px 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
}

.help-list kbd {
    display: inline-block;
    padding: 4px 8px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    font-weight: 600;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1400px) {
    .designer-main {
        grid-template-columns: 280px 1fr 340px;
    }
}

@media (max-width: 1200px) {
    .designer-main {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .designer-sidebar {
        height: auto;
        max-height: none;
    }
    
    .canvas-container {
        min-height: 60vh;
    }
}
