/* Konfigurator 3D - WordPress Plugin Styles */
/* CUBEWELD Industrial Design Theme — cubeweld.com */

.konfigurator-wrapper,
.konfigurator-wrapper * {
    font-family: 'Gabarito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.konfigurator-wrapper {
    font-family: 'Gabarito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--kfg-text, #e8e8e8);
    line-height: 1.6;
    box-sizing: border-box;
    background: var(--kfg-bg, #25282c);
    border-radius: 12px;
    overflow: hidden;
    /* Override WordPress block theme content-size constraint */
    --wp--style--global--content-size: none;
    width: 100%;
    max-width: 100%;
}

.konfigurator-wrapper *,
.konfigurator-wrapper *::before,
.konfigurator-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ========================================
   HEADER
   ======================================== */
.konfigurator-header {
    background: #1a1a1a;
    padding: 0.4rem 0.8rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-radius: 12px 12px 0 0;
    z-index: 100;
    border-bottom: 2px solid #ff901e;
}

.konfigurator-controls {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

/* Button group — removes inner border-radius between adjacent buttons */
.konfigurator-btn-group {
    display: inline-flex;
    gap: 0;
}
.konfigurator-btn-group .konfigurator-btn {
    border-radius: 0;
}
.konfigurator-btn-group .konfigurator-btn:first-child {
    border-radius: 4px 0 0 4px;
}
.konfigurator-btn-group .konfigurator-btn:last-child {
    border-radius: 0 4px 4px 0;
}
.konfigurator-btn-group .konfigurator-btn + .konfigurator-btn {
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

/* ========================================
   BUTTONS
   ======================================== */
.konfigurator-btn {
    padding: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s ease;
    font-size: 0.78rem;
    line-height: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.konfigurator-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.konfigurator-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
}

.konfigurator-btn-primary {
    background: var(--kfg-primary, #ff901e);
    color: white;
}

.konfigurator-btn-primary:hover {
    background: #e07d18;
}

.konfigurator-btn-secondary {
    background: #2d2d2d;
    color: #ccc;
    border: 1px solid #444;
}

.konfigurator-btn-secondary:hover {
    background: #383838;
    color: #e8e8e8;
}

.konfigurator-btn-danger {
    background: #c0392b;
    color: white;
}

.konfigurator-btn-danger:hover {
    background: #a93226;
}

.konfigurator-btn-cart {
    background: var(--kfg-primary, #ff901e);
    color: white;
    font-weight: 700;
}

.konfigurator-btn-cart:hover {
    background: #e07d18;
}

.konfigurator-btn-icon {
    background: transparent;
    color: #888;
    padding: 0.3rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: none;
    letter-spacing: 0;
}

.konfigurator-btn-icon:hover {
    background: rgba(255, 144, 30, 0.15);
    color: #ff901e;
    transform: none;
    box-shadow: none;
}

.konfigurator-btn-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.konfigurator-btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
}

/* ========================================
   HELP POPUP
   ======================================== */
.konfigurator-help-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
}

.konfigurator-help-popup-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-top: 3px solid #ff901e;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    position: relative;
}

.konfigurator-help-popup-content h3 {
    color: #ff901e;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.konfigurator-help-close {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #555;
    line-height: 1;
    padding: 0.2rem;
}

.konfigurator-help-close:hover {
    color: #e8e8e8;
}

.konfigurator-help-item {
    font-size: 0.88rem;
    color: #aaa;
    padding: 0.38rem 0;
    border-bottom: 1px solid #252525;
}

.konfigurator-help-item:last-child {
    border-bottom: none;
}

.konfigurator-help-item strong {
    color: #ff901e;
    font-weight: 600;
    min-width: 115px;
    display: inline-block;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */
.konfigurator-main-container {
    display: flex;
    height: var(--konfigurator-height, 85vh);
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--kfg-bg, #25282c);
    border-radius: 0 0 12px 12px;
}

/* ========================================
   VIEWPORT
   ======================================== */
.konfigurator-viewport-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.konfigurator-viewport {
    flex: 1;
    background: #1e1e1e;
    border-radius: 8px;
    box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    border: 1px solid #2d2d2d;
    min-height: 300px;
}

.konfigurator-viewport canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.konfigurator-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.konfigurator-loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #2d2d2d;
    border-top: 2px solid #ff901e;
    border-radius: 50%;
    animation: konfigurator-spin 1s linear infinite;
}

@keyframes konfigurator-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   CAD-STYLE CAMERA TOOLBAR (top-right inside viewport)
   ======================================== */
.konfigurator-cam-toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(18, 18, 18, 0.92);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid #2d2d2d;
    z-index: 10;
}

.konfigurator-cam-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
    transition: all 0.15s ease;
}

.konfigurator-cam-btn:hover {
    background: #ff901e;
    color: white;
}

.konfigurator-cam-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.konfigurator-cam-separator {
    height: 1px;
    background: #2d2d2d;
    margin: 2px 4px;
}

.konfigurator-cam-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    transition: all 0.15s ease;
}

.konfigurator-cam-toggle input {
    display: none;
}

.konfigurator-cam-toggle input:checked + .dashicons {
    color: #ff901e;
}

.konfigurator-cam-toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.konfigurator-cam-toggle:hover {
    background: rgba(255, 144, 30, 0.12);
}

/* ========================================
   STATS OVERLAY (bottom-left inside viewport)
   ======================================== */
.konfigurator-stats-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(18, 18, 18, 0.88);
    backdrop-filter: blur(8px);
    padding: 0.28rem 0.7rem;
    border-radius: 4px;
    font-size: 0.78rem;
    color: #bbb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid #2d2d2d;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.konfigurator-stats-sep {
    color: #444;
}

/* ========================================
   PALETTE CONTAINER (sidebar)
   ======================================== */
.konfigurator-palette-container {
    flex: 0 0 28%;
    max-width: 320px;
    background: #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.konfigurator-palette-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #2d2d2d;
    background: #141414;
}

.konfigurator-palette-header h2 {
    color: #ffffff;
    margin-bottom: 0.55rem;
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.konfigurator-search-container {
    position: relative;
}

.konfigurator-search-input {
    width: 100%;
    padding: 0.42rem 0.7rem;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: #252525;
    color: #e8e8e8;
}

.konfigurator-search-input::placeholder {
    color: #555;
}

.konfigurator-search-input:focus {
    outline: none;
    border-color: #ff901e;
    box-shadow: 0 0 0 2px rgba(255, 144, 30, 0.12);
}

/* ========================================
   CATEGORIES
   ======================================== */
.konfigurator-categories {
    display: flex;
    padding: 0.5rem 0.75rem;
    gap: 0.3rem;
    border-bottom: 1px solid #2d2d2d;
    flex-wrap: wrap;
    background: #141414;
}

.konfigurator-category-btn {
    padding: 0.18rem 0.55rem;
    border: 1px solid #333;
    background: #1e1e1e;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.5;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.konfigurator-category-btn:hover,
.konfigurator-category-btn.active {
    background: #ff901e;
    color: white;
    border-color: #ff901e;
}

/* ========================================
   BRICK LIST (product items)
   ======================================== */
.konfigurator-brick-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.6rem;
    background: #1a1a1a;
}

.konfigurator-brick-item {
    display: flex;
    align-items: center;
    padding: 0.45rem;
    margin-bottom: 0.25rem;
    background: #222222;
    border-radius: 5px;
    cursor: grab;
    transition: all 0.15s ease;
    border: 1px solid #2a2a2a;
    position: relative;
    gap: 0.5rem;
}

.konfigurator-brick-item:hover {
    background: #2a2a2a;
    border-color: #ff901e;
    transform: translateX(3px);
}

.konfigurator-brick-item:active {
    cursor: grabbing;
}

.konfigurator-brick-item.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

/* Product thumbnail in list */
.konfigurator-brick-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #2a2a2a;
}

/* Color swatch fallback when no thumbnail */
.konfigurator-brick-preview {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.08);
}

.konfigurator-brick-info {
    flex: 1;
    min-width: 0;
}

.konfigurator-brick-name {
    font-weight: 600;
    color: #ddd;
    margin-bottom: 0.1rem;
    font-size: 0.77rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.konfigurator-brick-dimensions {
    font-size: 0.67rem;
    color: #666;
}

/* Attachment badge on brick item */
.konfigurator-brick-attach-badge {
    font-size: 0.6rem;
    padding: 1px 4px;
    background: rgba(255, 144, 30, 0.12);
    border: 1px solid rgba(255, 144, 30, 0.25);
    border-radius: 2px;
    color: #ff901e;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Product tooltip (shows on hover over product in list) */
.konfigurator-brick-item .konfigurator-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #e0e0e0;
    border: 1px solid #2d2d2d;
    border-top: 2px solid #ff901e;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.74rem;
    line-height: 1.5;
    white-space: normal;
    min-width: 200px;
    max-width: 280px;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.konfigurator-brick-item .konfigurator-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2d2d2d;
}

.konfigurator-brick-item:hover .konfigurator-tooltip {
    display: block;
}

.konfigurator-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.konfigurator-tooltip-label {
    opacity: 0.55;
    color: #aaa;
}

/* Attachment info in tooltip */
.konfigurator-tooltip-attach {
    margin-top: 5px;
    padding: 3px 6px;
    background: rgba(255, 144, 30, 0.1);
    border: 1px solid rgba(255, 144, 30, 0.25);
    border-radius: 3px;
    font-size: 0.67rem;
    color: #ff901e;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Price display */
.konfigurator-price {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff901e;
    color: white;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: bold;
}

/* ========================================
   USED BRICKS
   ======================================== */
.konfigurator-used-bricks {
    border-top: 1px solid #2d2d2d;
    padding: 0.7rem;
    max-height: 220px;
    overflow-y: auto;
    background: #141414;
}

.konfigurator-used-bricks h3 {
    color: #777;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.konfigurator-used-bricks-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.konfigurator-used-brick-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.28rem 0.5rem;
    background: #1e1e1e;
    border-radius: 4px;
    font-size: 0.72rem;
    border: 1px solid #252525;
}

.konfigurator-used-brick-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #bbb;
}

.konfigurator-used-brick-count {
    font-weight: 600;
    color: #ff901e;
    white-space: nowrap;
    margin-left: 0.5rem;
}

/* Total price */
.konfigurator-total-price {
    margin-top: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: rgba(255, 144, 30, 0.06);
    border-radius: 4px;
    border: 1px solid rgba(255, 144, 30, 0.25);
    text-align: center;
}

.konfigurator-total-price h4 {
    color: #999;
    font-size: 0.8rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.konfigurator-total-price span {
    color: #ff901e;
    font-weight: 700;
    font-size: 1.05rem;
}

/* ========================================
   VALIDATION MESSAGES
   ======================================== */
.konfigurator-validation-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10020;
    max-width: 300px;
}

.konfigurator-validation-message {
    background: #c0392b;
    color: white;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.3rem;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    animation: konfigurator-slideIn 0.3s ease;
    font-size: 0.84rem;
    font-family: 'Gabarito', sans-serif;
    border-left: 3px solid rgba(255,255,255,0.3);
}

.konfigurator-validation-message.success { background: #1e8449; border-left-color: #27ae60; }
.konfigurator-validation-message.warning { background: #d68910; color: white; border-left-color: #f39c12; }
.konfigurator-validation-message.info { background: #1a5276; border-left-color: #2980b9; }

@keyframes konfigurator-slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   MISC
   ======================================== */
.konfigurator-no-results {
    text-align: center;
    padding: 1.5rem;
    color: #444;
    font-style: italic;
    font-size: 0.85rem;
}

/* Drop zone styling */
.konfigurator-viewport.drop-zone-active {
    border-color: #27ae60 !important;
    box-shadow: inset 0 0 30px rgba(39, 174, 96, 0.08) !important;
}

.konfigurator-viewport.drop-zone-invalid {
    border-color: #c0392b !important;
    box-shadow: inset 0 0 30px rgba(192, 57, 43, 0.08) !important;
}

/* Scrollbar */
.konfigurator-wrapper ::-webkit-scrollbar { width: 5px; }
.konfigurator-wrapper ::-webkit-scrollbar-track { background: #111; border-radius: 10px; }
.konfigurator-wrapper ::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
.konfigurator-wrapper ::-webkit-scrollbar-thumb:hover { background: #ff901e; }

/* Spin icon for loading state */
@keyframes konfigurator-btn-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.konfigurator-spin-icon {
    animation: konfigurator-btn-spin 1s linear infinite;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
    .konfigurator-main-container {
        flex-direction: column;
        height: auto;
        min-height: var(--konfigurator-height, 85vh);
    }

    .konfigurator-viewport-container {
        flex: none;
        min-height: 400px;
    }

    .konfigurator-palette-container {
        flex: none;
        max-width: none;
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .konfigurator-header {
        padding: 0.35rem 0.6rem;
    }

    .konfigurator-main-container {
        padding: 0.4rem;
        gap: 0.4rem;
    }

    .konfigurator-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .konfigurator-cam-toolbar {
        top: 6px;
        right: 6px;
    }

    .konfigurator-cam-btn {
        width: 28px;
        height: 28px;
    }
}
