/* Basis-Stile, um Konflikte mit dem Theme zu minimieren */
.sb-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sb-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #4a5568;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5em;
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1em;
    color: #718096;
    font-weight: 400;
}

.main-grid {
    display: grid;
    /* Geändert von 1fr 1fr auf 1fr für ein einspaltiges Layout */
    grid-template-columns: 1fr;
    gap: 30px;
}

.input-section, .result-section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.input-section {
    height: fit-content;
}

.section-title {
    font-size: 1.25em;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #3182ce;
    display: flex;
    align-items: center;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #3182ce;
    margin-right: 12px;
    border-radius: 2px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
    font-size: 0.95em;
}

select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    color: #2d3748;
    transition: border-color 0.2s ease;
}

select:hover {
    border-color: #a0aec0;
}

select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.material-hint {
    font-size: 0.85em;
    color: #718096;
    margin-top: 6px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 6px;
    border-left: 3px solid #3182ce;
}

.generate-btn {
    width: 100%;
    background: #3182ce;
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 24px;
}

.generate-btn:hover:not(:disabled) {
    background: #2c5282;
}

.generate-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    color: #a0aec0;
}

/* Result Styles */
.result-placeholder {
    text-align: center;
    color: #a0aec0;
    padding: 60px 20px;
    font-style: italic;
}

.result-placeholder h3 {
    font-size: 1.5em;
    margin-bottom: 12px;
    color: #718096;
}

.plan-summary {
    background: #ebf8ff;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 32px;
    border-left: 4px solid #3182ce;
}

.plan-summary h3 {
    color: #2d3748;
    margin-bottom: 16px;
    font-weight: 600;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-number {
    font-size: 1.75em;
    font-weight: 700;
    color: #3182ce;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85em;
    color: #718096;
    margin-top: 4px;
    font-weight: 500;
}

.steps-title {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.schleif-step {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #48bb78;
}

.step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.kornung-badge {
    background: #3182ce;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.1em;
}

.warning-badge {
    background: #fed7d7;
    color: #c53030;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.step-details h4 {
    color: #2d3748;
    margin-bottom: 12px;
    font-weight: 600;
}

.step-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

.meta-item {
    font-size: 0.9em;
    color: #718096;
}

.meta-item strong {
    color: #2d3748;
    font-weight: 600;
}

.profi-tipp {
    border: 1px solid #718096;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.profi-tipp strong {
    color: #2d3748;
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    font-weight: 600;
}

.profi-tipp p {
    color: #718096;
    font-size: 0.85em;
    line-height: 1.5;
    margin: 0;
}

.material-section {
    margin-top: 32px;
}

.material-list {
    background: #f0fff4;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #c6f6d5;
}

.material-list h4 {
    color: #22543d;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.1em;
}

.material-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #c6f6d5;
    font-size: 0.9em;
}

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

.material-item strong {
    color: #22543d;
    font-weight: 600;
}

.nassschliff-hinweis {
    color: #2c5282;
    font-weight: 500;
    /* Sorgt dafür, dass der Hinweis die volle Breite einnimmt */
    grid-column: 1 / -1; 
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #ebf8ff;
    border-radius: 6px;
    border-left: 3px solid #3182ce;
}
.nassschliff-hinweis strong {
    color: #2c5282;
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #cbd5e0;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    transition: background-color 0.2s ease;
}

.tooltip-container:hover .tooltip-icon {
    background-color: #3182ce;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 220px;
    background-color: #2d3748;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 10;
    bottom: 140%; /* Positioniert den Tooltip über dem Icon */
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s;
    font-size: 0.85em;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Der kleine Pfeil unter dem Tooltip */
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2d3748 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Styles für visuelle Bestätigung */
.select-wrapper {
    position: relative;
    width: 100%;
}

.selection-icon {
    position: absolute;
    right: 40px; /* Passt den Abstand vom rechten Rand an */
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none; /* Sorgt dafür, dass man durch das Icon klicken kann */
}

/* Passt den Abstand im Select-Feld an, damit Text nicht über Icon liegt */
select {
    padding-right: 60px !important;
}

.disclaimer-section {
    border-top: 2px solid #e2e8f0; /* Passt zum restlichen Design */
    padding-top: 15px;
    margin-top: 30px;
}

.disclaimer-section h4 {
    font-size: 0.9em; /* Etwas kleiner als eine Standard-Überschrift */
    margin-bottom: 8px;
    color: #2d3748; 
}

.disclaimer-section p {
    font-size: 0.8em;
    font-style: italic;
    color: #718096; /* Passt zur normalen Textfarbe für Hinweise */
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .step-meta {
        grid-template-columns: 1fr;
    }
    
    .step-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sb-container {
        padding: 10px;
    }

    .input-section,
    .result-section {
        padding: 24px;
    }
}

/* Print Button Styles */
.print-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    background: #4A5568;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 24px;
    float: right;
}

.print-btn:hover {
    background: #2D3748;
}

/* === FINALE, OPTIMIERTE PRINT-STYLES (v9 - Die Kombination) === */
@media print {
    @page {
        margin: 20mm;
        size: A4;
    }

    /* 1. Robuste Methode: Zuerst alles unsichtbar machen */
    body * {
        visibility: hidden;
    }

    /* 2. NUR unseren Container und dessen Inhalt wieder sichtbar machen */
    .sb-container, .sb-container * {
        visibility: visible;
    }
    
    /* 3. Grundlegende Resets für ein sauberes Drucklayout. */
    html, body {
        height: auto !important;
        width: 100%;
        background: white !important;
        color: black !important;
        font-size: 11pt !important;
        line-height: 1.3 !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 4. Den Container für den Druck vorbereiten UND nach oben verschieben */
    .sb-container {
        position: relative !important;
        top: -300px !important; /* Passt den oberen Leerraum an */
        left: 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
    }

    /* 5. Nicht benötigte Teile innerhalb unseres Plugins ausblenden. */
    .sb-container .header,
    .sb-container .input-section,
    .sb-container .generate-btn,
    .sb-container .print-btn,
    .sb-container .result-section > .section-title {
        display: none !important;
    }
    
    /* 6. Restliche Stile für ein sauberes Druckbild anpassen */
    .main-grid {
        display: block !important;
    }

    .result-section {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: white !important;
        border-radius: 0 !important;
        height: auto !important;
    }

    .plan-summary, .schleif-step, .profi-tipp, .material-list {
        background: #f9f9f9 !important;
        border: 1px solid #ccc !important;
        border-radius: 0 !important;
        padding: 10pt !important;
        margin-bottom: 12pt !important;
        page-break-inside: avoid; /* Wichtig, um unschöne Umbrüche zu vermeiden */
    }

    .plan-summary {
        border-left: 3px solid #666 !important;
    }

    .schleif-step {
         border-left: 3px solid #48bb78 !important;
    }

    .kornung-badge {
        background: #333 !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        padding: 4pt 8pt !important;
        border-radius: 4px;
    }
    
    h3, h4 {
        color: black !important;
        font-size: 14pt !important;
    }
    .stat-number, .stat-label, .meta-item, .material-item {
        color: black !important;
    }
    .stat-number {
        font-size: 16pt !important;
    }
}

