/* ============================================================
   POLSTER-KONFIGURATOR — Original CSS (1:1 aus index.html Z. 5890-6843)
   + Standalone-Page-Overrides + Mobile-Refinements
   ============================================================ */

/* Polster Konfigurator Modal Styles */
.polster-konfigurator-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10002;
    overflow-y: auto;
}

.polster-konfigurator-modal * {
    box-sizing: border-box;
}

/* Progress Indicator */
.polster-progress {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0 10px;
    margin-bottom: 30px;
}

.polster-progress::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.polster-progress-item {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.polster-progress-circle {
    width: 36px;
    height: 36px;
    background: white;
    color: #999;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 6px;
    transition: all 0.3s;
    font-size: 14px;
}

/* Active Status - Yellow */
.polster-progress-item.active .polster-progress-circle {
    background: #e42025 !important;
    color: #000 !important;
    border-color: #e42025 !important;
}

/* Completed Status */
.polster-progress-item.completed .polster-progress-circle {
    background: #e42025 !important;
    color: white !important;
    border-color: #e42025 !important;
}

.polster-progress-label {
    font-size: 12px;
    color: #666;
}

/* Steps Container */
.polster-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Step Styles */
.polster-step {
    display: none !important;
    flex: 1;
    flex-direction: column;
}

.polster-step.active {
    display: flex !important;
    animation: polsterFadeIn 0.3s ease;
}

@keyframes polsterFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Button Styles - Yellow Buttons */
.polster-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.polster-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.polster-btn-primary {
    background: #e42025 !important;
    color: #000 !important;
}

.polster-btn-primary:hover:not(:disabled) {
    background: #ffff1c !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.polster-btn-secondary {
    background: #6c757d !important;
    color: white !important;
}

.polster-btn-secondary:hover:not(:disabled) {
    background: #545b62 !important;
}

.polster-btn-success {
    background: #e42025 !important;
    color: #000 !important;
}

.polster-btn-success:hover:not(:disabled) {
    background: #ffff1c !important;
}

/* Form Content */
.polster-form-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 20px;
}

/* Button Group */
.polster-button-group {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: auto;
    padding-top: 30px;
}

.polster-button-group.single {
    justify-content: flex-end;
}

/* Summary Styles */
.polster-summary {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
}

.polster-summary h3 {
    color: #2c3e50;
    font-size: 18px;
    margin-bottom: 15px;
}

.polster-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.polster-konfigurator-dialog {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.polster-konfigurator-content {
    background: white;
    width: 100%;
    max-width: 1400px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: polsterSlideIn 0.3s ease-out;
}

@keyframes polsterSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.polster-konfigurator-header {
    background: #e42025;
    color: #000;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.polster-konfigurator-header h2 {
    margin: 0;
    font-size: 24px;
    color: #000;
    font-weight: 600;
}

.polster-konfigurator-close {
    font-family: "Roboto", sans-serif;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #000000;
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.polster-konfigurator-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

/* Body */
.polster-konfigurator-body {
    display: flex;
    min-height: 700px;
}

/* Sidebar */
.polster-konfigurator-sidebar {
    width: 400px;
    padding: 30px;
    background: #f8f9fa;
    overflow-y: auto;
    flex-shrink: 0;
}

/* Summary Item */
.polster-summary-item:last-child {
    border-bottom: none;
}

.polster-summary-label {
    color: #666;
}

.polster-summary-value {
    color: #333;
    font-weight: 500;
}

/* Steps Header */
.polster-step h2 {
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 15px;
}

.polster-step > p {
    color: #666;
    margin-bottom: 25px;
    font-size: 16px;
}

/* Shape Grid */
.polster-shapes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding: 5px;
}

.polster-shape-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.polster-shape-item:hover {
    border-color: #e42025;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.polster-shape-item.selected {
    border-color: #e42025;
    background: #e8f5e9;
}

.polster-shape-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.polster-shape-icon img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.polster-shape-item.selected .polster-shape-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid #e42025;
    border-radius: 8px;
    z-index: 2;
    pointer-events: none;
}

.polster-shape-icon svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    display: none;
    z-index: 1;
}

.polster-view-gallery {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
    font-size: 12px;
    z-index: 3;
}

.polster-shape-item:hover .polster-view-gallery {
    opacity: 1;
}

.polster-view-gallery:hover {
    background: #e42025;
    color: #000;
}

.polster-shape-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* Form Groups */
.polster-form-group {
    margin-bottom: 25px;
}

.polster-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.polster-form-group label i {
    margin-right: 8px;
    color: #e42025;
}

/* Dimension Visual */
.polster-dimension-visual {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

/* Dimension Visualization */
.polster-shape-diagram {
    position: relative;
    display: inline-block;
    margin: 20px auto;
    max-width: 100%;
}

.polster-shape-diagram img,
.polster-shape-diagram svg {
    max-width: 100%;
    height: auto;
}

.polster-dimension-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.polster-dimension-label {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
}

.polster-dimension-marker {
    width: 30px;
    height: 30px;
    background: #e42025;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Dimension Inputs */
.polster-dimension-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.polster-dimension-input {
    display: flex;
    flex-direction: column;
}

.polster-dimension-input label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.polster-dimension-input input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.polster-dimension-input input:focus {
    outline: none;
    border-color: #e42025;
}

/* Select */
.polster-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.polster-select:focus {
    outline: none;
    border-color: #e42025;
}

/* Radio Group */
.polster-radio-group {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.polster-radio-item {
    flex: 1;
    min-width: 140px;
}

.polster-radio-item input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.polster-radio-item label {
    display: block;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.polster-radio-item input[type="radio"]:checked + label {
    background: #e8f5e9;
    border-color: #e42025;
    color: #000;
    font-weight: 500;
}

/* Material Categories */
.polster-category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.polster-category-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: color 0.3s;
    white-space: nowrap;
}

.polster-category-tab:hover {
    color: #c3c417;
}

.polster-category-tab.active {
    color: #c3c417;
}

.polster-category-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e42025;
}

/* Material Grid */
.polster-material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.polster-material-item {
    position: relative;
    cursor: pointer;
}

.polster-material-item input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.polster-material-item label {
    display: block;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.polster-material-swatch {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    margin: 0 auto 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
    transition: all 0.3s;
    background-size: cover;
    background-position: center;
}

.polster-material-name {
    font-size: 12px;
    color: #666;
}

.polster-material-item:hover .polster-material-swatch {
    transform: scale(1.05);
}

.polster-material-item input[type="radio"]:checked + label {
    background: #e8f5e9;
    border-radius: 8px;
}

.polster-material-item input[type="radio"]:checked + label .polster-material-swatch {
    border-color: #e42025;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
}

/* File Upload */
.polster-file-upload {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background: #fafafa;
}

.polster-file-upload:hover {
    border-color: #e42025;
    background: #fffbf0;
}

.polster-file-upload.dragover {
    background: #e8f5e9;
    border-color: #e42025;
}

.polster-file-upload-icon {
    font-size: 48px;
    color: #e42025;
    margin-bottom: 15px;
}

.polster-file-upload-text {
    color: #666;
    font-size: 16px;
    margin-bottom: 5px;
}

.polster-file-upload-text small {
    display: block;
    font-size: 14px;
    color: #999;
    margin-top: 5px;
}

/* Success Screen */
.polster-success {
    text-align: center;
    padding: 60px 40px;
}

.polster-success-icon {
    font-size: 80px;
    color: #e42025;
    margin-bottom: 25px;
}

.polster-success h2 {
    color: #c3c417;
    margin-bottom: 15px;
    font-size: 28px;
}

.polster-success p {
    color: #666;
    margin-bottom: 20px;
    font-size: 16px;
}

/* Notice Box */
.polster-notice {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    color: #000;
    font-size: 14px;
    border: 1px solid #a5d6a7;
}

.polster-notice i {
    margin-right: 8px;
}

/* Gallery Modal */
.polster-gallery-modal {
    display: none;
    position: fixed;
    z-index: 10005;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: polsterFadeIn 0.3s;
}

.polster-gallery-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    margin: 5vh auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.polster-gallery-close {
    font-family: "Roboto", sans-serif;
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 30px;
    color: #666;
    cursor: pointer;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    z-index: 10;
}

.polster-gallery-close:hover {
    background: #f0f0f0;
}

#polster-gallery-title {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.polster-gallery-main {
    width: 100%;
    height: 60vh;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.polster-gallery-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.polster-gallery-thumbs {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    max-height: 120px;
    overflow-x: auto;
    overflow-y: hidden;
}

.polster-gallery-thumb {
    width: 80px;
    height: 80px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.polster-gallery-thumb:hover,
.polster-gallery-thumb.active {
    border-color: #e42025;
    transform: scale(1.05);
}

.polster-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Scrollbar */
.polster-konfigurator-sidebar::-webkit-scrollbar,
.polster-content::-webkit-scrollbar,
.polster-material-grid::-webkit-scrollbar,
.polster-form-content::-webkit-scrollbar,
.polster-gallery-thumbs::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.polster-konfigurator-sidebar::-webkit-scrollbar-track,
.polster-content::-webkit-scrollbar-track,
.polster-material-grid::-webkit-scrollbar-track,
.polster-form-content::-webkit-scrollbar-track,
.polster-gallery-thumbs::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.polster-konfigurator-sidebar::-webkit-scrollbar-thumb,
.polster-content::-webkit-scrollbar-thumb,
.polster-material-grid::-webkit-scrollbar-thumb,
.polster-form-content::-webkit-scrollbar-thumb,
.polster-gallery-thumbs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.polster-konfigurator-sidebar::-webkit-scrollbar-thumb:hover,
.polster-content::-webkit-scrollbar-thumb:hover,
.polster-material-grid::-webkit-scrollbar-thumb:hover,
.polster-form-content::-webkit-scrollbar-thumb:hover,
.polster-gallery-thumbs::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive — Tablet */
@media (max-width: 1200px) {
    .polster-konfigurator-body {
        flex-direction: column;
        min-height: 0;
    }

    .polster-konfigurator-sidebar {
        width: 100%;
        padding: 20px;
        order: 2;
        max-height: none;
    }

    .polster-content {
        padding: 20px;
        order: 1;
    }
}

/* Responsive — Mobile */
@media (max-width: 768px) {
    .polster-konfigurator-dialog {
        padding: 10px;
    }

    .polster-konfigurator-header {
        padding: 15px 20px;
    }

    .polster-konfigurator-header h2 {
        font-size: 20px;
    }

    .polster-konfigurator-sidebar,
    .polster-content {
        padding: 16px;
    }

    .polster-step h2 {
        font-size: 20px;
    }

    .polster-step > p {
        font-size: 14px;
        margin-bottom: 18px;
    }

    .polster-dimension-inputs {
        grid-template-columns: 1fr;
    }

    .polster-radio-group {
        flex-direction: column;
    }

    .polster-radio-item {
        min-width: 0;
    }

    .polster-button-group {
        flex-direction: column-reverse;
        gap: 10px;
        padding-top: 20px;
    }

    .polster-btn {
        width: 100%;
        justify-content: center;
    }

    .polster-progress-label {
        display: none;
    }

    .polster-progress-circle {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .polster-shapes-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .polster-material-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        max-height: 320px;
        padding: 10px;
        gap: 10px;
    }

    .polster-material-swatch {
        width: 60px;
        height: 60px;
    }

    .polster-file-upload {
        padding: 24px 15px;
    }

    .polster-file-upload-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }

    .polster-category-tabs {
        flex-wrap: nowrap;
    }

    .polster-summary-item {
        flex-wrap: wrap;
        gap: 4px;
    }

    .polster-gallery-main {
        height: 50vh;
        min-height: 200px;
    }

    .polster-gallery-thumb {
        width: 64px;
        height: 64px;
    }
}

/* Responsive — Small Mobile */
@media (max-width: 480px) {
    .polster-konfigurator-dialog {
        padding: 0;
    }

    .polster-konfigurator-sidebar,
    .polster-content {
        padding: 12px;
    }

    .polster-shapes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .polster-shape-item {
        padding: 12px;
    }

    .polster-shape-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 10px;
    }

    .polster-progress {
        padding: 0 4px;
    }

    .polster-progress::before {
        left: 20px;
        right: 20px;
    }

    .polster-progress-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}


/* ============================================================
   STANDALONE-MODUS — Konfigurator als Page (nicht Modal)
   Body trägt class="polster-konfigurator-standalone"
   ============================================================ */

body.polster-konfigurator-standalone {
    background: #eeeeee !important;
}

body.polster-konfigurator-standalone .page-content {
    padding: 40px 0 60px !important;
    background: #eeeeee !important;
}

body.polster-konfigurator-standalone .polster-konfigurator-modal,
body.polster-konfigurator-standalone #polster-konfigurator-modal {
    display: block !important;
    position: static !important;
    background: transparent !important;
    overflow: visible !important;
    animation: none !important;
    z-index: auto !important;
    width: auto !important;
    height: auto !important;
}

body.polster-konfigurator-standalone .polster-konfigurator-dialog {
    min-height: auto !important;
    display: block !important;
    padding: 0 15px !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
}

body.polster-konfigurator-standalone .polster-konfigurator-content {
    background: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    max-height: none !important;
    animation: none !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    display: block !important;
}

body.polster-konfigurator-standalone .polster-konfigurator-header {
    display: none !important;
}

body.polster-konfigurator-standalone .polster-konfigurator-body {
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 0 !important;
}

body.polster-konfigurator-standalone .polster-konfigurator-sidebar,
body.polster-konfigurator-standalone .polster-content {
    min-width: 0 !important;
    max-width: 100% !important;
}

@media (max-width: 1200px) {
    body.polster-konfigurator-standalone .polster-konfigurator-body {
        flex-direction: column !important;
    }

    body.polster-konfigurator-standalone .polster-konfigurator-sidebar,
    body.polster-konfigurator-standalone .polster-content {
        width: 100% !important;
        flex: none !important;
        order: initial !important;
    }
}

@media (max-width: 768px) {
    body.polster-konfigurator-standalone .page-content {
        padding: 20px 0 40px !important;
    }

    body.polster-konfigurator-standalone .polster-konfigurator-dialog {
        padding: 0 8px !important;
    }
}
