/**
 * Customizer Styles
 */

.customizer-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

@media (max-width: 1024px) {
    .customizer-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Preview Area */
.customizer-preview {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.preview-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-primary {
    grid-column: 1 / -1;
}

.preview-canvas {
    width: 100%;
    aspect-ratio: 3/2;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
}

/* Combined view - full width */
#customizer-canvas-combined {
    aspect-ratio: 10/7;
    max-height: 700px;
}

/* SVG Preview Container with Mockup - 3 Part Split */
.svg-preview-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* Base Area - Full Design */
.base-area-preview {
    background: url('/pressa/images/mockup-mug.png') no-repeat center center;
    background-size: contain;
    border-radius: 8px;
    padding: 0;
    position: relative;
    aspect-ratio: 1189/750;
}

.base-area-preview svg {
    position: absolute;
    display: block;
    overflow: hidden;
    object-fit: fill !important;
    /* Default values - will be overridden by inline styles */
    top: 7.7%;
    left: 3.1%;
    width: 92.1%;
    height: 41.2%;
}

/* Mug Previews - 3 Parts */
.mug-previews-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.mug-preview-item {
    position: relative;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mug-preview-item h4 {
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.mug-preview-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1.2;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Single mug mockup background for each preview */
.mug-preview-wrapper::before {
    content: '';
    position: absolute;
    width: 80%;
    height: 90%;
    background: linear-gradient(135deg, #e5e7eb 0%, #f3f4f6 100%);
    border-radius: 8px;
    z-index: 1;
    pointer-events: none;
    border: 2px solid #d1d5db;
}

.mug-preview-wrapper > div {
    position: relative;
    width: 70%;
    height: 85%;
    z-index: 0;
}

.mug-preview-wrapper svg {
    position: absolute;
    display: block;
    overflow: visible;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Responsive */
@media (max-width: 768px) {
    .mug-previews-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Ensure SVG respects viewBox and doesn't overflow */
.svg-preview-container svg text,
.svg-preview-container svg tspan {
    overflow: visible;
}

.preview-canvas canvas {
    width: 100% !important;
    height: auto !important;
}

.preview-label {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Controls Area */
.customizer-controls {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 800px;
}

.controls-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: white;
}

.tab-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

.controls-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Control Sections */
.control-section {
    margin-bottom: 1.5rem;
}

.control-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.control-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.control-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Part Grid */
.part-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.part-option {
    aspect-ratio: 1;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.part-option:hover {
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.part-option.active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.part-option img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.part-name {
    font-size: 0.625rem;
    color: #6b7280;
    margin-top: 0.25rem;
    text-align: center;
    line-height: 1.2;
}

/* Color Options */
.color-option {
    position: relative;
}

.color-check {
    display: none;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.color-option.active .color-check {
    display: block;
}

/* Background Grid */
.bg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.bg-option {
    aspect-ratio: 4/3;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    padding: 0;
}

.bg-option:hover {
    border-color: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.bg-option.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.bg-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Actions */
.customizer-actions {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    background: #f9fafb;
}

.btn-reset,
.btn-add-cart {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-reset {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-reset:hover {
    background: #f3f4f6;
    color: #111827;
}

.btn-add-cart {
    background: #2563eb;
    color: white;
}

.btn-add-cart:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-reset .material-symbols-outlined,
.btn-add-cart .material-symbols-outlined {
    font-size: 1.125rem;
}

/* Loading State */
.customizer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: #6b7280;
}

.customizer-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error State */
.customizer-error {
    padding: 2rem;
    text-align: center;
    color: #dc2626;
}

/* Scrollbar */
.controls-content::-webkit-scrollbar {
    width: 6px;
}

.controls-content::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.controls-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.controls-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========================================
   Dynamic Field Controls
   ======================================== */

.field-controls-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    column-gap: 0.75rem;
}

/* Mobile: tek sütun */
@media (max-width: 640px) {
    .field-controls-container {
        grid-template-columns: 1fr;
    }
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field-label {
    font-weight: 500;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1;
    display: block;
}

.field-input {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.8125rem;
    line-height: 1.3;
    transition: all 0.15s;
}

.field-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.06);
}

/* Color Palette Grid - Ultra Compact */
.color-palette-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

.color-swatch.active {
    border-color: #10b981;
    box-shadow: 0 0 0 1px white, 0 0 0 2px #10b981;
    transform: scale(1.05);
}

.color-swatch .color-check {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.875rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.12s;
}

.color-swatch.active .color-check {
    opacity: 1;
}

/* Color Picker - Ultra Compact */
.field-color-picker {
    width: 100%;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.field-color-picker:hover {
    border-color: #10b981;
}

/* Part Selector Grid */
.part-selector-grid,
.background-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

/* ========================================
   No-Tabs Layout (Sections)
   ======================================== */

.controls-content.no-tabs {
    padding: 0;
}

.field-sections-container {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.field-section {
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid #e5e7eb;
}

.section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Placeholder for upcoming features - Ultra Compact */
.part-selector-placeholder {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px dashed #d1d5db;
    border-radius: 4px;
    padding: 0.5rem;
    text-align: center;
}

.placeholder-text {
    color: #9ca3af;
    font-size: 0.6875rem;
    font-weight: 500;
    margin: 0;
    line-height: 1;
}

/* Improved field group spacing - Ultra Compact */
.field-controls-container .field-group {
    margin-bottom: 0;
}

.field-controls-container .field-group + .field-group {
    margin-top: 0.5rem;
}

/* Better text input styling */
.field-input {
    font-family: inherit;
    background: #f9fafb;
    transition: all 0.3s ease;
}

.field-input:hover {
    background: #ffffff;
    border-color: #d1d5db;
}

.field-input:focus {
    background: #ffffff;
}

/* Remove duplicate color-palette-grid styling */

/* Better section spacing */
.field-section:first-child {
    margin-top: 0;
}

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