/* Document Comparison Vertical Layout */

.dcv-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.dcv-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0 24px;
}

.dcv-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.dcv-header-left, .dcv-header-right {
    flex-shrink: 0;
}

.dcv-header-center {
    flex: 1;
    text-align: center;
}

.dcv-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dcv-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.dcv-back-btn:hover {
    background: #f3f4f6;
}

.dcv-page-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.dcv-info-badge {
    background: #10b981;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.dcv-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.dcv-switch-btn:hover {
    background: #1d4ed8;
    color: #fff;
}

.dcv-switch-btn .material-icons {
    font-size: 18px;
}

/* Section Controls */
.dcv-section-controls {
    padding: 24px 0;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.dcv-controls-header {
    display: flex;
    align-items: center;
    min-height: 32px;
    gap: 16px;
}

.dcv-panel-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font-size: 18px;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.dcv-panel-toggle-btn:hover {
    color: #2563eb;
}

.dcv-toggle-icon {
    font-size: 24px;
    transition: transform 0.2s;
}

.dcv-toggle-icon.open {
    transform: rotate(180deg);
}

.dcv-section-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.dcv-section-panel.open {
    max-height: 500px;
    opacity: 1;
}

.dcv-controls-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
}

.dcv-control-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid #d1d5db;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s;
    white-space: nowrap;
}

.dcv-control-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.dcv-control-btn .material-icons {
    font-size: 18px;
}

.dcv-toggle-differences {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-right: 16px;
    background: #f3f4f6;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.dcv-toggle-differences:hover {
    background: #e5e7eb;
}

.dcv-toggle-differences .dcv-checkbox-input {
    margin-right: 8px;
}

.dcv-section-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.dcv-section-checkbox {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.dcv-section-checkbox:hover {
    background: #e5e7eb;
}

.dcv-checkbox-input {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
}

.dcv-diff-indicator {
    background-color: #ffc107;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Comparison Area - Vertical Table */
.dcv-comparison-area {
    padding: 32px 0;
}

.dcv-table-wrapper {
    overflow: visible; /* CRITICAL: Sticky won't work if any parent has overflow: auto/hidden/scroll */
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 40px;
    position: relative;
}

.dcv-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/* Sticky header row with drug names */
.dcv-table thead {
    position: sticky;
    top: 80px; /* Adjust based on your actual header height */
    z-index: 20;
    background: #f9fafb;
}

.dcv-section-col-header {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
    min-width: 200px;
    width: 200px;
    position: sticky;
    top: 80px;
    left: 0;
    z-index: 30; /* Highest to stay on top of both row and column headers */
    vertical-align: middle;
}

.dcv-drug-col-header {
    padding: 16px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
    vertical-align: middle;
    overflow: hidden;
    word-wrap: break-word;
}

.dcv-drug-col-header.dcv-base-col {
    background: #eff6ff;
    border-bottom-color: #2563eb;
}

.dcv-drug-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dcv-base-badge {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
}

.dcv-drug-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.dcv-drug-meta {
    font-size: 12px;
    color: #64748b;
}

.dcv-no-doc-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
}

/* Table Body - Section Rows */
.dcv-section-row {
    border-bottom: 1px solid #e5e7eb;
}



.dcv-section-label-cell {
    padding: 12px 16px;
    vertical-align: top;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 200px;
    width: 200px;
    font-size: 13px;
}

.dcv-section-label-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dcv-section-name {
    font-weight: 600;
    color: #1f2937;
}

/* Content Cells */
.dcv-content-cell {
    padding: 12px 16px;
    vertical-align: top;
    border-right: 1px solid #f3f4f6;
    font-size: 13px;
    line-height: 1.6;
    overflow: hidden;
    word-wrap: break-word;
}

.dcv-content-cell:last-child {
    border-right: none;
}

.dcv-content-cell.dcv-base-cell {
    background: #fafbff;
}

.dcv-content-cell > * {
    max-height: 300px;
    overflow-y: auto;
    display: block;
}

.dcv-flat-value {
    color: #374151;
    word-break: break-word;
}

.dcv-text-content {
    color: #374151;
    white-space: pre-line;
    max-height: 300px;
    overflow-y: auto;
}

.dcv-no-data {
    color: #9ca3af;
    font-style: italic;
    font-size: 12px;
}

/* Structured Items */
.dcv-structured-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.dcv-s-item {
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
}

.dcv-s-item--diff {
    background-color: #fff8c4;
}

.dcv-s-item__num {
    font-weight: 600;
    color: #6b7280;
    margin-right: 4px;
}

.dcv-s-item__text {
    color: #374151;
}

.dcv-s-item__sub {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
    padding-left: 8px;
}

.dcv-tag-danger {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    font-weight: 600;
}

.dcv-tag-warning {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    font-weight: 600;
}

.dcv-tag-info {
    display: inline-block;
    background: #3b82f6;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.dcv-text-muted {
    color: #6b7280;
    font-size: 12px;
}

/* Diff Highlight */
.diff-highlight {
    background-color: #fff8c4;
    padding: 1px 3px;
    border-radius: 3px;
}

/* No Data Message */
.dcv-no-comparison-data {
    padding: 80px 0;
    text-align: center;
}

.dcv-message-icon {
    font-size: 48px;
    color: #9ca3af;
    margin-bottom: 16px;
}

.dcv-message-icon .material-icons {
    font-size: 48px;
}

.dcv-message-title {
    font-size: 22px;
    margin-bottom: 8px;
}

.dcv-message-description {
    color: #64748b;
    margin-bottom: 24px;
}

.dcv-back-to-search-btn {
    padding: 12px 24px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.dcv-back-to-search-btn:hover {
    background: #1d4ed8;
}

/* Alternating row colors for readability */
.dcv-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.dcv-table tbody tr:nth-child(even) .dcv-section-label-cell {
    background-color: #f5f5f5;
}

.dcv-table tbody tr:nth-child(even) .dcv-base-cell {
    background-color: #f5f8ff;
}
