/* ═══════════════════════════════════════════════════════════════════════════
   COVER LETTER EDITOR - Professional Styling
   Phase 5: Responsive Anschreiben-Editor
   ═══════════════════════════════════════════════════════════════════════════ */

/* CSS Variables */
:root {
    --cl-primary: #6366f1;
    --cl-primary-hover: #4f46e5;
    --cl-text: #1e293b;
    --cl-text-muted: #64748b;
    --cl-bg: #f8fafc;
    --cl-card: #ffffff;
    --cl-border: #e2e8f0;
    --cl-success: #10b981;
    --cl-warning: #f59e0b;
    --cl-error: #ef4444;
    --cl-sidebar-width: 300px;
    --cl-design-width: 320px; /* Breiter für bessere Lesbarkeit */
    --cl-design-min-width: 280px;
    --cl-design-max-width: 450px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.cover-letter-editor {
    min-height: calc(100vh - 70px);
    background: var(--cl-bg);
    padding-top: 70px; /* Platz für fixed navbar */
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--cl-card);
    border-bottom: 1px solid var(--cl-border);
    gap: 1rem;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--cl-text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-back:hover {
    background: var(--cl-bg);
    color: var(--cl-text);
}

.editor-title {
    flex: 1;
    text-align: center;
}

.editor-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.editor-title h1 i {
    color: var(--cl-primary);
}

.editor-title p {
    font-size: 0.85rem;
    color: var(--cl-text-muted);
    margin: 0.25rem 0 0 0;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cl-border);
    border-radius: 8px;
    background: var(--cl-card);
    color: var(--cl-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
    background: rgba(99, 102, 241, 0.05);
}

.btn-secondary {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    background: white;
    color: var(--cl-text);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
    background: rgba(99, 102, 241, 0.05);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR LAYOUT - THREE COLUMNS
   ═══════════════════════════════════════════════════════════════════════════ */

.editor-layout {
    display: grid;
    grid-template-columns: var(--cl-sidebar-width) 1fr var(--cl-design-width);
    min-height: calc(100vh - 130px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEFT SIDEBAR - JOB INFO & OPTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.editor-sidebar {
    background: var(--cl-card);
    border-right: 1px solid var(--cl-border);
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section h3 i {
    color: var(--cl-primary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cl-text-muted);
    margin-bottom: 0.375rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.btn-inline {
    margin-top: 0.5rem;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--cl-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Option Groups */
.option-group {
    margin-bottom: 1rem;
}

.option-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cl-text-muted);
    margin-bottom: 0.5rem;
}

.option-buttons {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.placeholder-btn {
    border: 1px dashed var(--cl-border);
    background: white;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.placeholder-btn:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
}

.option-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.5rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    background: var(--cl-card);
    color: var(--cl-text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.option-btn i {
    font-size: 0.9rem;
}

.option-btn:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
}

.option-btn.active {
    background: var(--cl-primary);
    border-color: var(--cl-primary);
    color: white;
}

/* Generate Button */
.btn-generate {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--cl-primary), #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
    margin-top: auto;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-generate:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN EDITOR AREA
   ═══════════════════════════════════════════════════════════════════════════ */

.editor-main {
    display: flex;
    flex-direction: column;
    background: var(--cl-bg);
    position: relative;
}

.editor-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f5f5f5;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 9px, rgba(0,0,0,0.03) 9px, rgba(0,0,0,0.03) 10px),
        repeating-linear-gradient(90deg, transparent, transparent 9px, rgba(0,0,0,0.03) 9px, rgba(0,0,0,0.03) 10px);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    max-width: 500px;
}

.empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon i {
    font-size: 2.5rem;
    color: var(--cl-primary);
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    color: var(--cl-text-muted);
    font-size: 0.95rem;
    margin: 0 0 1.5rem 0;
}

.empty-hints {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--cl-text-muted);
    text-align: left;
}

.hint-item i {
    color: var(--cl-primary);
    font-size: 1rem;
}

/* Loading Animation */
.loading-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 250, 252, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--cl-primary), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner i {
    font-size: 2rem;
    color: white;
}

.loading-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0 0 0.5rem 0;
}

.loading-content p {
    color: var(--cl-text-muted);
    font-size: 0.9rem;
    margin: 0 0 1.5rem 0;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.loading-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--cl-primary), #8b5cf6);
    border-radius: 2px;
    animation: loadingBar 1.5s ease-in-out infinite;
}

@keyframes loadingBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Generated Letter - DIN A4 Ansicht (dynamische Höhe) */
.generated-letter {
    width: 210mm;
    min-height: 297mm;
    /* max-height entfernt - Anschreiben kann mehrere Seiten sein */
    background: white;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.1),
        0 4px 20px rgba(0, 0, 0, 0.15),
        0 0 0 2px #fff inset;
    padding: var(--letter-margin, 25mm);
    font-family: var(--letter-font, 'Inter', sans-serif);
    font-size: var(--letter-font-size, 11pt);
    line-height: var(--letter-line-height, 1.6);
    color: var(--cl-text);
    position: relative;
    margin: 0 auto;
    overflow: visible; /* Inhalt kann überlaufen für mehrere Seiten */
    display: flex;
    flex-direction: column;
    page-break-after: always;
}

/* DIN A4 Seitenrahmen für besseres Abstandsgefühl */
.generated-letter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 1;
}

/* Letter Body - scrollbar nur hier wenn nötig */
.letter-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Wichtig für Flexbox */
}

.letter-body textarea {
    width: 100%;
    min-height: 200px;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    padding: 0;
}

/* Custom Scrollbar für letter-body */
.letter-body::-webkit-scrollbar {
    width: 6px;
}

.letter-body::-webkit-scrollbar-track {
    background: transparent;
}

.letter-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.letter-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.letter-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    font-family: var(--letter-font, 'Inter', sans-serif);
}

.letter-sender {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.letter-sender span:first-child {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--letter-accent, var(--cl-primary));
}

.letter-sender span {
    font-size: 0.9em;
    color: var(--cl-text-muted);
}

/* Editierbare Felder */
.editable-field {
    min-height: 1.2em;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    outline: none;
    font-family: inherit;
}

.editable-field:empty:before {
    content: attr(placeholder);
    color: var(--cl-text-muted);
    opacity: 0.5;
}

.editable-field:focus {
    background-color: rgba(99, 102, 241, 0.1);
    border: 1px dashed var(--cl-primary);
}

.editable-field:hover {
    background-color: rgba(99, 102, 241, 0.05);
}

.letter-date {
    text-align: right;
    color: var(--cl-text-muted);
    font-size: 0.9em;
}

.letter-recipient {
    margin-bottom: 1.5rem;
    margin-top: var(--recipient-top-margin, 25mm);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-family: var(--letter-font, 'Inter', sans-serif);
}

.letter-recipient span {
    font-size: 0.95em;
}

.letter-recipient .company-address {
    white-space: pre-line;
    color: var(--cl-text);
    font-size: 0.9em;
}

.letter-subject {
    margin-bottom: 1.5rem;
    font-size: 1em;
}

.letter-subject strong {
    color: var(--letter-accent, var(--cl-primary));
}

.letter-salutation {
    margin-bottom: 1rem;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-indent: 0 !important;
}

.letter-salutation .greeting-salutation-input {
    width: auto;
    min-width: 280px;
    margin-bottom: 0;
    font-weight: 400; /* Anrede normal, nicht fett */
    margin-left: 0;
    padding-left: 0;
}

.letter-body {
    margin-bottom: 2rem;
    font-family: var(--letter-font, 'Inter', sans-serif);
}

.letter-body textarea {
    width: 100%;
    min-height: 400px;
    border: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    resize: vertical;
    padding: 0;
    color: inherit;
}

.letter-body textarea:focus {
    outline: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LETTER FOOTER - Grußformel & Unterschrift
   ═══════════════════════════════════════════════════════════════════════════ */
.letter-footer {
    display: flex;
    flex-direction: column;
    gap: var(--letter-signature-gap, 2rem);
    margin-top: 2rem;
    font-family: var(--letter-font, 'Inter', sans-serif);
    min-height: 120px; /* Genug Platz für Unterschrift */
}

.letter-footer span:last-child {
    font-weight: 600;
    color: var(--letter-accent, var(--cl-primary));
}

/* Grußformel Styling */
.letter-footer .greeting-input {
    font-size: inherit;
    margin-bottom: 0.5rem;
}

/* Editierbare Grußformel, Anrede, Betreff und Signatur */
.greeting-input,
.greeting-salutation-input,
.subject-input,
.signature-name-input {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
    transition: all 0.2s ease;
    width: auto;
    min-width: 200px;
    display: inline-block;
}

.greeting-input:hover,
.greeting-salutation-input:hover,
.subject-input:hover,
.signature-name-input:hover {
    border-bottom-color: rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.02);
}

.greeting-input:focus,
.greeting-salutation-input:focus,
.subject-input:focus,
.signature-name-input:focus {
    border-bottom-color: var(--letter-accent, var(--cl-primary));
    border-bottom-style: solid;
    background: rgba(99, 102, 241, 0.05);
}

.greeting-salutation-input {
    width: 100%;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.subject-input {
    width: auto;
    flex: 1;
    margin-left: 0.5rem;
}

.signature-name-input {
    font-weight: 600;
    color: var(--letter-accent, var(--cl-primary));
}

.letter-subject {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIGNATUR-CONTAINER - Verbesserte Sichtbarkeit
   ═══════════════════════════════════════════════════════════════════════════ */
.signature-container {
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

#signatureImage {
    max-width: 220px;
    max-height: 100px;
    min-height: 40px;
    object-fit: contain;
    position: relative;
    cursor: move;
    user-select: none;
    transition: opacity 0.2s, transform 0.15s;
    z-index: 10;
    display: block !important;
}

#signatureImage[src]:not([src=""]) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#signatureImage:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

#signatureImage:active {
    cursor: grabbing;
    transform: scale(1.01);
}

/* Signatur-Platzhalter wenn kein Bild */
.signature-container:not(:has(#signatureImage[src]:not([src=""]))) .signature-name-input {
    margin-top: 1rem;
}

/* Unterschriftslinie (optional) */
.signature-line {
    width: 200px;
    height: 1px;
    background: #cbd5e1;
    margin-top: 0.5rem;
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--cl-card);
    border-top: 1px solid var(--cl-border);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    background: var(--cl-card);
    color: var(--cl-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--cl-border);
    margin: 0 0.25rem;
}

.word-count,
.char-count {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RIGHT PANEL - DESIGN OPTIONS (Resizable)
   ═══════════════════════════════════════════════════════════════════════════ */

.editor-design-panel {
    background: var(--cl-card);
    border-left: 1px solid var(--cl-border);
    padding: 1.25rem;
    padding-left: 1.5rem; /* Extra Platz für Resize-Handle */
    overflow-y: auto;
    overflow-x: hidden;
    width: var(--cl-design-width);
    min-width: var(--cl-design-min-width);
    max-width: var(--cl-design-max-width);
    position: relative;
    flex-shrink: 0;
}

/* Resize Handle - Interaktiver Bereich am linken Rand */
.design-panel-resize-handle {
    position: absolute;
    left: -6px; /* Leicht über den Rand hinaus für besseres Greifen */
    top: 0;
    bottom: 0;
    width: 12px; /* Breiter für einfacheres Greifen */
    cursor: ew-resize;
    background: transparent;
    z-index: 100; /* Höherer z-index */
    transition: background 0.2s;
}

.design-panel-resize-handle:hover,
.design-panel-resize-handle.active {
    background: linear-gradient(to right, 
        rgba(99, 102, 241, 0.3), 
        rgba(99, 102, 241, 0.1), 
        transparent);
}

/* Visueller Indikator - immer sichtbar */
.design-panel-resize-handle::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60px;
    background: var(--cl-border);
    border-radius: 2px;
    transition: background 0.2s, height 0.2s, box-shadow 0.2s;
}

.design-panel-resize-handle:hover::before,
.design-panel-resize-handle.active::before {
    background: var(--cl-primary);
    height: 100px;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

/* Doppelpfeil-Icon beim Hover */
.design-panel-resize-handle::after {
    content: '⋮⋮';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: var(--cl-text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    letter-spacing: -2px;
}

.design-panel-resize-handle:hover::after {
    opacity: 1;
    color: var(--cl-primary);
}

/* Doppelpfeil-Cursor beim Hovern */
.editor-design-panel.resizing,
.editor-design-panel.resizing * {
    cursor: ew-resize !important;
    user-select: none;
}

.editor-design-panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0 0 1.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-design-panel h3 i {
    color: var(--cl-primary);
}

/* Bessere Lesbarkeit für Inputs */
.editor-design-panel input,
.editor-design-panel select,
.editor-design-panel .slider-value {
    font-size: 0.9rem;
}

.design-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--cl-border);
}

.design-section:last-child {
    border-bottom: none;
}

.design-section label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cl-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.quality-check-list {
    display: grid;
    gap: 0.5rem;
}

.quality-check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

.quality-check-item.ok {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.quality-check-item.warn {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.quality-check-item.bad {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KI-QUALITÄTSTIPPS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-ai-quality {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-ai-quality:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-ai-quality:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ai-quality-tips {
    margin-top: 1rem;
    display: none;
}

.ai-quality-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.ai-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-weight: 700;
}

.ai-score.excellent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.ai-score.good {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.ai-score.needs-work {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.ai-score.poor {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.ai-score .score-value {
    font-size: 1.25rem;
    line-height: 1;
}

.ai-score .score-label {
    font-size: 0.65rem;
    opacity: 0.8;
}

.ai-summary {
    flex: 1;
    font-size: 0.9rem;
    color: var(--cl-text);
    line-height: 1.4;
}

.ai-tips-list {
    display: grid;
    gap: 0.75rem;
}

.ai-tip-item {
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid;
}

.ai-tip-item.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: #f59e0b;
}

.ai-tip-item.success {
    background: rgba(16, 185, 129, 0.08);
    border-color: #10b981;
}

.ai-tip-item.info {
    background: rgba(99, 102, 241, 0.08);
    border-color: #6366f1;
}

.tip-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tip-header i {
    font-size: 0.9rem;
}

.ai-tip-item.warning .tip-header i { color: #f59e0b; }
.ai-tip-item.success .tip-header i { color: #10b981; }
.ai-tip-item.info .tip-header i { color: #6366f1; }

.tip-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--cl-text);
    flex: 1;
}

.tip-category {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0,0,0,0.05);
    color: var(--cl-text-muted);
}

.tip-description {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.tip-suggestion {
    font-size: 0.8rem;
    padding: 0.5rem;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tip-suggestion strong {
    color: var(--cl-text);
}

.btn-apply-tip {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    background: var(--cl-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.btn-apply-tip:hover {
    background: var(--cl-primary-hover);
}

.design-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}

.design-select:focus {
    outline: none;
    border-color: var(--cl-primary);
}

/* Style Options */
.style-options {
    display: flex;
    gap: 0.5rem;
}

.style-btn {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid var(--cl-border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s;
}

.style-btn:hover {
    border-color: var(--cl-primary);
}

.style-btn.active {
    border-color: var(--cl-primary);
    background: rgba(99, 102, 241, 0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STYLE PREVIEW THUMBNAILS - Verbesserte Darstellung
   ═══════════════════════════════════════════════════════════════════════════ */
.style-preview {
    width: 100%;
    height: 44px;
    border-radius: 4px;
    background: #f1f5f9;
    position: relative;
    overflow: hidden;
}

.modern-preview {
    background: linear-gradient(135deg, var(--cl-primary, #6366f1) 35%, #f8fafc 35%);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.classic-preview {
    background: linear-gradient(to right, var(--cl-primary, #6366f1) 4px, #f8fafc 4px);
    border-bottom: 1px solid #e2e8f0;
}

.minimal-preview {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.elegant-preview {
    background: linear-gradient(to bottom, #d4af37 5px, #fefce8 5px 10px, #f8fafc 10px);
}

.creative-preview {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.corporate-preview {
    background: linear-gradient(to bottom, #1e3a5f 40%, #f8fafc 40%);
    border: 1px solid #e2e8f0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LETTER STYLE VARIANTS - Verbesserte Designvorlagen
   ═══════════════════════════════════════════════════════════════════════════ */

/* Basis: Font-Inheritance für alle Stile */
.generated-letter .letter-sender,
.generated-letter .letter-sender span,
.generated-letter .letter-recipient,
.generated-letter .letter-recipient span,
.generated-letter .editable-field,
.generated-letter .letter-date,
.generated-letter .letter-subject,
.generated-letter input,
.generated-letter .greeting-input,
.generated-letter .greeting-salutation-input,
.generated-letter .subject-input,
.generated-letter .signature-name-input {
    font-family: inherit !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN STYLE - Farbiger Header mit Gradient
   ───────────────────────────────────────────────────────────────────────────── */
.generated-letter.style-modern .letter-header {
    background: var(--header-style, linear-gradient(135deg, var(--letter-accent, #6366f1) 0%, color-mix(in srgb, var(--letter-accent, #6366f1) 85%, white) 100%));
    color: var(--header-text-color, #ffffff);
    padding: 1.75rem 2rem;
    margin: calc(var(--letter-margin, 25mm) * -1);
    margin-top: calc(var(--header-top-margin, 0mm) - var(--letter-margin, 25mm));
    margin-bottom: 2rem;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.generated-letter.style-modern .letter-sender span {
    color: var(--header-text-color, #ffffff) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.generated-letter.style-modern .letter-sender span:first-child {
    color: var(--header-text-color, #ffffff) !important;
    font-weight: 700;
    font-size: 1.25em;
    letter-spacing: -0.02em;
}

.generated-letter.style-modern .letter-date,
.generated-letter.style-modern .letter-date-container span {
    color: rgba(255,255,255,0.95) !important;
}

.generated-letter.style-modern .letter-sender-contact {
    color: rgba(255,255,255,0.85);
    font-size: 0.9em;
}

/* Header Contrast Classes */
.generated-letter.header-contrast-light .letter-header .letter-sender span,
.generated-letter.header-contrast-light .letter-header .letter-date {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.generated-letter.header-contrast-dark .letter-header .letter-sender span,
.generated-letter.header-contrast-dark .letter-header .letter-date {
    color: #1e293b !important;
    text-shadow: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CLASSIC STYLE - Seitenlinie, traditionelles Layout
   ───────────────────────────────────────────────────────────────────────────── */
.generated-letter.style-classic {
    border-left: 4px solid var(--letter-accent, #6366f1);
    background: linear-gradient(to right, rgba(var(--letter-accent-rgb, 99, 102, 241), 0.02), transparent 30%);
}

.generated-letter.style-classic .letter-header {
    background: transparent;
    color: #1e293b;
    padding-left: 0;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.generated-letter.style-classic .letter-sender span:first-child {
    color: var(--letter-accent, #6366f1);
    font-weight: 600;
    font-size: 1.1em;
}

.generated-letter.style-classic .letter-sender span {
    color: #475569;
}

.generated-letter.style-classic .letter-subject {
    border-bottom: 2px solid var(--letter-accent, #6366f1);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MINIMAL STYLE - Clean, schlicht, viel Weißraum
   ───────────────────────────────────────────────────────────────────────────── */
.generated-letter.style-minimal {
    background: #ffffff;
}

.generated-letter.style-minimal .letter-header {
    background: transparent;
    color: #1e293b;
    border-bottom: none;
    padding-bottom: 2rem;
}

.generated-letter.style-minimal .letter-sender span:first-child {
    font-weight: 500;
    font-size: 1em;
    color: #1e293b;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.generated-letter.style-minimal .letter-sender span {
    color: #64748b;
    font-size: 0.9em;
}

.generated-letter.style-minimal .letter-subject {
    font-weight: 500;
    color: #1e293b;
}

.generated-letter.style-minimal .letter-subject .subject-label {
    color: #64748b;
    font-weight: 400;
}

/* ─────────────────────────────────────────────────────────────────────────────
   ELEGANT STYLE - Goldakzente, Serif-Schrift für Name
   ───────────────────────────────────────────────────────────────────────────── */
.generated-letter.style-elegant {
    border-top: 5px solid var(--letter-accent, #d4af37);
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.03), transparent 15%);
}

.generated-letter.style-elegant .letter-header {
    background: transparent;
    color: #1e293b;
    padding-top: 1.5rem;
    text-align: left;
}

.generated-letter.style-elegant .letter-sender span:first-child {
    font-family: 'Playfair Display', 'Cormorant Garamond', 'Georgia', serif !important;
    font-size: 1.4em;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: 0.02em;
}

.generated-letter.style-elegant .letter-sender span {
    color: #64748b;
}

.generated-letter.style-elegant .letter-subject {
    font-style: italic;
    color: #475569;
}

.generated-letter.style-elegant .letter-subject .subject-label {
    font-style: normal;
    color: var(--letter-accent, #d4af37);
}

.generated-letter.style-elegant .letter-footer .greeting-input {
    font-style: italic;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CREATIVE STYLE - Bunter Gradient-Header, abgerundete Ecken
   ───────────────────────────────────────────────────────────────────────────── */
.generated-letter.style-creative {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.generated-letter.style-creative .letter-header {
    background: var(--header-style, linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%));
    color: #ffffff;
    padding: 2rem 2.5rem;
    margin: calc(var(--letter-margin, 25mm) * -1);
    margin-bottom: 2rem;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.generated-letter.style-creative .letter-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, rgba(255,255,255,0.3), transparent);
}

.generated-letter.style-creative .letter-sender span:first-child {
    font-size: 1.4em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.generated-letter.style-creative .letter-sender span {
    color: rgba(255,255,255,0.9) !important;
}

.generated-letter.style-creative .letter-date,
.generated-letter.style-creative .letter-date-container span {
    color: rgba(255,255,255,0.85) !important;
}

.generated-letter.style-creative .letter-subject {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CORPORATE STYLE - Business-Look, dunkler Header
   ───────────────────────────────────────────────────────────────────────────── */
.generated-letter.style-corporate {
    border: 1px solid #e2e8f0;
}

.generated-letter.style-corporate .letter-header {
    background: linear-gradient(180deg, var(--letter-accent, #1e3a5f) 0%, color-mix(in srgb, var(--letter-accent, #1e3a5f) 90%, black) 100%);
    color: #ffffff;
    padding: 2rem 2.5rem;
    margin: calc(var(--letter-margin, 25mm) * -1);
    margin-bottom: 2rem;
}

.generated-letter.style-corporate .letter-sender span:first-child {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 1em;
}

.generated-letter.style-corporate .letter-sender span {
    color: rgba(255,255,255,0.85) !important;
    font-size: 0.9em;
}

.generated-letter.style-corporate .letter-date,
.generated-letter.style-corporate .letter-date-container span {
    color: rgba(255,255,255,0.8) !important;
    font-size: 0.85em;
}

.generated-letter.style-corporate .letter-subject {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.95em;
}

.generated-letter.style-corporate .letter-subject .subject-label {
    color: var(--letter-accent, #1e3a5f);
}

.style-btn span:last-child {
    font-size: 0.7rem;
    color: var(--cl-text-muted);
}

/* Color Options */
.color-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-btn {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: var(--cl-text);
}

/* Slider Groups */
.slider-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider-group input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--cl-primary);
    border-radius: 50%;
    cursor: pointer;
}

.slider-group span {
    min-width: 40px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cl-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid var(--cl-success);
}

.toast.error {
    border-left: 4px solid var(--cl-error);
}

.toast.warning {
    border-left: 4px solid var(--cl-warning);
}

.toast i {
    font-size: 1.1rem;
}

.toast.success i { color: var(--cl-success); }
.toast.error i { color: var(--cl-error); }
.toast.warning i { color: var(--cl-warning); }

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

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: var(--cl-sidebar-width) 1fr;
    }
    
    .editor-design-panel {
        display: none;
    }
}

/* Blocks Editor Modal */
.blocks-editor-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.blocks-editor-modal.active {
    display: flex;
}

.blocks-editor-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.blocks-editor-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--cl-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.blocks-editor-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--cl-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blocks-editor-close {
    background: none;
    border: none;
    color: var(--cl-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.blocks-editor-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: grid;
    gap: 1rem;
}

.blocks-container {
    display: grid;
    gap: 0.75rem;
}

.block-item {
    border: 1px solid var(--cl-border);
    border-radius: 8px;
    padding: 0.75rem;
    background: #f8fafc;
}

.block-item.active {
    border-color: var(--cl-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.block-ai-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
}

.block-ai-actions button {
    border: 1px solid var(--cl-border);
    background: white;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.block-ai-suggestions {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.block-ai-suggestion {
    border: 1px dashed var(--cl-border);
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
}

.blocks-ai-panel {
    border: 1px solid var(--cl-border);
    border-radius: 10px;
    padding: 0.75rem;
    background: #ffffff;
}

.blocks-ai-title {
    font-weight: 600;
    color: var(--cl-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blocks-ai-hint {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    margin: 0.35rem 0 0.75rem 0;
}

.blocks-ai-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.blocks-ai-suggestions {
    display: grid;
    gap: 0.5rem;
}

.blocks-ai-suggestions .block-ai-suggestion {
    border-style: solid;
}

.block-item textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    padding: 0.5rem;
    resize: vertical;
    font-family: inherit;
}

.block-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.block-item-actions button {
    border: none;
    background: #e5e7eb;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.blocks-editor-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--cl-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.resume-versions-create {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.resume-versions-create input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
}

.resume-versions-list {
    display: grid;
    gap: 0.75rem;
}

.resume-version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: 1px solid var(--cl-border);
    border-radius: 8px;
    background: #f8fafc;
}

.resume-version-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.resume-version-title {
    font-weight: 600;
    color: var(--cl-text);
}

.resume-version-date {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
}

.resume-version-actions {
    display: flex;
    gap: 0.5rem;
}

.resume-version-actions button {
    border: 1px solid var(--cl-border);
    background: white;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
}

.resume-version-actions button:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
}

.resume-version-diff {
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px dashed var(--cl-border);
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.85rem;
    color: var(--cl-text);
    max-height: 240px;
    overflow: auto;
    white-space: pre-wrap;
}

@media (max-width: 992px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
    
    .editor-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--cl-border);
        max-height: 50vh;
    }
    
    .generated-letter {
        width: 100%;
        min-height: auto;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .cover-letter-editor {
        padding-top: 60px;
    }
    
    .editor-header {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        position: sticky;
        top: 60px;
        z-index: 90;
        background: var(--cl-card);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .editor-title {
        order: 3;
        width: 100%;
        text-align: left;
        margin-top: 0.5rem;
    }
    
    .editor-title h1 {
        font-size: 1rem;
    }
    
    .editor-title p {
        font-size: 0.75rem;
        display: none; /* Hide subtitle on mobile */
    }
    
    .btn-back {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .btn-back span {
        display: none; /* Hide text, show only icon */
    }
    
    .editor-actions {
        gap: 0.25rem;
    }
    
    .editor-actions .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .editor-content {
        padding: 0.75rem;
    }
    
    .option-buttons {
        flex-direction: column;
    }
    
    .option-btn {
        flex-direction: row;
        justify-content: flex-start;
    }
    
    /* Mobile Sidebar Toggle */
    .editor-sidebar {
        position: fixed;
        left: -100%;
        top: 120px;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        overflow-y: auto;
        background: var(--cl-card);
    }
    
    .editor-sidebar.mobile-open {
        left: 0;
    }
    
    /* Mobile FAB for sidebar */
    .mobile-sidebar-toggle {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--cl-primary);
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
        z-index: 101;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
    }
    
    /* Mobile quick actions */
    .mobile-quick-actions {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        right: 20px;
        gap: 10px;
        z-index: 101;
    }
    
    .mobile-quick-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: none;
        background: var(--cl-card);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        color: var(--cl-primary);
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-quick-btn.primary {
        background: var(--cl-success);
        color: white;
        width: 56px;
        height: 56px;
    }
    
    /* Editor content full width */
    .generated-letter {
        min-height: auto;
        font-size: 0.9rem;
        padding: 1.25rem;
    }
    
    .generated-letter .letter-header {
        font-size: 0.85rem;
    }
    
    /* Overlay for sidebar */
    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    /* Form optimizations */
    .sidebar-section {
        padding: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0.75rem;
    }
    
    /* Bottom safe area for iOS */
    .editor-content {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 20px) + 80px);
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .editor-title h1 {
        font-size: 0.9rem;
    }
    
    .editor-header {
        padding: 0.5rem 0.75rem;
    }
    
    .generated-letter {
        padding: 1rem;
        font-size: 0.85rem;
    }
    
    .btn-block {
        padding: 0.875rem;
        font-size: 0.9rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
    .editor-header,
    .editor-sidebar,
    .editor-design-panel,
    .editor-toolbar {
        display: none !important;
    }
    
    .editor-layout {
        grid-template-columns: 1fr;
    }
    
    .editor-content {
        padding: 0;
    }
    
    .generated-letter {
        box-shadow: none;
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SKILL GAP ANALYSE
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-skill-gap {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    transition: all 0.3s ease;
}

.btn-skill-gap:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.skill-gap-hint {
    font-size: 0.7rem;
    color: var(--cl-text-muted);
    margin-top: 0.5rem;
    line-height: 1.4;
}

.skill-gap-hint i {
    color: var(--cl-primary);
}

.generate-section {
    border-top: 1px solid var(--cl-border);
    padding-top: 1rem !important;
    margin-top: 0.5rem;
}

/* Skill Gap Modal */
.skill-gap-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.skill-gap-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.skill-gap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.skill-gap-header h2 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.skill-gap-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.skill-gap-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.skill-gap-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Progress Steps */
.skill-gap-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.skill-gap-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.skill-gap-steps .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.skill-gap-steps .step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.3s;
}

.skill-gap-steps .step.active .step-icon {
    background: var(--cl-primary);
    color: white;
}

.skill-gap-steps .step.completed .step-icon {
    background: var(--cl-success);
    color: white;
}

.skill-gap-steps .step span {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
    text-align: center;
    max-width: 80px;
}

.skill-gap-steps .step.active span {
    color: var(--cl-primary);
    font-weight: 600;
}

/* Step Content */
.skill-gap-step-content {
    min-height: 200px;
}

.skill-gap-step-content .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--cl-text-muted);
}

.skill-gap-step-content .loading-state i {
    font-size: 2rem;
    color: var(--cl-primary);
}

/* Skill Gap Table */
.skill-gap-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.skill-gap-row {
    display: grid;
    grid-template-columns: 1fr 1fr 100px;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--cl-border);
    align-items: center;
}

.skill-gap-row.header {
    font-weight: 600;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
}

.skill-gap-row .requirement {
    font-weight: 500;
}

.skill-gap-row .user-skill {
    color: var(--cl-text-muted);
    font-size: 0.9rem;
}

.skill-gap-row .match-score {
    text-align: center;
}

.match-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.match-badge.high {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.match-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.match-badge.low {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Footer */
.skill-gap-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--cl-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIGNATURE TABS
   ═══════════════════════════════════════════════════════════════════════════ */

.signature-section {
    border-top: 1px solid var(--cl-border);
    padding-top: 1rem !important;
}

.signature-method-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px;
    border-radius: 8px;
}

.signature-tab {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--cl-text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.signature-tab:hover {
    background: rgba(99, 102, 241, 0.1);
}

.signature-tab.active {
    background: var(--cl-primary);
    color: white;
}

.signature-tab-content {
    margin-top: 0.75rem;
}

.signature-canvas-container {
    background: white;
    border-radius: 8px;
    padding: 4px;
    position: relative;
}

.signature-canvas-container canvas {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: crosshair;
    touch-action: none;
}

.clear-signature-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.2s;
}

.clear-signature-btn:hover {
    background: #dc2626;
}

.signature-preview {
    min-height: 60px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.signature-preview img {
    max-height: 60px;
    max-width: 100%;
}

.signature-preview-container {
    background: repeating-conic-gradient(#f0f0f0 0% 25%, transparent 0% 50%) 50% / 10px 10px;
    border-radius: 8px;
    padding: 8px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-preview-container img {
    max-height: 60px;
    max-width: 100%;
}

.save-signature-option {
    padding-top: 8px;
    border-top: 1px dashed var(--cl-border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--cl-text-muted);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--cl-primary);
}

/* Form elements for signature */
.form-input,
.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--cl-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-block {
    width: 100%;
}

/* Industry Template Select */
#industryTemplateSelect {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SKILL GAP ANALYSE - Erweiterte UI
   ═══════════════════════════════════════════════════════════════════════════ */

.requirements-editor,
.skills-editor {
    padding: 1rem;
}

.requirements-editor h4,
.skills-editor h4 {
    font-size: 1.1rem;
    color: var(--cl-text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.requirements-editor .help-text,
.skills-editor .help-text {
    color: var(--cl-text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Requirements List */
.requirements-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--cl-border);
    border-radius: 8px;
    transition: all 0.2s;
}

.requirement-item:hover {
    border-color: var(--cl-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.requirement-item.dragging {
    opacity: 0.5;
    border-color: var(--cl-primary);
    background: #f0f4ff;
}

.drag-handle {
    cursor: grab;
    color: var(--cl-text-muted);
    padding: 0.25rem;
}

.drag-handle:active {
    cursor: grabbing;
}

.requirement-content {
    flex: 1;
    min-width: 0;
}

.requirement-text {
    font-size: 0.9rem;
    color: var(--cl-text);
    margin-bottom: 0.25rem;
}

.requirement-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.category-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
}

.category-badge.hard_skill { background: #dbeafe; color: #1e40af; }
.category-badge.soft_skill { background: #fce7f3; color: #9d174d; }
.category-badge.experience { background: #d1fae5; color: #065f46; }
.category-badge.qualification { background: #fef3c7; color: #92400e; }

.keywords {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
}

.priority-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.priority-control label {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
}

.priority-input {
    width: 50px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--cl-border);
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.priority-input:focus {
    outline: none;
    border-color: var(--cl-primary);
}

.priority-value {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
}

.btn-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #fecaca;
}

/* Add Requirement */
.add-requirement {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-requirement input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.add-requirement select {
    padding: 0.5rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    background: white;
    font-size: 0.85rem;
}

.btn-add {
    padding: 0.5rem 1rem;
    background: var(--cl-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-add:hover {
    background: var(--cl-primary-hover);
}

/* Requirements Actions */
.requirements-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cl-border);
}

.btn-secondary {
    padding: 0.6rem 1.25rem;
    background: white;
    color: var(--cl-text);
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--cl-text-muted);
}

/* Skills Editor */
.skills-sources {
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.skills-sources small {
    color: var(--cl-text-muted);
    font-size: 0.75rem;
}

.skills-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

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

.skills-section h5 {
    font-size: 0.9rem;
    color: var(--cl-text);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.skill-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--cl-text);
}

.skill-tag.technical {
    background: #dbeafe;
    color: #1e40af;
}

.skill-tag.soft {
    background: #fce7f3;
    color: #9d174d;
}

.skill-tag.language {
    background: #d1fae5;
    color: #065f46;
}

.skill-tag .remove-skill {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.25rem;
}

.skill-tag .remove-skill:hover {
    opacity: 1;
}

.no-skills {
    color: var(--cl-text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.add-skill-row {
    display: flex;
    gap: 0.5rem;
}

.add-skill-row input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--cl-border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.btn-add-small {
    width: 32px;
    height: 32px;
    background: var(--cl-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-small:hover {
    background: var(--cl-primary-hover);
}

.experience-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.experience-item {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.85rem;
}

.experience-item strong {
    color: var(--cl-text);
}

.experience-item small {
    display: block;
    color: var(--cl-text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.skills-actions {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.save-profile-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--cl-text);
}

.save-profile-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--cl-primary);
}

/* Loading State in Skill Gap */
.skill-gap-steps .loading-state {
    text-align: center;
    padding: 2rem;
}

.skill-gap-steps .loading-state i {
    font-size: 2rem;
    color: var(--cl-primary);
    margin-bottom: 1rem;
}

.skill-gap-steps .loading-state p {
    color: var(--cl-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLASEFFEKT BUTTONS - Modern Design
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-glass {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.8) 0%, rgba(139, 92, 246, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 15px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-glass:hover::before {
    left: 100%;
}

.btn-glass:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(99, 102, 241, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95) 0%, rgba(139, 92, 246, 0.95) 100%);
}

.btn-glass:active {
    transform: translateY(0);
}

.btn-glass.btn-icon {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-glass.btn-primary {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.9) 100%);
    box-shadow: 
        0 4px 15px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-glass.btn-primary:hover {
    box-shadow: 
        0 8px 25px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-glass.btn-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.9) 100%);
    box-shadow: 
        0 4px 15px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Generate Button mit Glaseffekt */
.btn-generate {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 20px rgba(99, 102, 241, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-generate:hover::before {
    left: 100%;
}

.btn-generate:hover {
    box-shadow: 
        0 8px 30px rgba(99, 102, 241, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-skill-gap {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9) 0%, rgba(99, 102, 241, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 15px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-skill-gap::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-skill-gap:hover::before {
    left: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PDF VORSCHAU MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.pdf-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pdf-preview-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 95vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.pdf-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--cl-primary) 0%, #8b5cf6 100%);
    color: white;
}

.pdf-preview-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.pdf-preview-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #f5f5f5;
    display: flex;
    justify-content: center;
}

.pdf-preview-page {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 210mm;
    min-height: 297mm;
    transform-origin: top center;
}

.pdf-preview-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--cl-border);
}

/* Cover Letter Modal (Dashboard) */
.cover-letter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.cover-letter-modal .modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.cover-letter-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--cl-primary) 0%, #8b5cf6 100%);
    color: white;
}

.cover-letter-modal .modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.cover-letter-modal .modal-body {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
}

.cover-letter-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--cl-border);
}

.cover-letter-modal .btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NEUE STYLES: Mehrzeiliger Adressblock & Erweiterte Einstellungen
   ═══════════════════════════════════════════════════════════════════════════ */

/* Mehrzeiliger Absender-Adressblock */
.letter-sender {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.letter-sender .sender-name {
    font-weight: 600;
    font-size: 1.05em;
    color: var(--letter-accent, var(--cl-primary));
}

.letter-sender .sender-street,
.letter-sender .sender-city,
.letter-sender .sender-contact {
    font-size: 0.9em;
    color: var(--cl-text-muted);
    font-weight: normal;
}

/* Fett/Normal Toggle für Name */
.letter-sender.name-normal .sender-name {
    font-weight: normal;
}

/* Mehrzeiliger Firmen-Adressblock */
.letter-recipient {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 1.5rem;
}

.letter-recipient .company-name {
    font-weight: 500;
    color: var(--cl-text);
}

.letter-recipient.company-bold .company-name {
    font-weight: 700;
}

.letter-recipient .company-street,
.letter-recipient .company-location,
.letter-recipient .contact-person {
    font-size: 0.95em;
    color: var(--cl-text);
}

/* Datum Container */
.letter-date-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.letter-location {
    font-size: 0.9em;
    color: var(--cl-text-muted);
}

/* Datum Positionen */
.letter-header.date-top-left .letter-date-container {
    order: -1;
    align-items: flex-start;
}

.letter-header.date-below-sender .letter-date-container {
    position: static;
    align-items: flex-start;
    margin-top: 1rem;
}

/* Betreff mit einstellbaren Abständen */
.letter-subject {
    margin-top: var(--subject-margin-top, 15mm);
    margin-bottom: var(--subject-margin-bottom, 10mm);
}

.letter-subject .subject-label {
    font-weight: 600;
}

.letter-subject.subject-normal .subject-label {
    font-weight: normal;
}

/* Letter Body ohne Scrollbar */
.letter-body {
    overflow: visible !important;
    min-height: auto;
}

.letter-text-content {
    width: 100%;
    min-height: 200px;
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    padding: 0;
    outline: none;
    white-space: pre-wrap;
}

.letter-text-content:empty::before {
    content: attr(data-placeholder);
    color: var(--cl-text-muted);
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SEITENUMBRUCH-INDIKATOR - Dezent & Informativ
   ═══════════════════════════════════════════════════════════════════════════ */
.page-break-indicator {
    display: none;
    position: absolute;
    left: -10px;
    right: -10px;
    height: 0;
    border-top: 1px dashed rgba(99, 102, 241, 0.3);
    color: var(--cl-text-muted);
    font-size: 0.65rem;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}

.page-break-indicator.visible {
    display: block;
}

.page-break-indicator span {
    position: relative;
    top: -0.5rem;
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Hover-Effekt für mehr Info */
.page-break-indicator:hover span {
    background: rgba(99, 102, 241, 0.1);
    color: var(--cl-primary);
    border-color: var(--cl-primary);
}

/* Seiten-Container */
.letter-page-container {
    min-height: 297mm;
    position: relative;
}

/* Signatur Name Formatierung */
.signature-name-input.signature-bold {
    font-weight: 700;
}

/* Übersetzungs-Dropdown */
.translate-dropdown {
    position: relative;
    display: inline-block;
}

.translate-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.4rem 0.8rem !important;
    width: auto !important;
}

.translate-btn span {
    font-size: 0.8rem;
}

.translate-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--cl-border);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.translate-dropdown-menu.show {
    display: block;
}

.translate-dropdown-menu .translate-menu-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cl-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--cl-border);
    margin-bottom: 0.25rem;
}

.translate-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--cl-text);
    transition: background 0.15s;
}

.translate-dropdown-menu button:hover {
    background: var(--cl-bg);
}

/* Editor Toolbar Anpassungen */
.editor-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--cl-border);
    margin: 0 0.5rem;
}

/* Absatz-Abstand anwenden */
.letter-text-content p {
    margin-bottom: var(--paragraph-spacing, 10px);
}

.letter-text-content p:last-child {
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE - Umfassende Anpassungen
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tablet - Design-Panel als Toggle */
@media (max-width: 1400px) {
    :root {
        --cl-design-width: 280px;
    }
}

/* Tablet kleiner */
@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: var(--cl-sidebar-width) 1fr;
    }
    
    /* Design Panel als Overlay auf Tablets */
    .editor-design-panel {
        position: fixed;
        right: 0;
        top: 70px;
        bottom: 0;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .editor-design-panel.mobile-open {
        transform: translateX(0);
    }
    
    /* Toggle Button für Design Panel */
    .design-panel-toggle {
        display: flex !important;
    }
}

/* Mobile - Alles stacked */
@media (max-width: 768px) {
    .cover-letter-editor {
        padding-top: 60px;
    }
    
    .editor-header {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .editor-title h1 {
        font-size: 1rem;
    }
    
    .editor-title p {
        display: none;
    }
    
    .btn-back {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .editor-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
    
    /* Layout auf Mobile: Single Column */
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    /* Sidebar als Accordion auf Mobile */
    .editor-sidebar {
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--cl-border);
        padding: 1rem;
    }
    
    .sidebar-section {
        margin-bottom: 1rem;
    }
    
    .sidebar-section h3 {
        cursor: pointer;
        padding: 0.75rem;
        margin: -0.75rem -0.75rem 0.75rem -0.75rem;
        background: var(--cl-bg);
        border-radius: 6px;
    }
    
    /* Collapsed sections auf Mobile */
    .sidebar-section.mobile-collapsed .form-group,
    .sidebar-section.mobile-collapsed .option-group,
    .sidebar-section.mobile-collapsed .placeholder-grid {
        display: none;
    }
    
    /* Editor Content volle Breite */
    .editor-content {
        padding: 1rem;
    }
    
    .letter-preview-container {
        padding: 0;
    }
    
    .generated-letter {
        padding: 1rem;
        font-size: 14px;
    }
    
    .letter-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .letter-date {
        position: static;
        text-align: left;
    }
    
    /* Design Panel als Full-Screen Modal auf Mobile */
    .editor-design-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        z-index: 200;
        transform: translateX(100%);
        padding: 1rem;
        padding-top: 60px;
    }
    
    .editor-design-panel.mobile-open {
        transform: translateX(0);
    }
    
    /* Close Button für Mobile Design Panel */
    .editor-design-panel .mobile-close-btn {
        display: flex;
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        background: var(--cl-bg);
        border-radius: 50%;
        border: none;
        cursor: pointer;
        z-index: 10;
    }
    
    .translate-dropdown-menu {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 300px;
        max-height: 70vh;
    }
    
    .translate-btn span {
        display: none;
    }
    
    /* Toolbar auf Mobile */
    .editor-toolbar {
        flex-wrap: wrap;
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }
    
    .toolbar-divider {
        display: none;
    }
    
    /* Form Groups */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Verhindert iOS Zoom */
    }
    
    .option-buttons {
        gap: 0.25rem;
    }
    
    .option-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }
    
    /* Quality Check auf Mobile */
    .quality-checks {
        padding: 0.75rem;
    }
    
    .quality-item {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* PDF Preview Modal auf Mobile */
    .pdf-preview-modal .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .pdf-preview-page {
        width: 100%;
        transform: scale(0.5);
        transform-origin: top center;
    }
}

/* Sehr kleine Screens */
@media (max-width: 480px) {
    .editor-header {
        padding: 0.5rem;
    }
    
    .editor-title h1 {
        font-size: 0.9rem;
    }
    
    .btn-back span {
        display: none;
    }
    
    .generated-letter {
        padding: 0.75rem;
        font-size: 13px;
    }
    
    .letter-sender,
    .letter-recipient {
        font-size: 0.85rem;
    }
    
    .sidebar-section h3 {
        font-size: 0.8rem;
    }
}

/* Toggle Button für Design Panel (Hidden by default) */
.design-panel-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--cl-primary) 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 99;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.design-panel-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Overlay für Mobile Panels */
.mobile-panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.mobile-panel-overlay.active {
    display: block;
}

/* Design: Datum-Offset */
.letter-date-container {
    margin-top: var(--date-top-offset, 0);
}
