/* BioAlign-Pro style.css */

/* Safety */
.hidden {
    display: none;
}

/* ==========================================================
   LIGHT mode 
   ========================================================== */
:root {
    --bg: #ffffff;
    --surface: #f9f9f9;
    --surface-hover: #f2f2f2;
    --primary: #065fd4;
    --primary-hover: #0356bf;
    --destructive: #cc0000;
    --muted: #606060;
    --border: #e5e5e5;
    --foreground: #0f0f0f;
    --background: #ffffff;
    --chip-bg: #f2f2f2;
    --chip-hover: #e5e5e5;

    --seq-alpha: #065fd4;
    --seq-beta: #1e8c45;
    --seq-mismatch: #cc0000;
    --seq-gap: #909090;

    --spacing-xs: clamp(0.375rem, 1.5vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 2vw, 0.75rem);
    --spacing-md: clamp(0.75rem, 2.5vw, 1rem);
    --spacing-lg: clamp(1rem, 3.5vw, 1.5rem);
    --spacing-xl: clamp(1.5rem, 4.5vw, 2rem);
    --spacing-2xl: clamp(2rem, 6vw, 3rem);

    --font-xs: clamp(0.75rem, 3vw, 0.875rem);
    --font-sm: clamp(0.875rem, 3.5vw, 1rem);
    --font-base: clamp(1rem, 4vw, 1.125rem);
    --font-lg: clamp(1.125rem, 4.5vw, 1.25rem);
    --font-xl: clamp(1.25rem, 5vw, 1.5rem);
    --font-2xl: clamp(1.5rem, 6vw, 2rem);
    --font-3xl: clamp(2rem, 8vw, 3rem);
}

/* ==========================================================
   DARK mode 
   ========================================================== */
.dark {
    --bg: #0f0f0f;
    --surface: #212121;
    --surface-hover: #3d3d3d;
    --primary: #3ea6ff;
    --primary-hover: #5bb8ff;
    --destructive: #ff4e45;
    --muted: #aaaaaa;
    --border: #3f3f3f;
    --foreground: #f1f1f1;
    --background: #0f0f0f;
    --chip-bg: #272727;
    --chip-hover: #3f3f3f;
}

/* ==========================================================
   Base
   ========================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: var(--font-base);
    background: var(--bg);
    color: var(--foreground);
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Panel shadow */
.panel-shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.dark .panel-shadow {
    box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}

/* ==========================================================
   Animated Motto
   ========================================================== */
.animate-motto {
    background: linear-gradient(270deg, var(--primary), #1e8c45, #8b5cf6, var(--primary));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: mottoGlow 8s ease infinite;
}

@keyframes mottoGlow {
    0% {
        background-position: 0% 50%;
        opacity: .8;
    }

    50% {
        background-position: 100% 50%;
        opacity: 1;
    }

    100% {
        background-position: 0% 50%;
        opacity: .8;
    }
}

/* ==========================================================
   Alignment text colours
   ========================================================== */
.align-match-alpha {
    color: var(--seq-alpha);
    font-weight: 700;
}

.align-match-beta {
    color: var(--seq-beta);
    font-weight: 700;
}

.align-mismatch {
    color: var(--seq-mismatch);
}

.align-gap {
    color: var(--seq-gap);
}

.align-match {
    color: var(--primary);
    font-weight: 700;
}

/* MSA blocks */
.msa-container {
    scrollbar-width: thin;
    scrollbar-color: var(--muted) transparent;
}

.msa-container::-webkit-scrollbar {
    height: 8px;
}

.msa-container::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 4px;
}

.msa-chunk {
    font-size: 13px;
    letter-spacing: -0.5px;
}

.msa-a,
.msa-t,
.msa-g,
.msa-c,
.msa-gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 18px;
    margin: 0 .5px;
    border-radius: 2px;
    font-weight: 700;
}

/* Row animation */
.line-anim {
    animation: fadeInRow .5s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInRow {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Shine effect */
.shine-wrapper {
    position: relative;
    overflow: hidden;
}

.shine-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, .08), transparent);
    transform: skewX(-20deg);
    animation: shineWave 3s infinite linear;
    pointer-events: none;
    z-index: 5;
}

@keyframes shineWave {
    0% {
        left: -150%;
    }

    20% {
        left: 150%;
    }

    100% {
        left: 150%;
    }
}

/* Toggle icon */
#optionsToggleIcon1 {
    transition: transform .2s ease-in-out;
}

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

/* ==========================================================
   Tooltip
   ========================================================== */
.tooltip-trigger {
    position: relative;
    overflow: visible;
}

.custom-tooltip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 100%;
    margin-bottom: .5rem;
    visibility: hidden;
    opacity: 0;
    width: 16rem;
    padding: .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: .75rem;
    color: var(--muted);
    border-radius: .5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, .15);
    z-index: 999999 !important;
    pointer-events: none;
    white-space: normal;
    transition: opacity .2s ease, visibility .2s ease;
}

.custom-tooltip.left-0 {
    left: 0;
    right: auto;
    transform: none;
}

.tooltip-trigger:hover .custom-tooltip,
.tooltip-trigger:focus-visible .custom-tooltip {
    visibility: visible;
    opacity: 1;
}

/* ==========================================================
   Range slider
   ========================================================== */
/* range inputs: use native rendering + accent-color for the fill track */
input[type="range"].range-slider {
    width: 100%;
    height: 20px;
    /* taller click area */
    cursor: pointer;
    accent-color: var(--primary);
    background: transparent;
    outline: none;
    border: none;
    padding: 0;
}

/* Firefox */
input[type="range"].range-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--chip-bg);
}

input[type="range"].range-slider::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--primary);
}

input[type="range"].range-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    cursor: pointer;
}

/* WebKit: keep appearance so accent-color works */
input[type="range"].range-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: var(--chip-bg);
}

input[type="range"].range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -5px;
    /* centre on track */
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    cursor: pointer;
    transition: transform .15s;
}

input[type="range"].range-slider:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

input[type="range"].range-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}


/* ==========================================================
  Chip toggle (Protein / DNA toggle)
   ========================================================== */
.yt-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem 1.1rem;
    border-radius: 99px;
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--chip-bg);
    color: var(--foreground);
    border: none;
    white-space: nowrap;
    transition: background .15s;
}

.yt-chip:hover {
    background: var(--chip-hover);
}

.yt-chip.active {
    background: var(--foreground);
    color: var(--bg);
}

/* Section spacing */
section+section {
    margin-top: 2rem;
}

/* Pro colour */
.pro-color-cycle {
    color: var(--primary);
}

/* ==========================================================
   DP Table – vivid, eye-catching custom scrollbar
   ========================================================== */
.dp-table-scroll {
    /* ✅ SCROLL ENABLE */
    max-height: 500px;   
    max-width: 100%;

    overflow: auto;      /* 🔥 main  */
    display: block;
    scrollbar-width: thin;
    scrollbar-color: #0d9488 rgba(13, 148, 136, 0.12);
}

.dp-table-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.dp-table-scroll::-webkit-scrollbar-track {
    background: rgba(13, 148, 136, 0.08);
    border-radius: 99px;
    margin: 4px;
}

.dp-table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0d9488 0%, #2563eb 100%);
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease;
}

.dp-table-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #14b8a6 0%, #3b82f6 100%);
    background-clip: padding-box;
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.55);
}

.dp-table-scroll::-webkit-scrollbar-corner {
    background: rgba(13, 148, 136, 0.08);
}
.dp-table-scroll th {
    position: sticky;
    top: 0;
    background: #111;   /* match your theme */
    z-index: 2;
}

.dp-table-scroll td:first-child,
.dp-table-scroll th:first-child {
    position: sticky;
    left: 0;
    background: #111;
    z-index: 1;
}
.dp-table-scroll {
    scroll-behavior: smooth;
}

/* ==========================================================
   Research-Grade DP Visualization
   ========================================================== */
.dp-cell {
    font-size: 10px;
    text-align: center;
    min-width: 40px;
    height: 40px;
    border: 1px solid #94a3b8 !important;
    /* High contrast border for visibility */
    transition: background 0.1s ease;
}

.dp-highlight {
    background: #ffcc00 !important;
    border: 2px solid #d97706 !important;
    box-shadow: inset 0 0 0 1px #d97706 !important;
    /* Ensure border never gets swallowed by border-collapse */
    font-weight: bold;
}

.dark .dp-highlight {
    background: #b48500 !important;
    border: 2px solid #ff9900 !important;
    box-shadow: inset 0 0 0 1px #ff9900 !important;
}

/* Optional background overlays for arrows not on the main path */
.dp-diagonal {
    background: rgba(76, 175, 80, 0.1);
}

.dp-up {
    background: rgba(33, 150, 243, 0.1);
}

.dp-left {
    background: rgba(244, 67, 54, 0.1);
}

/* ==========================================================
   Premium Glass Cards (.card-soft)
   ========================================================== */
.card-soft {
    backdrop-filter: blur(12px);
    background: linear-gradient(
        145deg,
        rgba(255,255,255,0.05),
        rgba(255,255,255,0.02)
    );
}

.dark .card-soft {
    background: linear-gradient(
        145deg,
        rgba(255,255,255,0.04),
        rgba(255,255,255,0.01)
    );
}

.card-soft::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 32px;
    padding: 1px;
    background: linear-gradient(120deg, transparent, var(--glow-color, rgba(239, 68, 68, 0.4)), transparent);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity .3s;
}

.card-soft:hover::before {
    opacity: 1;
}