/**
 * ═══════════════════════════════════════════════════════════════════════════
 * REPCENTER DOCUMENT SIDEBAR - MOCKUP 3 v2 - PIXELGENAU
 * ALLE KLASSEN MIT doc-sidebar- PRÄFIX UM KONFLIKTE ZU VERMEIDEN!
 * ═══════════════════════════════════════════════════════════════════════════
 * @date 2026-01-25
 */

/* ═══════════════════════════════════════════════════════════════════════════
   BACKDROP
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(1px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 998;
}

.doc-sidebar-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 12px rgba(0,0,0,0.08);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.doc-sidebar.open {
    transform: translateX(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER - Was ist es? (RMA, Gerät, Seriennummern)
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-header {
    padding: 20px 24px 16px;
    background: #ffffff;
}

.doc-sidebar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.doc-sidebar-header-left {
    flex: 1;
}

.doc-sidebar-rma-label {
    font-size: 0.6rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 2px;
}

.doc-sidebar-rma-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.doc-sidebar-rma-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.doc-sidebar-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    color: #64748b;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    border: 1px solid #e2e8f0;
}

.doc-sidebar-status-badge.status-open { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.doc-sidebar-status-badge.status-progress { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.doc-sidebar-status-badge.status-done { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.doc-sidebar-status-badge.status-shipped { background: #faf5ff; color: #7c3aed; border-color: #e9d5ff; }
.doc-sidebar-status-badge.status-extern { background: #fdf2f8; color: #be185d; border-color: #fbcfe8; }

.doc-sidebar-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.doc-sidebar-device-info {
    margin-bottom: 10px;
}

.doc-sidebar-device-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
}

.doc-sidebar-serials {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-sidebar-serial-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.doc-sidebar-serial-pill:hover {
    border-color: #cbd5e1;
}

.doc-sidebar-serial-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
}

.doc-sidebar-serial-pill code {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-weight: 500;
    color: #334155;
    font-size: 0.75rem;
}

.doc-sidebar-serial-pill .copy-icon {
    width: 11px;
    height: 11px;
    color: #cbd5e1;
    opacity: 0;
    transition: opacity 0.15s;
}

.doc-sidebar-serial-pill:hover .copy-icon {
    opacity: 1;
}

.doc-sidebar-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.15s;
}

.doc-sidebar-close-btn:hover {
    background: #f1f5f9;
    color: #64748b;
}

.doc-sidebar-close-btn svg {
    width: 16px;
    height: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CUSTOMER CONTEXT - Für wen & unter welchen Bedingungen?
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-customer-context {
    padding: 14px 24px 16px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.doc-sidebar-context-row {
    display: flex;
    gap: 32px;
    margin-bottom: 12px;
}

.doc-sidebar-context-row:last-child {
    margin-bottom: 0;
}

.doc-sidebar-context-item {
    flex: 1;
    min-width: 0;
}

.doc-sidebar-context-item.full {
    flex: 100%;
}

.doc-sidebar-context-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.doc-sidebar-context-value {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    line-height: 1.3;
}

.doc-sidebar-context-value.dienstleister {
    font-weight: 600;
    color: #1e293b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABS - Actions (Was mache ich jetzt?)
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-tabs {
    display: flex;
    background: #f8fafc;
    padding: 4px;
    margin: 14px 24px;
    border-radius: 6px;
    gap: 2px;
}

.doc-sidebar-tab-btn {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.doc-sidebar-tab-btn svg {
    width: 14px;
    height: 14px;
}

.doc-sidebar-tab-btn:hover {
    color: #475569;
}

.doc-sidebar-tab-btn.active {
    background: white;
    color: #1e293b;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.doc-sidebar-tab-count {
    background: #e2e8f0;
    color: #64748b;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 500;
}

.doc-sidebar-tab-btn.active .doc-sidebar-tab-count {
    background: #475569;
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.doc-sidebar-content::-webkit-scrollbar {
    width: 5px;
}

.doc-sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.doc-sidebar-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.doc-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DOCUMENT CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-doc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding-top: 4px;
}

.doc-sidebar-doc-card {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.doc-sidebar-doc-card:hover {
    border-color: #e2e8f0;
    background: #fafafa;
}

.doc-sidebar-doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    background: #fef2f2;
    color: #ef4444;
}

.doc-sidebar-doc-icon svg {
    width: 18px;
    height: 18px;
}

.doc-sidebar-doc-info {
    flex: 1;
    min-width: 0;
}

.doc-sidebar-doc-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-sidebar-doc-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-sidebar-doc-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    opacity: 0;
    transform: translateX(8px);
    transition: all 0.2s;
}

.doc-sidebar-doc-card:hover .doc-sidebar-doc-actions {
    opacity: 1;
    transform: translateX(0);
}

.doc-sidebar-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    position: relative;
}

.doc-sidebar-action-btn svg {
    width: 14px;
    height: 14px;
}

.doc-sidebar-action-btn:hover {
    background: #f1f5f9;
    color: #64748b;
}

.doc-sidebar-action-btn.print:hover {
    color: #16a34a;
}

.doc-sidebar-action-btn.email:hover {
    color: #d97706;
}

.doc-sidebar-action-btn.teams:hover {
    color: #7c3aed;
}

/* Tooltip */
.doc-sidebar-action-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s;
    margin-bottom: 4px;
    z-index: 100;
}

.doc-sidebar-action-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTES BOX
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-notes-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 12px;
}

.doc-sidebar-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.doc-sidebar-notes-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.doc-sidebar-notes-label svg {
    width: 12px;
    height: 12px;
}

.doc-sidebar-notes-edit {
    font-size: 0.7rem;
    color: #92400e;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.7;
}

.doc-sidebar-notes-edit:hover {
    opacity: 1;
}

.doc-sidebar-notes-edit svg {
    width: 11px;
    height: 11px;
}

.doc-sidebar-notes-text {
    font-size: 0.8rem;
    color: #78350f;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TIMELINE
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-timeline {
    position: relative;
    padding-left: 28px;
}

.doc-sidebar-timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 50px;
    bottom: 20px;
    width: 1px;
    background: #e2e8f0;
    border-radius: 1px;
}

.doc-sidebar-tl-item {
    position: relative;
    padding: 8px 0;
}

.doc-sidebar-tl-marker {
    position: absolute;
    left: -28px;
    top: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1.5px solid #e2e8f0;
}

.doc-sidebar-tl-marker svg {
    width: 10px;
    height: 10px;
}

.doc-sidebar-tl-marker.done {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.doc-sidebar-tl-marker.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

@keyframes doc-sidebar-marker-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0); }
}

.doc-sidebar-tl-marker.pending {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #cbd5e1;
}

.doc-sidebar-tl-content {
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 6px;
    border-left: 2px solid transparent;
    min-height: 20px;
}

.doc-sidebar-tl-content:has(.doc-sidebar-tl-meta:empty),
.doc-sidebar-tl-content:not(:has(.doc-sidebar-tl-meta)) {
    padding: 8px 14px;
}

.doc-sidebar-tl-item.active .doc-sidebar-tl-content {
    border-left-color: #3b82f6;
    background: #f8fafc;
}

.doc-sidebar-tl-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #334155;
}

.doc-sidebar-tl-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 2px;
}

.doc-sidebar-tl-meta:empty {
    display: none;
}

/* Attempt Badge */
.doc-sidebar-attempt-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    color: #64748b;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
}

/* Previous Attempts Toggle */
.doc-sidebar-previous-attempts {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-top: 12px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.15s;
}

.doc-sidebar-previous-attempts:hover {
    background: #f1f5f9;
    color: #64748b;
}

.doc-sidebar-previous-attempts .chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.doc-sidebar-previous-attempts.open .chevron {
    transform: rotate(180deg);
}

.doc-sidebar-previous-attempts-content {
    display: none;
    margin-top: 12px;
    padding: 12px;
    padding-left: 28px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    position: relative;
}

.doc-sidebar-previous-attempts-content.open {
    display: block;
}

.doc-sidebar-attempt-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: #94a3b8;
}

.doc-sidebar-empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.doc-sidebar-empty-state p {
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    margin: 0;
}

.doc-sidebar-empty-state span {
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-sidebar-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 24px;
    color: #64748b;
}

.doc-sidebar-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: doc-sidebar-spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes doc-sidebar-spin {
    to { transform: rotate(360deg); }
}

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

.doc-sidebar-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #1e293b;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

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

@media (max-width: 480px) {
    .doc-sidebar {
        width: 100vw;
    }
    
    .doc-sidebar-doc-actions {
        opacity: 1;
        transform: translateX(0);
    }
    
    .doc-sidebar-quick-bar {
        flex-direction: column;
    }
    
    .doc-sidebar-quick-item {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
}
