/* =====================================================
   ATLETICA R8 Bradley Configurator
   Dark theme inspired by atletica.de
   ===================================================== */

:root {
    --atl-bg-primary: #1a1a1a;
    --atl-bg-secondary: #242424;
    --atl-bg-card: #2a2a2a;
    --atl-bg-hover: #333333;
    --atl-bg-input: #1e1e1e;
    --atl-border: #3a3a3a;
    --atl-border-light: #444444;
    --atl-text-primary: #ffffff;
    --atl-text-secondary: #b0b0b0;
    --atl-text-muted: #777777;
    --atl-accent: #c8a97e;        /* Gold/bronze accent */
    --atl-accent-hover: #d4b88e;
    --atl-green: #4ade80;
    --atl-red: #ef4444;
    --atl-blue: #60a5fa;
    --atl-radius: 8px;
    --atl-radius-lg: 12px;
    --atl-shadow: 0 4px 24px rgba(0,0,0,0.3);
    --atl-transition: all 0.2s ease;
    --atl-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--atl-font);
    background: var(--atl-bg-primary);
    color: var(--atl-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* =====================================================
   LAYOUT
   ===================================================== */
.atl-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}

.atl-header {
    background: var(--atl-bg-secondary);
    border-bottom: 1px solid var(--atl-border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.atl-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}

.atl-logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--atl-text-primary);
    text-decoration: none;
}

.atl-logo-sub {
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 1px;
    color: var(--atl-text-muted);
    display: block;
}

.atl-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.atl-nav a {
    color: var(--atl-text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--atl-transition);
}

.atl-nav a:hover {
    color: var(--atl-text-primary);
}

.atl-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--atl-text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--atl-transition);
}

.atl-back-link:hover {
    color: var(--atl-accent);
}

/* =====================================================
   MAIN CONFIGURATOR LAYOUT (Side by side)
   ===================================================== */
.atl-configurator {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 0;
    min-height: calc(100vh - 65px);
}

/* LEFT: 3D Viewer */
.atl-viewer-panel {
    position: relative;
    background: #111111;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.atl-viewer-container {
    width: 100%;
    height: 100%;
    min-height: 600px;
    position: relative;
}

#threekitPlayer {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

.atl-viewer-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--atl-text-muted);
    position: absolute;
    inset: 0;
    z-index: 1;
}

.atl-viewer-placeholder svg {
    width: 64px;
    height: 64px;
    opacity: 0.4;
}

.atl-viewer-placeholder p {
    font-size: 0.9rem;
}

.atl-viewer-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: var(--atl-radius);
    font-size: 0.75rem;
    color: var(--atl-text-secondary);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
}

.atl-viewer-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--atl-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* RIGHT: Configuration Panel */
.atl-config-panel {
    background: var(--atl-bg-secondary);
    border-left: 1px solid var(--atl-border);
    overflow-y: auto;
    max-height: calc(100vh - 65px);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Product Header */
.atl-product-header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--atl-border);
}

.atl-product-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 4px;
}

.atl-product-header .atl-subtitle {
    font-size: 0.85rem;
    color: var(--atl-text-muted);
    margin-bottom: 16px;
}

.atl-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--atl-text-primary);
}

.atl-price-label {
    font-size: 0.75rem;
    color: var(--atl-text-muted);
    font-weight: 400;
    margin-left: 6px;
}

.atl-availability {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--atl-green);
    margin-top: 8px;
}

.atl-availability .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* =====================================================
   ATTRIBUTE SECTIONS
   ===================================================== */
.atl-section {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--atl-border);
}

.atl-section:last-of-type {
    border-bottom: none;
}

.atl-section-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--atl-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.atl-section-label .atl-selected-value {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--atl-accent);
}

/* Button Group (Crossbar, etc.) */
.atl-button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.atl-button-group button {
    flex: 1 1 0%;
    min-width: 60px;
    padding: 12px 16px;
    background: var(--atl-bg-input);
    border: 2px solid var(--atl-border);
    border-radius: var(--atl-radius);
    color: var(--atl-text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--atl-font);
    cursor: pointer;
    transition: var(--atl-transition);
    text-align: center;
}

.atl-button-group button:hover {
    border-color: var(--atl-border-light);
    color: var(--atl-text-primary);
    background: var(--atl-bg-hover);
}

.atl-button-group button.active {
    border-color: var(--atl-accent);
    color: var(--atl-text-primary);
    background: rgba(200, 169, 126, 0.1);
}

/* Grid modifier — auto-applied by JS when options > 4 */
.atl-button-group--grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.atl-button-group--grid button {
    flex: none;
    min-width: 0;
    padding: 9px 8px;
    font-size: 0.8rem;
}

/* Compact button group — for position selectors with many small options */
.atl-button-group--compact {
    flex-wrap: wrap;
    gap: 4px;
}
.atl-button-group--compact button {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.72rem;
    min-width: 0;
}

/* Smith Position sub-row inside toggle area */
.atl-smith-position-row {
    padding: 8px 12px 12px;
    margin: -4px 0 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 0 0 var(--atl-radius) var(--atl-radius);
    border: 1px solid var(--atl-border);
    border-top: none;
}

/* Color Swatches */
.atl-color-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.atl-swatch {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--atl-transition);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atl-swatch:hover {
    transform: scale(1.1);
}

.atl-swatch.active {
    border-color: var(--atl-accent);
    box-shadow: 0 0 0 2px var(--atl-bg-secondary), 0 0 0 4px var(--atl-accent);
}

.atl-swatch-inner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.atl-swatch-inner.has-border {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}

.atl-swatch-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--atl-text-muted);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.atl-swatch:hover .atl-swatch-label,
.atl-swatch.active .atl-swatch-label {
    opacity: 1;
}

/* Toggle Cards (Attachments) */
.atl-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.atl-toggle-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--atl-bg-input);
    border: 2px solid var(--atl-border);
    border-radius: var(--atl-radius);
    cursor: pointer;
    transition: var(--atl-transition);
    user-select: none;
}

.atl-toggle-card:hover {
    border-color: var(--atl-border-light);
    background: var(--atl-bg-hover);
}

.atl-toggle-card.active {
    border-color: var(--atl-accent);
    background: rgba(200, 169, 126, 0.08);
}

.atl-toggle-card.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.atl-toggle-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.atl-toggle-icon svg {
    width: 22px;
    height: 22px;
    color: var(--atl-text-secondary);
}

.atl-toggle-card.active .atl-toggle-icon svg {
    color: var(--atl-accent);
}

.atl-toggle-info {
    flex: 1;
}

.atl-toggle-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.atl-toggle-info p {
    font-size: 0.75rem;
    color: var(--atl-text-muted);
    line-height: 1.4;
}

.atl-toggle-switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--atl-border);
    position: relative;
    flex-shrink: 0;
    transition: var(--atl-transition);
}

.atl-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--atl-text-secondary);
    transition: var(--atl-transition);
}

.atl-toggle-card.active .atl-toggle-switch {
    background: var(--atl-accent);
}

.atl-toggle-card.active .atl-toggle-switch::after {
    left: 23px;
    background: var(--atl-text-primary);
}

.atl-conflict-msg {
    font-size: 0.75rem;
    color: var(--atl-red);
    margin-top: 4px;
    display: none;
}

.atl-conflict-msg.visible {
    display: block;
}

/* =====================================================
   SUMMARY / CTA
   ===================================================== */
.atl-summary {
    background: var(--atl-bg-card);
    border-radius: var(--atl-radius-lg);
    padding: 20px;
    margin-top: auto;
}

.atl-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.85rem;
}

.atl-summary-row .label {
    color: var(--atl-text-muted);
}

.atl-summary-row .value {
    color: var(--atl-text-primary);
    font-weight: 500;
}

.atl-summary-divider {
    height: 1px;
    background: var(--atl-border);
    margin: 10px 0;
}

.atl-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 0;
}

.atl-summary-total .label {
    font-size: 0.9rem;
    font-weight: 600;
}

.atl-summary-total .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--atl-accent);
}

.atl-cta-btn {
    width: 100%;
    padding: 16px;
    background: var(--atl-accent);
    color: #1a1a1a;
    border: none;
    border-radius: var(--atl-radius);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--atl-font);
    cursor: pointer;
    transition: var(--atl-transition);
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.atl-cta-btn:hover {
    background: var(--atl-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(200, 169, 126, 0.3);
}

/* =====================================================
   SPECS SECTION (below configurator)
   ===================================================== */
.atl-specs-section {
    padding: 60px 0;
    border-top: 1px solid var(--atl-border);
}

.atl-specs-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.atl-specs-section .atl-specs-sub {
    font-size: 0.9rem;
    color: var(--atl-text-muted);
    text-align: center;
    margin-bottom: 40px;
}

.atl-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.atl-spec-card {
    background: var(--atl-bg-card);
    border: 1px solid var(--atl-border);
    border-radius: var(--atl-radius-lg);
    padding: 24px;
}

.atl-spec-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--atl-accent);
    margin-bottom: 16px;
}

.atl-spec-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
}

.atl-spec-row:last-child {
    border-bottom: none;
}

.atl-spec-row .spec-label {
    color: var(--atl-text-muted);
}

.atl-spec-row .spec-value {
    color: var(--atl-text-primary);
    font-weight: 500;
    text-align: right;
}

/* =====================================================
   FOOTER
   ===================================================== */
.atl-footer {
    background: var(--atl-bg-secondary);
    border-top: 1px solid var(--atl-border);
    padding: 32px 0;
    text-align: center;
}

.atl-footer p {
    color: var(--atl-text-muted);
    font-size: 0.8rem;
}

.atl-footer a {
    color: var(--atl-accent);
    text-decoration: none;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .atl-configurator {
        grid-template-columns: 1fr;
    }

    .atl-config-panel {
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--atl-border);
    }

    .atl-viewer-container {
        min-height: 400px;
    }

    #threekitPlayer {
        min-height: 400px;
    }
}

@media (max-width: 640px) {
    .atl-header-inner {
        flex-direction: column;
        gap: 12px;
    }

    .atl-config-panel {
        padding: 24px 16px;
    }

    .atl-button-group {
        flex-direction: column;
    }
    .atl-button-group--compact {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .atl-color-swatches {
        gap: 8px;
    }

    .atl-specs-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   LOADING & ANIMATIONS
   ===================================================== */
.atl-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--atl-border);
    border-top-color: var(--atl-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.atl-fade-in {
    animation: fadeIn 0.3s ease;
}

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

/* Toast Notification */
.atl-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--atl-bg-card);
    border: 1px solid var(--atl-border);
    border-radius: var(--atl-radius);
    padding: 14px 20px;
    color: var(--atl-text-primary);
    font-size: 0.85rem;
    box-shadow: var(--atl-shadow);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.atl-toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.atl-toast.warning {
    border-color: var(--atl-red);
}

/* =====================================================
   STEPPER CONTROLS (Weight Stack / Plate Loaded amounts)
   ===================================================== */
.atl-stepper-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--atl-bg-input);
    border: 2px solid var(--atl-border);
    border-radius: var(--atl-radius);
    margin-bottom: 10px;
}

.atl-stepper-card:last-child {
    margin-bottom: 0;
}

.atl-stepper-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.atl-stepper-icon svg {
    width: 22px;
    height: 22px;
    color: var(--atl-text-secondary);
}

.atl-stepper-info {
    flex: 1;
}

.atl-stepper-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.atl-stepper-info p {
    font-size: 0.75rem;
    color: var(--atl-text-muted);
    line-height: 1.4;
}

.atl-stepper-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.atl-stepper-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--atl-border);
    background: var(--atl-bg-secondary);
    color: var(--atl-text-primary);
    font-size: 1.2rem;
    font-family: var(--atl-font);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--atl-transition);
    line-height: 1;
}

.atl-stepper-btn:hover {
    background: var(--atl-bg-hover);
    border-color: var(--atl-accent);
}

.atl-stepper-btn:active {
    transform: scale(0.95);
}

.atl-stepper-value {
    width: 40px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--atl-accent);
}

.atl-stepper-card.has-value {
    border-color: var(--atl-accent);
    background: rgba(200, 169, 126, 0.08);
}

.atl-stepper-card.has-value .atl-stepper-icon svg {
    color: var(--atl-accent);
}

/* Section hint text */
.atl-section-hint {
    font-size: 0.75rem;
    color: var(--atl-text-muted);
    margin-top: 8px;
}

.atl-smith-pos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.atl-smith-pos-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--atl-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.atl-smith-pos-value {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--atl-accent);
    letter-spacing: 0;
}

/* Generic position sub-row (used by weight stacks, plate loaded, spotter arms, j-hooks) */
.atl-position-row {
    padding: 8px 12px 12px;
    margin: -4px 0 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 0 0 var(--atl-radius) var(--atl-radius);
    border: 1px solid var(--atl-border);
    border-top: none;
}
.atl-position-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.atl-position-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--atl-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.atl-position-value {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--atl-accent);
    letter-spacing: 0;
}

