/* Inversetigator - Shared Styles */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f5f5;
    color: #333;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 5px;
}

h2 {
    color: #34495e;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-top: 0;
}

/* Header */
.header-container {
    position: relative;
}

.version-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #34495e;
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

.tagline {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-style: italic;
}

/* Navigation */
.nav-links {
    text-align: center;
    margin-bottom: 20px;
}

.nav-links a {
    color: #3498db;
    text-decoration: none;
    margin: 0 15px;
}

.nav-links a:hover {
    text-decoration: underline;
}

/* Container */
.container {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Buttons */
button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 8px 12px;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.button-row a {
    color: #7f8c8d;
    font-size: 13px;
}

/* Inversion Inputs */
.inversion-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inversion-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.inversion-row label {
    font-weight: bold;
    min-width: 80px;
    color: #2c3e50;
}

.inversion-row input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 140px;
}

.inversion-row input:focus {
    outline: none;
    border-color: #3498db;
}

.color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

.order-badge {
    background: #34495e;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Explanation Box */
.explanation {
    background: #e8f4f8;
    border-left: 4px solid #3498db;
    padding: 15px;
    margin-top: 20px;
    border-radius: 0 4px 4px 0;
}

.explanation h3 {
    margin-top: 0;
    color: #2980b9;
}

.explanation p {
    margin: 10px 0;
    line-height: 1.6;
}

.explanation code {
    background: #d5e8f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: #7f8c8d;
    font-size: 13px;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Citation Box */
.citation-box {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.citation-text {
    font-family: monospace;
    font-size: 12px;
    background: white;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    user-select: all;
    cursor: text;
}

.citation-box button {
    padding: 5px 10px;
    font-size: 12px;
}

/* ===== Breakpoint Analysis Page Specific ===== */

.visualization {
    position: relative;
    height: 200px;
    background: #ecf0f1;
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
}

.chromosome-line {
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    height: 4px;
    background: #7f8c8d;
    transform: translateY(-50%);
}

.inversion-bar {
    position: absolute;
    height: 30px;
    border-radius: 4px;
    opacity: 0.7;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.breakpoint-marker {
    position: absolute;
    width: 3px;
    background: #2c3e50;
    z-index: 10;
}

.breakpoint-label {
    position: absolute;
    font-size: 10px;
    color: #2c3e50;
    white-space: nowrap;
    transform: rotate(-45deg);
    transform-origin: left bottom;
}

.scale-label {
    position: absolute;
    bottom: 5px;
    font-size: 11px;
    color: #7f8c8d;
}

.inversion-label {
    position: absolute;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
}

/* Results Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #34495e;
    color: white;
}

tr:hover {
    background: #f5f5f5;
}

.signature {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
}

.signature-normal {
    color: #e74c3c;
}

.signature-flipped {
    color: #27ae60;
}

.overlap-list {
    font-size: 12px;
    color: #7f8c8d;
}

.legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.no-results {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
}

/* ===== Timeline Page Specific ===== */

.timeline-visualization {
    height: auto;
    min-height: 200px;
    overflow: visible;
    padding-bottom: 40px;
}

.genome-length-input {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.genome-length-input label {
    font-weight: bold;
    color: #2c3e50;
    margin-right: 10px;
}

.genome-length-input input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 180px;
}

.genome-length-input span {
    color: #7f8c8d;
    font-size: 13px;
    margin-left: 10px;
}

/* Playback Controls */
.playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.playback-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.step-indicator {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    min-width: 200px;
    text-align: center;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.speed-control label {
    font-size: 14px;
    color: #7f8c8d;
}

.speed-control input {
    width: 100px;
}

/* Timeline Visualization */
.timeline-visualization {
    position: relative;
    min-height: 200px;
    background: #ecf0f1;
    border-radius: 4px;
    margin: 20px 0;
    overflow: visible;
    padding-bottom: 40px;
}

.stacked-genomes {
    position: relative;
    padding: 20px 20px 10px 20px;
}

.genome-row {
    position: relative;
    margin-bottom: 80px;
}

.genome-row:last-child {
    margin-bottom: 20px;
}

.genome-row.previous {
    opacity: 0.7;
}

.genome-row.current {
    opacity: 1;
}

.genome-row-label {
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-size: 10px;
    color: #666;
    font-weight: bold;
    white-space: nowrap;
}

.genome-container {
    display: flex;
    height: 40px;
    margin-left: 25px;
}

.inversion-lines-container {
    position: absolute;
    left: 45px;
    right: 20px;
    pointer-events: none;
}

.inversion-lines-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.synteny-ribbon {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.synteny-ribbon:hover {
    opacity: 0.9;
}

.synteny-ribbon.inverted {
    opacity: 0.75;
    filter: saturate(1.3);
}

/* Position Markers */
.position-markers {
    position: relative;
    height: 25px;
    margin-left: 45px;  /* 20px stacked-genomes padding + 25px genome-container margin */
    margin-right: 20px; /* Match stacked-genomes right padding */
    margin-top: 10px;
}

.position-marker {
    position: absolute;
    font-size: 10px;
    color: #555;
    transform: translateX(-50%);
    text-align: center;
}

.position-marker::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    width: 1px;
    height: 6px;
    background: #999;
}

.position-marker.major::before {
    height: 10px;
    background: #666;
}

.scale-bar {
    height: 2px;
    background: #999;
    margin-left: 45px;  /* Match position-markers */
    margin-right: 20px;
    margin-top: 5px;
}

/* Genome Segments */
.genome-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 11px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.genome-segment:last-child {
    border-right: none;
}

.genome-segment .orientation {
    position: absolute;
    bottom: 2px;
    font-size: 16px;
    opacity: 0.8;
}

.segment-label {
    position: absolute;
    top: 2px;
    font-size: 10px;
}

.inversion-highlight {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    border: 3px dashed white;
    border-radius: 4px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.scale-markers {
    position: absolute;
    bottom: 5px;
    left: 20px;
    right: 20px;
    height: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #7f8c8d;
}

/* History Panel */
.history-panel {
    margin-top: 20px;
}

.history-step {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    border-radius: 4px;
    background: #f9f9f9;
    transition: all 0.3s;
    cursor: pointer;
}

.history-step.active {
    background: #e8f4f8;
    border-left: 4px solid #3498db;
}

.history-step.completed {
    background: #e8f8e8;
    border-left: 4px solid #27ae60;
}

.history-step.future {
    opacity: 0.5;
}

.history-step .step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #34495e;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
}

.history-step.active .step-number {
    background: #3498db;
}

.history-step.completed .step-number {
    background: #27ae60;
}

.history-step .step-info {
    flex: 1;
}

.history-step .step-title {
    font-weight: bold;
    color: #2c3e50;
}

.history-step .step-desc {
    font-size: 13px;
    color: #7f8c8d;
}

/* Segment Colors Legend */
.segment-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.segment-colors .color-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 3px 8px;
    background: white;
    border-radius: 3px;
}

.segment-colors .color-box {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}
