/* Document Comparison Page Styles */

/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1f2937;
    background: #f9fafb;
    line-height: 1.6;
}

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

/* Header */
.comparison-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;
}

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

.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;
}

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

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

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

/* Drugs Overview */
.drugs-overview {
    padding: 32px 0;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.overview-header {
    text-align: left;
    margin-bottom: 24px;
}

.overview-title {
    font-size: 22px;
    font-weight: 600;
}

.overview-subtitle {
    font-size: 16px;
    color: #64748b;
}

.drugs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.drug-overview-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.drug-overview-card.base-drug {
    border-color: #2563eb;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.15);
}

.card-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.base-label {
    background: #2563eb;
    color: #fff;
    display: block;
    margin: -8px -16px;
    padding: 8px 16px;
}

.compare-label {
    background: #f3f4f6;
    color: #4b5563;
}

.card-content {
    padding: 16px;
}

.drug-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.drug-details .detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 6px;
}

.detail-row .label {
    color: #64748b;
}

.generic-badge,
.brand-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
}

.generic-badge {
    background: #10b981;
}

.brand-badge {
    background: #f59e0b;
}

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

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

.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;
}

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

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

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

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

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

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

.controls-actions > * {
    flex-shrink: 0;
}

.controls-actions button {
    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;
}

.controls-actions button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.controls-actions button .material-icons {
    font-size: 18px;
}

.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;
}

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

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

.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;
}

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

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


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

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

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

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

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

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

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 160px);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    position: relative;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1500px;
}

.comparison-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 20;
}

.comparison-table thead tr:first-child th:first-child {
    position: sticky;
    left: 0;
    z-index: 11;
    background: #f9fafb;
}

.drug-header-cell {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    min-width: 200px;
    width: 200px;
    background: #f9fafb;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 30; /* Ensure it stays on top-left corner above other headers */
    height: 80px;
    vertical-align: middle;
}

.section-header-cell {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    border-bottom: 2px solid #e5e7eb;
    min-width: 300px;
    vertical-align: middle;
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 5;
}

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

.section-name {
    color: #1f2937;
}

.section-header-content .diff-indicator {
    background-color: #ffc107;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    width: fit-content;
}

.comparison-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
}

.comparison-table tbody tr.base-drug-row {
    background: #eff6ff;
}

.drug-label-cell {
    padding: 12px 16px;
    vertical-align: top;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    position: sticky;
    left: 0;
    z-index: 5;
    height: 80px;
    overflow: hidden;
}

.base-drug-row .drug-label-cell {
    background: #eff6ff;
}

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

.drug-label-content .base-badge {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    width: fit-content;
}

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

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

.content-cell {
    padding: 12px 12px;
    vertical-align: top;
    min-width: 300px;
}

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

.basic-info-content {
    height: 100px;
    overflow-y: auto;
    font-size: 12px;
}

.basic-info-content .info-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
    font-size: 12px;
}

.basic-info-content .info-label {
    color: #64748b;
    font-weight: 500;
    margin-bottom: 1px;
}

.basic-info-content .info-value {
    color: #1f2937;
    word-break: break-word;
}

.content-cell .text-content {
    line-height: 1.5;
    color: #374151;
    font-size: 12px;
    white-space: pre-line;
    max-height: 200px;
    overflow-y: auto;
}

.content-cell .no-data {
    color: #9ca3af;
    font-style: italic;
    font-size: 11px;
}

.comparison-table tbody tr:last-child {
    border-bottom: none;
}

.comparison-table tbody tr.base-drug-row {
    background: #eff6ff;
}

.drug-label-cell {
    padding: 12px 16px;
    vertical-align: top;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    position: sticky;
    left: 0;
    z-index: 5;
    height: auto;
    min-height: 80px;
}

.base-drug-row .drug-label-cell {
    background: #eff6ff;
}

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

.drug-label-content .base-badge {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    width: fit-content;
}

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

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

.content-cell {
    padding: 12px 16px;
    vertical-align: top;
    min-width: 250px;
}

.basic-info-content {
    max-height: 120px;
    overflow-y: auto;
}

.basic-info-content .info-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    font-size: 12px;
}

.basic-info-content .info-label {
    color: #64748b;
    font-weight: 500;
    margin-bottom: 2px;
}

.basic-info-content .info-value {
    color: #1f2937;
    word-break: break-word;
}

.content-cell .text-content {
    line-height: 1.7;
    color: #374151;
    font-size: 13px;
    white-space: pre-line;
    max-height: 200px;
    overflow-y: auto;
}

.content-cell .no-data {
    color: #9ca3af;
    font-style: italic;
    font-size: 13px;
}

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

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

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

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

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

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

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