/**
 * GOTT3D SCAD Konfigurator — Styles
 */

/* Animations */
@keyframes gott3d-spin {
    to { transform: rotate(360deg); }
}
@keyframes gott3d-pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* ==================== SCAD Konfigurator ==================== */

/* 2-Spalten Layout */
.gott3d-scad-configurator .gott3d-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(350px, 2fr);
    gap: 24px;
    align-items: start;
}
@media (max-width: 768px) {
    .gott3d-scad-configurator .gott3d-layout {
        grid-template-columns: 1fr;
    }
    .gott3d-scad-configurator .gott3d-viewer-panel {
        order: -1;
    }
}

.gott3d-scad-configurator .gott3d-scad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.gott3d-scad-configurator .gott3d-scad-header h3 {
    margin: 0;
    font-size: 1.4em;
}

/* Modell-Selector */
.scad-model-selector {
    margin-bottom: 16px;
}
.scad-model-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}
.scad-model-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

/* Parameter-Gruppen */
.scad-param-group {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.scad-param-group legend {
    font-weight: 600;
    font-size: 14px;
    color: #ff6600;
    padding: 0 8px;
}
.scad-param {
    margin-bottom: 12px;
}
.scad-param:last-child {
    margin-bottom: 0;
}
.scad-param label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: #444;
}
.scad-param input[type="number"],
.scad-param input[type="text"],
.scad-param select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Slider */
.scad-slider-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.scad-slider-wrap input[type="range"] {
    flex: 1;
    accent-color: #ff6600;
}
.scad-slider-value {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

/* Checkbox als Toggle-Zeile */
.scad-param.scad-param-checkbox {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 10px;
}
.scad-param.scad-param-checkbox label {
    margin-bottom: 0;
    flex: 1;
}
.scad-params-form input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    accent-color: #ff6600 !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    margin: 0 !important;
}

/* Select/Dropdown — Theme-Override zuruecksetzen */
.scad-params-form select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 100% !important;
    padding: 8px 30px 8px 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") right 10px center no-repeat !important;
    color: #333 !important;
    cursor: pointer !important;
    position: relative !important;
}

/* Status */
.scad-status {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 4px;
}
.scad-status-info { color: #666; }
.scad-status-success { color: #2a7d2a; }
.scad-status-error { color: #cc3300; }

/* Spinner Overlay */
.scad-spinner {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    gap: 10px;
    border-radius: 8px;
}
.scad-spinner-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    animation: gott3d-spin 2s ease-in-out infinite, gott3d-pulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 8px rgba(255,102,0,0.3));
}
.scad-spinner span {
    font-size: 14px;
    color: #666;
}

/* Viewer sticky, volle Hoehe */
.gott3d-scad-configurator .gott3d-viewer-panel {
    position: sticky;
    top: 80px;
    align-self: start;
}
.scad-viewer-3d {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f8f8;
    min-height: 600px;
    height: calc(100vh - 160px);
    max-height: 900px;
}

/* Log */
.scad-log {
    font-size: 12px;
    color: #888;
    margin: 8px 0;
    min-height: 18px;
}

/* Warenkorb-Button */
.scad-add-to-cart {
    width: 100%;
    padding: 12px 20px !important;
    background: #ff6600 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 12px;
}
.scad-add-to-cart:hover:not(:disabled) {
    background: #e55b00 !important;
}
.scad-add-to-cart:disabled,
.scad-save-to-project:disabled,
.scad-update-part:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Projekt-Button */
.scad-save-to-project,
.scad-update-part {
    width: 100%;
    padding: 12px 20px !important;
    background: #2a7d2a !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}
.scad-save-to-project:hover:not(:disabled) {
    background: #1f6b1f !important;
}
.scad-update-part {
    background: #0066cc !important;
}
.scad-update-part:hover:not(:disabled) {
    background: #0052a3 !important;
}

/* ====================== Projekt-Modal ====================== */

.scad-project-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scad-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
}
.scad-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.scad-modal-content h4 {
    margin: 0 0 16px;
    font-size: 1.2em;
}
.scad-modal-field {
    margin-bottom: 12px;
}
.scad-modal-field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}
.scad-modal-field select,
.scad-modal-field input,
.scad-modal-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.scad-modal-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.scad-modal-buttons .scad-btn-primary {
    background: #ff6600 !important;
    color: #fff !important;
    border: none !important;
    flex: 1;
}

/* ====================== Account: Projekte ====================== */

.scad-projects-page,
.scad-project-detail-page {
    max-width: 100%;
}
.scad-projects-header,
.scad-project-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.scad-projects-header h3,
.scad-project-detail-header h3 {
    margin: 0;
    flex: 1;
}
.scad-back-link {
    font-size: 14px;
    text-decoration: none;
    color: #666;
}
.scad-back-link:hover {
    color: #333;
}

.scad-btn-primary {
    background: #ff6600 !important;
    color: #fff !important;
    border: none !important;
}
.scad-btn-primary:hover {
    background: #e55b00 !important;
}
.scad-btn-danger {
    background: #cc3300 !important;
    color: #fff !important;
    border: none !important;
}
.scad-btn-danger:hover {
    background: #aa2200 !important;
}
.scad-btn-order {
    background: #2a7d2a !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    font-weight: 600 !important;
}
.scad-btn-order:hover:not(:disabled) {
    background: #1f6b1f !important;
}
.scad-btn-order:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scad-projects-table,
.scad-parts-table {
    width: 100%;
    border-collapse: collapse;
}
.scad-projects-table th,
.scad-projects-table td,
.scad-parts-table th,
.scad-parts-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: middle;
}
.scad-projects-table th,
.scad-parts-table th {
    font-size: 12px;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
}
.scad-project-link {
    text-decoration: none;
    color: #333;
}
.scad-project-link:hover {
    color: #ff6600;
}
.scad-actions {
    white-space: nowrap;
}
.scad-param-summary {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scad-qty-input {
    width: 60px !important;
    padding: 4px 8px !important;
    text-align: center;
}
.scad-empty {
    color: #888;
    padding: 20px 0;
}
.scad-project-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.scad-loading {
    color: #888;
}

/* ====================== SCAD Gallery ====================== */

.gott3d-scad-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Masonry-Grid */
.gott3d-scad-gallery .masonry_wrap {
    display: flex;
    flex-wrap: wrap;
    margin-right: calc(-1 * var(--theme-var-grid_gap, 30px));
}
.gott3d-scad-gallery .masonry_item {
    width: 33.3333%;
    padding: 0 var(--theme-var-grid_gap, 30px) var(--theme-var-grid_gap, 30px) 0;
    box-sizing: border-box;
}
@media (max-width: 900px) {
    .gott3d-scad-gallery .masonry_item {
        width: 50%;
    }
}
@media (max-width: 560px) {
    .gott3d-scad-gallery .masonry_item {
        width: 100%;
    }
}

/* Generator-Cards */
.gott3d-scad-gallery .post_featured {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f0f0f0;
}
.gott3d-scad-gallery .post_featured img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    box-sizing: border-box;
}

/* Fallback-Icon */
.scad-gallery-fallback-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    background: #f5f5f5;
}
.scad-gallery-fallback-icon svg {
    width: 64px;
    height: 64px;
    color: #bbb;
}

/* Preview-Fortschrittsbalken (Admin) */
.scad-preview-progress {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f0f6ff;
    border: 1px solid #c5ddf5;
    border-radius: 8px;
}
.scad-preview-progress-bar {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.scad-preview-progress-fill {
    width: 0%;
    height: 100%;
    background: #ff6600;
    border-radius: 3px;
    transition: width 0.3s;
}
.scad-preview-progress-text {
    font-size: 13px;
    color: #555;
}
