/**
 * DocumentSidebarV5 - Styles
 * Version: 5.5.1 (Timeline Workflow v2.0 + Vertrieb-Banner)
 * Stand: 21.02.2026
 */

/* ============================================
   BACKDROP
   ============================================ */
.rc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.rc-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   SIDEBAR CONTAINER
   ============================================ */
.rc-sidebar {
    position: fixed;
    right: -440px;
    top: 0;
    bottom: 0;
    width: 420px;
    background: #ffffff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    overflow: hidden;
}

.rc-sidebar.open {
    right: 0;
}

/* ============================================
   HEADER
   ============================================ */
.rc-header {
    background: #fefffe;
    padding: 16px 24px 12px 24px;
    position: relative;
}

.rc-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.rc-close-btn:hover {
    background: #e2e8f0;
    color: #374151;
}

.rc-header-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.rc-customer-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.rc-customer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.rc-customer-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #22c55e;
}

.rc-rma-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rc-rma-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.rc-rma-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 2x2 Info Grid */
.rc-info-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.rc-rma-cell .rc-info-label {
    margin-bottom: 2px;
}

.rc-rma-cell .rc-rma-row {
    margin-bottom: 0;
}

.rc-rma-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

/* Geräteanzahl */
.rc-device-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #64748b;
}

.rc-device-count svg {
    stroke: #94a3b8;
}

.rc-device-count strong {
    color: #3b82f6;
}

/* Divider (Trennlinie) */
.rc-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 16px 0;
}

/* Divider volle Breite */
.rc-divider-full {
    height: 1px;
    background: #e2e8f0;
}

/* Device Box mit hellblauem Hintergrund (im Header) */
.rc-device-box-inline {
    background: #f8faff;
    margin: 12px -24px 0 -24px;
    padding: 12px 24px;
    border-top: 1px solid #e8f0fe;
    border-bottom: 1px solid #e8f0fe;
}

/* Device Box mit Hintergrund (standalone) */
.rc-device-box {
    background: #f8fafc;
    padding: 12px 24px;
}

.rc-device-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

/* Info Section */
.rc-info-section {
    padding: 16px 24px;
}

.rc-status-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

.rc-status-badge.erledigt {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.rc-status-badge.bei-dienstleister {
    background: #eff6ff;
    color: #3b82f6;
    border-color: #bfdbfe;
}

.rc-status-badge.verschickt {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.rc-device-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}

/* Separator Line */
.rc-separator {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.rc-serial-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* Serial Row ohne Border (für inline Device Box) */
.rc-serial-row-inline {
    display: flex;
    gap: 10px;
}

.rc-serial-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.rc-serial-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Serial Item mit blauer Border (für hellblauen Hintergrund) */
.rc-serial-item-blue {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.rc-serial-item-blue:hover {
    background: #f0f7ff;
    border-color: #93c5fd;
}

.rc-serial-label {
    font-size: 0.7rem;
    color: #6b7280;
    font-weight: 600;
}

.rc-serial-value {
    font-size: 0.8rem;
    font-family: monospace;
    font-weight: 600;
    color: #1e293b;
}

/* ============================================
   INFO GRID (2x2 mit Icons)
   ============================================ */
.rc-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.rc-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rc-info-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rc-info-icon.green {
    background: #ecfdf5;
    color: #10b981;
}

.rc-info-icon.green svg {
    stroke: #10b981;
}

.rc-info-icon.blue {
    background: #eff6ff;
    color: #3b82f6;
}

.rc-info-icon.blue svg {
    stroke: #3b82f6;
}

.rc-highlight {
    color: #3b82f6;
}

.rc-info-icon.purple {
    background: #f5f3ff;
    color: #8b5cf6;
}

.rc-info-icon.purple svg {
    stroke: #8b5cf6;
}

.rc-info-icon.yellow {
    background: #fef3c7;
    color: #f59e0b;
}

.rc-info-icon.yellow svg {
    stroke: #f59e0b;
}

.rc-info-text {
    flex: 1;
    min-width: 0;
}

.rc-info-label {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rc-info-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-info-full {
    grid-column: span 2;
}

/* ============================================
   CUSTOMER SECTION (Legacy - kann entfernt werden)
   ============================================ */
.rc-customer {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.rc-customer-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.rc-customer-meta {
    display: flex;
    gap: 24px;
}

.rc-meta-item {
    display: flex;
    flex-direction: column;
}

.rc-meta-label {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rc-meta-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

/* ============================================
   TABS
   ============================================ */
.rc-tabs-split {
    display: flex;
    padding: 0 20px;
    background: #ffffff;
}

.rc-tab-split {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rc-tab-split:hover {
    color: #475569;
}

.rc-tab-split.active {
    color: #10b981;
    border-bottom-color: #10b981;
}

.rc-tab-badge {
    padding: 1px 6px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
}

.rc-tab-split.active .rc-tab-badge {
    background: #dcfce7;
    color: #166534;
}

/* ============================================
   TAB CONTENT
   ============================================ */
.rc-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 20px;
    display: flex;
    flex-direction: column;
}

/* Timeline Tab - füllt verfügbaren Platz */
.rc-timeline-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ============================================
   WORKFLOW BADGE - Responsive
   ============================================ */
.rc-workflow-badge {
    display: inline-flex;
    align-items: center;
    gap: clamp(3px, 0.6vh, 6px);
    padding: clamp(2px, 0.5vh, 4px) clamp(6px, 1vh, 10px);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: clamp(8px, 1.5vh, 14px);
    font-size: clamp(0.6rem, 1.2vh, 0.75rem);
    font-weight: 600;
    color: #64748b;
    margin-bottom: clamp(6px, 1.2vh, 12px);
    flex-shrink: 0;
}

.rc-workflow-badge svg {
    width: clamp(10px, 2vh, 16px);
    height: clamp(10px, 2vh, 16px);
}

.rc-workflow-badge.feig,
.rc-workflow-badge.ext-rma {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.rc-workflow-badge.feig svg,
.rc-workflow-badge.ext-rma svg {
    stroke: #3b82f6;
}

.rc-workflow-badge.extern {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.rc-workflow-badge.extern svg {
    stroke: #d97706;
}

/* ============================================
   TIMELINE (MIT BOX-ICONS)
   Responsive: Passt sich automatisch an Monitorhöhe an
   ============================================ */
.rc-timeline-modern {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    min-height: 0;
}

.rc-tl-item {
    display: flex;
    align-items: stretch;  /* Marker-wrapper volle Höhe für durchgängige Linie */
    gap: clamp(8px, 2vw, 12px);
    min-height: clamp(32px, 6vh, 48px);
    flex: 1;
}

.rc-tl-marker-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
    align-self: stretch;  /* Volle Höhe des Items */
}

/* NEU: Box Icon Marker - Responsive */
.rc-tl-marker-box {
    width: clamp(20px, 4vh, 28px);
    height: clamp(20px, 4vh, 28px);
    border-radius: clamp(4px, 0.8vh, 6px);
    border: 1.5px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    transition: all 0.2s ease;
}

.rc-tl-marker-box svg {
    width: clamp(10px, 2vh, 14px);
    height: clamp(10px, 2vh, 14px);
}

/* Pulse Animation für aktive Steps */
.rc-tl-marker-pulse {
    animation: markerPulse 2s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0);
    }
}

/* Connector Line - Durchgängig ohne Lücken */
.rc-tl-connector {
    width: 2px;
    flex: 1;
    min-height: 0;
    margin: 0;
    background: #e2e8f0;
    transition: background 0.2s;
}

.rc-tl-connector.done {
    background: #a7f3d0;
}

.rc-tl-connector.active {
    background: linear-gradient(180deg, #93c5fd 0%, #e2e8f0 100%);
}

/* Content - Responsive */
.rc-tl-content {
    flex: 1;
    padding-bottom: clamp(4px, 1vh, 8px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-self: flex-start;  /* Bleibt oben auch wenn item stretch ist */
    padding-top: clamp(3px, 0.5vh, 5px);  /* Ausrichtung mit Icon-Mitte */
}

.rc-tl-title {
    font-size: clamp(0.7rem, 1.5vh, 0.85rem);
    font-weight: 600;
    color: #1e293b;
    line-height: 1;
    margin: 0;
}

.rc-tl-item.pending .rc-tl-title {
    color: #94a3b8;
}

.rc-tl-meta {
    font-size: clamp(0.6rem, 1.3vh, 0.75rem);
    color: #64748b;
    line-height: 1.2;
    margin-top: 2px;
}

.rc-tl-item.pending .rc-tl-meta {
    color: #cbd5e1;
}

/* NEU: Detail/Bemerkung unter dem Meta - Responsive */
.rc-tl-detail {
    margin-top: clamp(3px, 0.6vh, 6px);
    padding: clamp(4px, 0.8vh, 8px) clamp(6px, 1vh, 10px);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: clamp(4px, 0.8vh, 8px);
    font-size: clamp(0.6rem, 1.2vh, 0.72rem);
    color: #475569;
    line-height: 1.35;
    word-break: break-word;
}

.rc-tl-item.pending .rc-tl-detail {
    background: #fafafa;
    border-color: #f1f5f9;
    color: #94a3b8;
}

/* Hover Effect */
.rc-tl-item:hover .rc-tl-marker-box {
    transform: scale(1.05);
}

/* Vertrieb-Banner (Gelb) */
.rc-tl-item.rc-tl-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.rc-tl-detail-warning {
    background: #fef9c3 !important;
    border-color: #fde68a !important;
    color: #92400e !important;
    font-size: 0.82rem;
}

/* ============================================
   DOCUMENTS LIST
   ============================================ */
.rc-documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================
   DRAG & DROP ZONE (v5.5)
   ============================================ */
.rc-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    margin-bottom: 16px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}
.rc-dropzone:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.rc-dropzone.dragover {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.01);
}
.rc-dropzone svg {
    color: #94a3b8;
    margin-bottom: 8px;
    transition: color 0.2s;
}
.rc-dropzone:hover svg,
.rc-dropzone.dragover svg {
    color: #3b82f6;
}
.rc-dropzone-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}
.rc-dropzone-subtext {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* Upload Progress */
.rc-upload-progress {
    padding: 8px 0;
    margin-bottom: 12px;
}
.rc-upload-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}
.rc-upload-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s;
}
.rc-upload-text {
    font-size: 0.75rem;
    color: #64748b;
}

/* Document Action Buttons */
.rc-doc-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.rc-document-item:hover .rc-doc-actions {
    opacity: 1;
}
.rc-doc-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.rc-doc-btn.download {
    background: #eff6ff;
    color: #3b82f6;
}
.rc-doc-btn.download:hover {
    background: #dbeafe;
}
.rc-doc-btn.delete {
    background: #fef2f2;
    color: #ef4444;
}
.rc-doc-btn.delete:hover {
    background: #fee2e2;
}

/* Document Type Icon Colors */
.rc-doc-icon.pdf { background: #fef2f2; border-color: #fecaca; }
.rc-doc-icon.img { background: #eff6ff; border-color: #bfdbfe; }
.rc-doc-icon.doc { background: #eff6ff; border-color: #bfdbfe; }
.rc-doc-icon.xls { background: #f0fdf4; border-color: #bbf7d0; }

.rc-document-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.rc-document-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.rc-doc-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-doc-info {
    flex: 1;
}

.rc-doc-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

.rc-doc-meta {
    font-size: 0.75rem;
    color: #64748b;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.rc-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #94a3b8;
    text-align: center;
}

.rc-empty-state svg {
    margin-bottom: 12px;
}

.rc-empty-state span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================
   ERROR MESSAGE
   ============================================ */
.rc-error-message {
    padding: 40px 20px;
    text-align: center;
    color: #ef4444;
    font-weight: 500;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.rc-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.rc-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* ============================================
   LEGACY MARKER SUPPORT (FALLBACK)
   ============================================ */
.rc-tl-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}

.rc-tl-marker.done {
    background: #10b981;
    color: white;
}

.rc-tl-marker.active {
    background: #3b82f6;
    color: white;
    animation: markerPulse 2s infinite;
}

.rc-tl-marker.pending {
    background: #e2e8f0;
    color: #94a3b8;
}

.rc-tl-marker.failed {
    background: #ef4444;
    color: white;
}
