/* Global Styles */
:root {
  font-family: "Montserrat", sans-serif  !important;
  font-variation-settings: normal;
  --font-family: "Montserrat", sans-serif !important;
  --text-color: black;
  --primary-color: #28b19e;
  --primary-color-text: black;
  --border-radius: 6px;
  --surface-ground: #041025;
}

body {
    background-color: #020103;
    background-image: url('/static/images/background.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    margin: 0;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(2, 1, 3, 0.3);
    z-index: -1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: rgba(10, 42, 47, 0.9);
    border-bottom: 1px solid #1A3A3F;
}

.logo {
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    gap: 16px;
}

.header-right a {
    color: #ffffff;
    text-decoration: none;
    padding: 6px 12px;
}

.contact-button {
    background-color: #09BDC3;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: bold;
}

.main-wrapper {
    display: flex;
    flex: 1;
}

/* Searching & Error Messages */
#searching {
    text-align: center;
    margin: 15px 0;
    color: #09BDC3;
    font-size: 1em;
    padding: 12px;
    display: none;
}

.gene-not-found-message {
    color: #ffffff !important;
    font-size: 1em !important;
    padding: 12px !important;
    margin: 15px 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

.not-found-gene {
    color: #ffffff;
    font-weight: bold;
    margin: 0 5px;
    text-transform: uppercase;
}

.not-found-species {
    color: #ffffff;
    font-weight: normal;
    margin: 0 5px;
}

/* Sidebar */
.sidebar {
    position: relative;
    width: 200px;
    background-color: rgba(5, 25, 30, 0.9);
    border-right: 1px solid rgba(26, 58, 63, 0.8);
    transition: width 0.3s ease;
    overflow: hidden;
    height: calc(100% - 240px); /* Adjust for video */
}

.sidebar.collapsed {
    width: 40px;
    overflow: visible;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #1A3A3F;
    background-color: rgba(5, 31, 36, 0.8);
}

.sidebar-title {
    color: #ffffff;
    font-weight: bold;
    margin: 0;
    font-size: 16px;
}

.sidebar-toggle-icon {
    position: absolute;
    top: 15px;
    right: -12px;
    cursor: pointer;
    z-index: 100;
    font-size: 16px;
    color: #09BDC3;
    background-color: rgba(5, 31, 36, 0.9);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.sidebar-links {
    padding: 15px;
}

.sidebar-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    color: #ffffff;
    text-decoration: none;
    border-bottom: 1px solid #1A3A3F;
    font-size: 14px;
}

.sidebar-link:hover {
    color: #09BDC3;
}

.sidebar-link:last-child {
    border-bottom: none;
}

.external-icon {
    color: #09BDC3;
    margin-left: 8px;
}

.sidebar.collapsed .sidebar-link {
    padding: 10px 0;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-vertical-text {
    display: none;
}

.sidebar.collapsed .sidebar-vertical-text {
    display: block;
    transform: rotate(90deg);
    white-space: nowrap;
    position: absolute;
    top: 180px;
    left: -70px;
    width: 180px;
    text-align: center;
    color: #ffffff;
    font-weight: bold;
}

.sidebar.collapsed .sidebar-link span:not(.external-icon) {
    font-size: 0;
}

.sidebar.collapsed .sidebar-link span:not(.external-icon)::first-letter {
    font-size: 14px;
}

.sidebar.collapsed .external-icon {
    display: none;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

/* Container & Title */
.container {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    background-color: rgba(5, 31, 36, 0.4);
}

.title-image {
    max-width: 50%;
    height: auto;
    margin-bottom: 15px;
}

.title-section {
    text-align: center;
    margin-bottom: 20px;
}

.title-section h1 {
    font-size: 32px;
    color: #ffffff;
    margin-bottom: 8px;
}

.title-section p {
    color: #BBBBBB;
    font-size: 14px;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Form */
.search-section {
    display: flex;
    width: 100%;
    margin: 0 0 20px 0;
    padding: 0 20px;
}

.search-section input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #09BDC3;
    border-radius: 4px 0 0 4px;
    background-color: #051F24;
    color: #ffffff;
    font-size: 1em;
    outline: none;
}

.search-section button {
    background-color: #09BDC3;
    color: #fff;
    border: 1px solid #09BDC3;
    border-radius: 0 4px 4px 0;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
}

.search-section button:hover {
    background-color: #07888D;
}

#suggestion {
    font-size: 0.9em;
    color: #FFD700;
    margin-top: 4px;
    text-align: center;
}

.suggestion-gene {
    color: #ffffff;
    font-size: 1.1em;
}

/* Results Layout */
.results-wrapper {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 20px;
    grid-auto-rows: auto;
    align-items: start;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.row1-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 12px;
    height: 180px;
    max-height: 180px;
    margin-bottom: 12px;
}

.row2-grid {
    display: grid;
    grid-template-columns: 1.5fr 3.5fr;
    gap: 12px;
    align-items: start;
    height: 270px;
    max-height: 270px;
    margin-top: 12px;
}

/* Card Styling */
.card {
    background-color: #030809;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.card-title {
    color: #ffffff;
    font-weight: bold;
    font-size: 1em;
    margin: 0;
}

/* Gene Info Card */
.gene-info-card {
    height: 180px;
    max-height: 180px;
    overflow: visible;
    position: relative;
    display: flex;
    flex-direction: column;
}

.gene-info-header {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.gene-info-field {
    flex: 1;
}

.field-label {
    color: #09BDC3;
    margin-bottom: 5px;
    flex-shrink: 0;
}

.field-value {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px;
    color: #ffffff;
    font-size: 16px;
}

.species-dropdown {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.dropdown-arrow {
    color: #09BDC3;
}

.species-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background-color: #051F24;
    border: 1px solid #09BDC3;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    margin-top: 5px;
}

.species-category {
    padding: 8px 10px;
    background-color: rgba(9, 189, 195, 0.2);
    color: #09BDC3;
    font-weight: bold;
    border-bottom: 1px solid #1A3A3F;
}

.species-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #1A3A3F;
}

.species-item:hover {
    background-color: rgba(9, 189, 195, 0.1);
}

.species-item:last-child {
    border-bottom: none;
}

/* Fix protein class container overflow */
.protein-class-container {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px;
    color: #ffffff;
    height: 60px;
    max-height: 60px;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 0.9em;
}

#proteinClassText {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.protein-class-item {
    padding: 2px 0;
    line-height: 1.4;
    position: relative;
    white-space: nowrap;
}

.protein-class-item:before {
    content: "•";
    color: #09BDC3;
    display: inline-block;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Transcript Types Card */
.transcript-types-card {
    height: 180px;
    max-height: 180px;
    overflow-y: auto;
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 15px;
}

.transcript-labels {
    display: flex;
    gap: 30px;
}

.transcript-labels span {
    color: #ffffff;
}

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

.transcript-row:last-child {
    margin-bottom: 0;
}

.transcript-row > span {
    color: #ffffff;
}

.transcript-values {
    display: flex;
    gap: 10px;
}

.transcript-value {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 10px;
    min-width: 80px;
    text-align: center;
}

.transcript-value-small {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 10px;
    min-width: 60px;
    text-align: center;
}

/* Protein Expression Card */
.protein-expression-card {
    height: 270px;
    max-height: 270px;
    overflow-y: auto;
}

.expression-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #1A3A3F;
}

.expression-item:last-child {
    border-bottom: none;
}

.expression-percentage {
    color: #09BDC3;
    font-weight: bold;
}

/* Sequence Viewer Card */
.sequence-viewer-card {
    height: 270px;
    max-height: 270px;
    overflow-y: auto;
}

.sequence-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.sequence-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sequence-input-group label {
    color: #09BDC3;
    font-size: smaller;
}

.sequence-input-group input {
    width: 50px;
    padding: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: #ffffff;
    text-align: center;
}

/* Style the Enter button to match the Search button */
.sequence-controls button {
    background-color: #09BDC3;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    height: 29px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sequence-controls button:hover {
    background-color: #07888D;
}

.dropdown-container {
    position: relative;
    min-width: 130px;
}

.dropdown-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    color: #ffffff;
    cursor: pointer;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #09BDC3;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
    display: none;
    color: white;
}

.dropdown-item {
    padding: 6px 10px;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #1A3A3F;
}

.sequence-display {
    height: 170px;
    max-height: 170px;
    overflow-y: auto;
    background-color: rgba(10, 42, 47, 0.7);
    padding: 12px;
    border-radius: 4px;
    font-family: monospace;
}

.sequence-line {
    display: flex;
    margin-bottom: 4px;
}

.line-number,
.sequence-position {
    width: 28px;
    color: #4A5A5F;
    text-align: right;
    margin-right: 8px;
}

/* Protein Structure Section */
.protein-structure-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
}

.protein-structure-container {
    width: 100%;
    height: 462px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(26, 58, 63, 0.3);
}

.structure-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    text-align: center;
}

.placeholder-image {
    max-width: 180px;
    height: auto;
    opacity: 0.7;
    display: block;
    margin: 0 auto 20px auto;
}

.placeholder-text {
    color: #BBBBBB;
    font-size: 14px;
    text-align: center;
    width: 100%;
    margin-top: 0;
}

.structure-info {
    margin-top: 12px;
    text-align: center;
    width: 100%;
}

.structure-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    width: 100%;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(9, 189, 195, 0.3);
    border-top: 4px solid #09BDC3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

.copilot-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(9, 189, 195, 0.3);
    border-top: 3px solid #09BDC3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #09BDC3;
    font-size: 1.1em;
    text-align: center;
    margin-top: 10px;
    width: 100%;
}

/* Structure Error Display */
.structure-error {
    padding: 15px;
    text-align: center;
    color: #ff6b6b;
    font-size: 0.9em;
}

.error-icon {
    font-size: 1.5em;
    margin-bottom: 8px;
    color: #ff6b6b;
}

.error-message {
    font-size: 0.9em;
    margin-bottom: 10px;
    color: #ff6b6b;
}

/* Error message in searching div - simple version */
#searching.error-message {
    color: #ff6b6b;
    font-size: 0.9em;
}

.fallback-link,
.fallback-button {
    display: inline-block;
    background-color: #09BDC3;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    margin-top: 10px;
    font-weight: bold;
}

.fallback-button:hover {
    background-color: #07888D;
}

/* Iframe for protein structure */
.structure-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Ad Video */
.ad-video-container {
    position: fixed;
    left: 0;
    bottom: 40px;
    width: 180px;
    height: 180px;
    z-index: 1000;
    overflow: hidden;
    border-radius: 4px;
    margin: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.ad-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Footer */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: rgba(5, 31, 36, 0.9);
    color: #4A5A5F;
}

.logo-image {
    height: 30px;
    width: auto;
    display: block;
}

/* Copilot Section Styles */
.copilot-section {
    background-color: rgba(5, 31, 36, 0.8);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid rgba(26, 58, 63, 0.8);
}

.copilot-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.copilot-title {
    color: #09BDC3;
    font-size: 1.2em;
    font-weight: bold;
    margin: 0;
}

.copilot-icon {
    font-size: 1.5em;
}

.copilot-input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.copilot-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #09BDC3;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 1em;
    outline: none;
}

.copilot-input::placeholder {
    color: #888;
}

.copilot-button {
    background-color: #09BDC3;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
}

.copilot-button:hover {
    background-color: #07888D;
}

.copilot-response {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 15px;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(26, 58, 63, 0.5);
}

.copilot-response h1,
.copilot-response h2,
.copilot-response h3 {
    color: #09BDC3;
    margin-top: 15px;
    margin-bottom: 10px;
}

.copilot-response h1:first-child,
.copilot-response h2:first-child,
.copilot-response h3:first-child {
    margin-top: 0;
}

.copilot-response p {
    line-height: 1.6;
    margin-bottom: 10px;
}

.copilot-response ul,
.copilot-response ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.copilot-response li {
    margin-bottom: 5px;
    line-height: 1.5;
}

.copilot-response a {
    color: #09BDC3;
    text-decoration: none;
}

.copilot-response a:hover {
    text-decoration: underline;
}

.copilot-response code {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

.copilot-response pre {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
}

.copilot-response blockquote {
    border-left: 3px solid #09BDC3;
    margin: 10px 0;
    padding-left: 15px;
    color: #ccc;
}

.search-limit-message {
    background-color: rgba(9, 189, 195, 0.1);
    border: 1px solid #09BDC3;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.limit-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.limit-text {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #09BDC3;
}

.redirect-button {
    background-color: #09BDC3;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    text-decoration: none;
    display: inline-block;
}

.redirect-button:hover {
    background-color: #07888D;
}

/* Other utility classes */
.disabled-link {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
}

.species-notification {
    background-color: rgba(9, 189, 195, 0.2);
    border-left: 3px solid #09BDC3;
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 0.9em;
    display: none;
}

.not-available-nonhuman {
    color: #777;
    font-style: italic;
}

/* Remove number input arrows */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Row 3 Grid for Copilot */
.row3-grid {
    display: grid;
    gap: 12px;
    align-items: start;
    height: 350px;
    max-height: 350px;
    margin-top: 12px;
}

/* Copilot Section */
.copilot-flex-section {
    display: flex;
    flex-direction: column;
    background-color: #030809;
}

.copilot-search-section {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.copilot-search-section input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #09BDC3;
    border-radius: 4px;
    background-color: #051F24;
    color: #ffffff;
    font-size: 1em;
    outline: none;
}

.copilot-search-section input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.copilot-search-response {
    flex-grow: 1;
    font-size: smaller;
    border: none;
    padding: 10px;
    border-radius: 4px;
    height: 220px;
    max-height: 220px;
    overflow-y: auto;
}

.copilot-search-section button {
    background-color: #09BDC3;
    color: #ffffff;
    border: 1px solid #09BDC3;
    border-radius: 4px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
}

.copilot-search-section button:hover {
    background-color: #07888D;
}

.search-limit-message {
    background-color: rgba(9, 189, 195, 0.1);
    border: 1px solid #09BDC3;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.limit-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.limit-text {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #09BDC3;
}