/* EagleIV by NeoRx - Pharmacist Review Workflow Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* Top Navigation Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    height: 50px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.logo-highlight {
    color: #00bfa5;
}

.logo-subtitle {
    font-size: 14px;
    color: #666;
    margin-left: 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

.station-status {
    background: #00bfa5;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 50px);
}

/* Left Sidebar */
.sidebar-left {
    width: 220px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.queue-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.queue-count {
    background: #00bfa5;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.search-box {
    display: flex;
    align-items: center;
    margin: 12px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    gap: 8px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    width: 100%;
}

.search-icon {
    color: #999;
}

.queue-list {
    flex: 1;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.queue-item:hover {
    background: #f9f9f9;
}

.queue-item.active {
    background: #e8f5f3;
    border-left: 3px solid #00bfa5;
}

.patient-initials {
    width: 32px;
    height: 32px;
    background: #e0e0e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-right: 10px;
    flex-shrink: 0;
}

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

.patient-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.patient-med {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.patient-due {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #e3f2fd;
    color: #1976d2;
}

.status-queued {
    background: #f5f5f5;
    color: #666;
}

.status-stat {
    background: #ffebee;
    color: #d32f2f;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #f5f5f5;
    overflow: visible;
}

.video-container {
    flex: 1;
    background: #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#workflow-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.9);
    transition: opacity 0.3s;
}

.video-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.play-button {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.play-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.ready-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 2px;
}

/* Timeline */
.timeline-container {
    background: white;
    border-radius: 12px;
    padding: 16px 24px;
    margin-top: 16px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.timeline-title {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
}

.timeline-total {
    font-size: 11px;
    color: #666;
}

.timeline-track {
    position: relative;
    height: 80px;
    padding: 0 20px;
    margin-top: 20px;
}

.timeline-bar {
    position: absolute;
    top: 26px;
    left: 20px;
    right: 20px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
}

.timeline-progress-fill {
    height: 100%;
    background: #00bfa5;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.timeline-stages {
    position: relative;
    height: 100%;
}

.timeline-stage {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    cursor: pointer;
    z-index: 1;
    top: 20px;
}

.timeline-stage.label-above {
    top: auto;
    bottom: 40px;
    flex-direction: column-reverse;
}

.timeline-stage.label-above .stage-dot {
    margin-bottom: 0;
    margin-top: 8px;
}

.timeline-stage.label-above .stage-time {
    margin-top: 0;
    margin-bottom: 2px;
}

.stage-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #e0e0e0;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.timeline-stage:hover .stage-dot {
    transform: scale(1.15);
}

.timeline-stage.completed .stage-dot {
    background: #00bfa5;
    box-shadow: 0 0 0 2px #00bfa5;
}

.timeline-stage.active .stage-dot {
    background: #ffc107;
    box-shadow: 0 0 0 2px #ffc107;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.stage-label {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    text-align: center;
}

.stage-time {
    font-size: 9px;
    color: #999;
    font-family: monospace;
    margin-top: 2px;
}

/* Right Sidebar */
.sidebar-right {
    width: 320px;
    background: white;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-right-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.order-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.expand-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
}

.patient-details {
    padding: 12px 20px;
    font-size: 12px;
    color: #666;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

/* Recipe Section */
.recipe-section {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.recipe-header span:first-child {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
}

.matched-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.recipe-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.recipe-label {
    font-size: 13px;
    color: #666;
}

.recipe-value {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.recipe-value.verified {
    color: #00bfa5;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Confidence Section */
.confidence-section {
    padding: 16px 20px;
    background: #f0fdf4;
    border-bottom: 1px solid #e0e0e0;
}

.confidence-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ai-icon {
    font-size: 16px;
}

.confidence-label {
    font-size: 13px;
    color: #666;
}

.confidence-value {
    font-size: 14px;
    font-weight: 700;
    color: #00bfa5;
}

.confidence-text {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

/* Instructions Section */
.instructions-section {
    padding: 12px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.instructions-header {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.instructions-text {
    font-size: 12px;
    color: #333;
    line-height: 1.5;
}

/* Math Section */
.math-section {
    padding: 12px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.math-header {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.math-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.math-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
}

.math-label {
    color: #999;
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 12px;
}

.math-value {
    color: #333;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 11px;
    text-align: right;
}

/* Step Log Tabs */
.step-log-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.tab-btn {
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #00bfa5;
    border-bottom-color: #00bfa5;
    font-weight: 600;
}

/* Step Log */
.step-log {
    display: flex;
    flex-direction: column;
}

.step-log-header {
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
}

.step-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

.step-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 12px;
    border-bottom: 1px solid #f5f5f5;
    gap: 8px;
}

.step-info {
    display: flex;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
}

/* Step Review Buttons */
.step-review-buttons {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.step-item:hover .step-review-buttons {
    opacity: 1;
}

.step-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.step-btn-approve {
    color: #00bfa5;
}

.step-btn-approve:hover {
    background: #e0f7f4;
    border-color: #00bfa5;
}

.step-btn-reject {
    color: #d32f2f;
}

.step-btn-reject:hover {
    background: #ffebee;
    border-color: #d32f2f;
}

.step-btn-rework {
    color: #ff9800;
}

.step-btn-rework:hover {
    background: #fff3e0;
    border-color: #ff9800;
}

/* Step Review States */
.step-item.step-approved {
    background: #e8f5e9;
    border-left: 3px solid #00bfa5;
    padding-left: 8px;
    margin-left: -11px;
}

.step-item.step-approved .step-review-buttons {
    opacity: 1;
}

.step-item.step-approved .step-btn-approve {
    background: #00bfa5;
    color: white;
    border-color: #00bfa5;
}

.step-item.step-rejected {
    background: #ffebee;
    border-left: 3px solid #d32f2f;
    padding-left: 8px;
    margin-left: -11px;
}

.step-item.step-rejected .step-review-buttons {
    opacity: 1;
}

.step-item.step-rejected .step-btn-reject {
    background: #d32f2f;
    color: white;
    border-color: #d32f2f;
}

.step-item.step-rejected .step-action {
    text-decoration: line-through;
    color: #d32f2f;
}

.step-item.step-rework {
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    padding-left: 8px;
    margin-left: -11px;
}

.step-item.step-rework .step-review-buttons {
    opacity: 1;
}

.step-item.step-rework .step-btn-rework {
    background: #ff9800;
    color: white;
    border-color: #ff9800;
}

.step-action {
    color: #333;
}

.step-action.highlight {
    color: #00bfa5;
}

.step-action.verified {
    color: #00bfa5;
}

.step-action.verified::before {
    content: "\2713  ";
}

.step-action.flagged {
    color: #d32f2f;
    font-weight: 600;
}

.step-action.flagged::before {
    content: "\26A0  ";
}

.step-time {
    color: #999;
    font-family: monospace;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-rework {
    background: white;
    border: 2px solid #e0e0e0;
    color: #666;
}

.btn-rework:hover {
    border-color: #999;
    color: #333;
}

.btn-rework.active {
    background: #ffebee;
    border-color: #ef5350;
    color: #d32f2f;
}

.btn-rework.active:hover {
    background: #ffcdd2;
}

/* Rework mode styles */
.step-list.rework-mode .step-item {
    border-left: 3px solid transparent;
    margin-left: -3px;
    transition: all 0.2s;
}

.step-list.rework-mode .step-item:hover {
    background: #fff3e0;
    border-left-color: #ff9800;
}

.step-item.reworked {
    background: #ffebee !important;
    border-left: 3px solid #d32f2f !important;
    margin-left: -3px;
    position: relative;
}

.step-item.reworked::before {
    content: "⚠ REWORK";
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: 700;
    color: #d32f2f;
    background: #ffcdd2;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.step-item.reworked .step-action {
    color: #d32f2f;
    text-decoration: line-through;
    text-decoration-color: #d32f2f;
}

.btn-approve {
    background: #00bfa5;
    border: none;
    color: white;
}

.btn-approve:hover {
    background: #00a896;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f5f5f5;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Evidence Snapshot Overlay */
/* Evidence Snapshot - Horizontal Layout */
.evidence-snapshot-horizontal {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(26, 26, 46, 0.95);
    border-radius: 10px;
    margin: 12px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 160px;
    overflow: visible;
    position: relative;
}

.evidence-panel {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow-y: auto;
}

.evidence-panel.evidence-image-panel {
    overflow: visible;
}

.evidence-image-panel {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
    z-index: 100;
}

.evidence-objects-panel {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
}

.evidence-insight-panel {
    flex: 2;
    min-width: 250px;
}

.evidence-section {
    margin-bottom: 12px;
}

.evidence-section:last-child {
    margin-bottom: 0;
}

.evidence-section-title {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.evidence-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

/* Snapshot Image Styles */
.evidence-image-panel .snapshot-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 6px;
    border: 1px solid rgba(0, 191, 165, 0.3);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    position: relative;
}

.snapshot-image {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    border-radius: 4px;
    cursor: zoom-in;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: left center;
}

.snapshot-image:hover {
    transform: scale(4);
    z-index: 10000;
    position: relative;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
    border-radius: 8px;
}

.detected-objects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.object-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 12px;
}

.object-item.active {
    background: rgba(0, 191, 165, 0.2);
    border-left: 3px solid #00bfa5;
}

.object-item.warning {
    background: rgba(255, 193, 7, 0.15);
    border-left: 3px solid #ffc107;
}

.object-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00bfa5;
    flex-shrink: 0;
}

.object-item.warning .object-dot {
    background: #ffc107;
}

.object-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
}

.object-confidence {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
}

.insight-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    padding: 10px 12px;
    background: rgba(0, 191, 165, 0.1);
    border-radius: 8px;
    border-left: 3px solid #00bfa5;
}

.insight-text.warning {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
}

/* Scanning animation */
@keyframes scanning {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.object-item.scanning {
    animation: scanning 1.5s ease-in-out infinite;
}

.object-item.scanning .object-dot {
    background: #666;
}

/* Timeline Alert Markers */
.timeline-alert {
    position: absolute;
    top: 38px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    cursor: pointer;
    z-index: 2;
}

.timeline-alert .alert-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d32f2f;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #d32f2f;
    transition: all 0.2s;
}

.timeline-alert:hover .alert-dot {
    transform: scale(1.3);
    box-shadow: 0 0 0 2px #d32f2f, 0 0 8px rgba(211, 47, 47, 0.4);
}

.timeline-alert .alert-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #d32f2f;
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    margin-bottom: 6px;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timeline-alert .alert-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #d32f2f;
}

.timeline-alert:hover .alert-tooltip {
    display: block;
}
