/* 
 * SKU Foundry CSS 
 * Matches Cockpit "Modern Soft" aesthetic 
 */

#tab-sku-foundry-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 2rem;
}

/* Header & Intro */
.sf-header-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.sf-gradient-text {
    background: linear-gradient(to right, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text;
    color: transparent;
}

/* Workflow Stepper */
.sf-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.sf-stepper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--line-subtle);
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 2px;
}

.sf-stepper-progress {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    background: linear-gradient(to right, #6366f1, #a855f7);
    transform: translateY(-50%);
    z-index: 2;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.sf-step {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.sf-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 3px solid var(--line-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.3s;
}

.sf-step.active .sf-step-circle {
    border-color: #6366f1;
    color: #fff;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    transform: scale(1.1);
}

.sf-step.completed .sf-step-circle {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.sf-step-label {
    position: absolute;
    top: 50px;
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.3s;
}

.sf-step.active .sf-step-label {
    color: #a855f7;
}

/* Views */
.sf-view {
    display: none;
    animation: sfFadeIn 0.3s ease;
}

.sf-view.active {
    display: block;
}

@keyframes sfFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Asset Grid */
.sf-asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.sf-asset-item {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--line-subtle);
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sf-asset-item:hover {
    border-color: var(--text-muted);
}

.sf-asset-item.selected {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.sf-asset-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sf-asset-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.sf-asset-item:hover .sf-asset-remove {
    display: flex;
}

.sf-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #6366f1;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Studio Canvas */
.sf-canvas-container {
    position: relative;
    width: 100%;
    height: 500px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-subtle);
}

.sf-canvas-product {
    width: 80%;
    height: 80%;
    object-fit: contain;
    pointer-events: none;
}

.sf-placed-layer {
    position: absolute;
    cursor: move;
    z-index: 10;
}

.sf-placed-layer:hover::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px dashed rgba(99, 102, 241, 0.5);
    border-radius: 4px;
    pointer-events: none;
}

.sf-layer-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.sf-layer-remove {
    position: absolute;
    top: -12px;
    right: -12px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.sf-placed-layer:hover .sf-layer-remove {
    display: flex;
}

/* Upload Area */
.sf-upload-area {
    border: 2px dashed var(--line-subtle);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.02);
}

.sf-upload-area:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

/* Loading Overlay */
.sf-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    display: none;
}

.sf-loading-overlay.active {
    display: flex;
}

.sf-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: sfSpin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes sfSpin { 100% { transform: rotate(360deg); } }

/* Gallery */
.sf-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.sf-gallery-card {
    background: var(--bg-surface);
    border: 1px solid var(--line-subtle);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
}

.sf-gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.sf-gallery-card:hover img {
    transform: scale(1.05);
}

.sf-gallery-actions {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.sf-gallery-card:hover .sf-gallery-actions {
    opacity: 1;
}
