body { font-family: 'Inter', Arial, sans-serif; margin: 0; padding: 0 0 50px; line-height: 1.6; background-color: #FAF8F5; color: #5a5a5a; }
h1, h2, h3 { color: #333; font-weight: 500; }
header { background-color: transparent; padding: 40px 0 20px 0; text-align: center; }
header h1 { font-family: "Libre Baskerville", serif; font-size: 2.5em; font-weight: 400; margin-bottom: 30px; color: #4a4a4a; }
.search-container { max-width: 700px; margin: 0 auto; }

/* --- Corrected Search Controls Layout --- */
#search-controls {
    display: flex;
    flex-direction: column; /* Stack the two rows vertically */
    gap: 15px;
    background-color: #FFFFFF;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
    margin: 20px auto;
}

#top-search-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

#chemistry-options-wrapper {
    display: flex; /* This is the second row */
    gap: 15px;
}

/* --- Flexbox width control --- */
#sugar-input-group,
#backbone-input-group,
#transfection-input-group {
    flex: 1; /* These three take up an equal share of the remaining space */
    min-width: 0;
}

#transfection-input-group {
    flex: 0.8;
}
#dosage-input-group {
    flex: 0.45; /* This box will be 60% of the width of the others */
}


label {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-bottom: 3px;
    text-align: left;
    font-weight: 500;
}

/* --- Input and Button Styling --- */
input, select {
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #EAE8E5;
    border-radius: 8px;
    background-color: #FDFCFB;
    transition: border-color 0.2s ease;
    color: #5a5a5a;
    box-sizing: border-box;
    width: 100%;
    height: 40px; /* Consistent height */
}

input:focus, select:focus {
    outline: none;
    border-color: #D3A99D;
    background-color: #fff;
}

input::placeholder {
    color: #aaa;
    font-style: italic;
}

/* --- Hide arrows from number input --- */
#dosage-input::-webkit-outer-spin-button,
#dosage-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#dosage-input {
  -moz-appearance: textfield; /* Firefox */
}

#gene-search { flex-grow: 1; }

#search-button {
    padding: 10px 15px;
    background-color: #E8796A;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
    height: 40px;
    line-height: 1;
}
#search-button:hover { background-color: #D9685A; }


/* --- Remainder of the CSS (Unchanged) --- */
.content, #transcript-plot-container { max-width: 1100px; margin: 30px auto; padding: 0 15px; }
#transcript-plot-container { background-color: #FFFFFF; border: 1px solid #EAE8E5; border-radius: 12px; padding: 25px; min-height: 100px; display: none; overflow-x: auto; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.04); }
#transcript-plot-container h2 { text-align: center; margin-top: 0; margin-bottom: 25px; color: #4a4a4a; }
#transcript-plot-svg { display: block; width: 100%; }

#aso-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 15px;
    padding: 0 10px;
    position: relative;
    height: 32px;
}

#aso-table-subtitle {
    color: #4a4a4a;
    font-weight: 500;
    margin: 0;
    font-size: 1.1em;
}

.pagination-wrapper {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

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

.page-btn-inline {
    padding: 6px 10px;
    background-color: #E8796A;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    height: 32px;
}

.page-btn-inline:hover:not(:disabled) { background-color: #D9685A; }
.page-btn-inline:disabled { background-color: #ddd; cursor: not-allowed; }

.page-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #5a5a5a;
    font-size: 13px;
    white-space: nowrap;
}

.icon-btn {
    padding: 8px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.icon-btn:hover { background-color: #5a6268; }

.hidden { display: none !important; }
#results-container { margin-top: 10px; background-color: #FFFFFF; border-radius: 12px; border: 1px solid #EAE8E5; display: none; max-height: 500px; overflow-y: auto; overflow-x: auto; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.04); }
#results-container table { width: 100%; border-collapse: collapse; }
#results-container th, #results-container td { border: none; padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid #F0EBE8; }
#results-container th { background-color: #F7F5F2; font-weight: 500; color: #333; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.5px; }
#results-container td { font-size: 0.95em; }
#results-container tr:last-child td { border-bottom: none; }
#results-container tr:hover { background-color: #FDFCFB; }
.loading { text-align: center; margin: 30px 0; color: #888; font-style: italic; display: none; }
.error { color: #C84B31; background-color: #FBEAE5; border: 1px solid #F5D0C7; border-radius: 8px; padding: 10px 15px; margin: 20px auto; max-width: 700px; display: none; }

/* --- Transcript row hover effects --- */
#transcript-plot-svg .transcript-row {
    cursor: pointer;
}

#transcript-plot-svg .transcript-row-bg {
    transition: fill 0.2s ease;
    fill: #FFFFFF;
}

#transcript-plot-svg .transcript-row.hover-highlight .transcript-row-bg {
    fill: rgba(232, 121, 106, 0.08);
}

#transcript-plot-svg .transcript-row.selected .transcript-row-bg {
    fill: rgba(232, 121, 106, 0.12);
}

/* Keep existing styles for selected state */
#transcript-plot-svg rect { fill: #a9a9a9; }
#transcript-plot-svg rect[fill='#007bff'] { fill: #A1C4FD; }
#transcript-plot-svg .transcript-row.hover-highlight {
    opacity: 1; /* Remove opacity effect since we're using background color */
}
#transcript-plot-svg .transcript-row.selected rect:not(.transcript-row-bg),
#transcript-plot-svg .transcript-row.selected line,
#transcript-plot-svg .transcript-row.selected polyline {
    stroke: #E8796A;
    stroke-width: 2px;
}
#transcript-plot-svg .transcript-row.selected text {
    fill: #E8796A;
    font-weight: bold;
}

#aso-hover-marker { pointer-events: none; }
.subtitle { font-size: 1.1em; color: #6c757d; margin-top: -20px; margin-bottom: 30px; font-weight: 400; }
#about-link, #home-link { position: absolute; top: 20px; color: #6c757d; text-decoration: none; font-size: 0.9em; padding: 5px 10px; border-radius: 5px; transition: background-color 0.2s ease, color 0.2s ease; }
#about-link { right: 20px; }
#home-link { left: 20px; }
#about-link:hover, #home-link:hover { color: #333; background-color: #f0f0f0; }
#popup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 999; }
#about-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #FFFFFF; padding: 30px 40px; border-radius: 12px; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); z-index: 1000; max-width: 500px; width: 90%; line-height: 1.7; }
#about-popup h2 { margin-top: 0; margin-bottom: 20px; color: #333; text-align: center; font-family: "Libre Baskerville", serif; font-weight: 700; }
#about-popup p { margin-bottom: 15px; color: #5a5a5a; }
#close-popup { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 24px; color: #aaa; cursor: pointer; line-height: 1; padding: 0; transition: color 0.2s ease; }
#close-popup:hover { color: #333; }

.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(250, 248, 245, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-size: 18px;
    color: #6c757d;
}

/* --- Email Modal Styles --- */
#email-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1999;
}

#email-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #FFFFFF;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    max-width: 480px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

#close-email-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
}

#close-email-modal:hover {
    color: #333;
}

.email-modal-content {
    text-align: center;
}

.email-modal-icon {
    width: 60px;
    height: 60px;
    background-color: #E8796A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.email-modal-icon i {
    font-size: 24px;
    color: white;
}

#email-modal h2 {
    margin: 0 0 10px;
    color: #333;
    font-weight: 600;
    font-size: 22px;
}

.email-modal-subtitle {
    color: #6c757d;
    margin-bottom: 25px;
    line-height: 1.5;
}

.email-input-group {
    margin-bottom: 25px;
}

#user-email-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #EAE8E5;
    border-radius: 10px;
    background-color: #FDFCFB;
    transition: border-color 0.2s ease;
    text-align: center;
}

#user-email-input:focus {
    outline: none;
    border-color: #E8796A;
    background-color: #fff;
}

#user-email-input.error {
    border-color: #C84B31;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.email-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

.email-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.primary-btn {
    background-color: #E8796A;
    color: white;
    flex: 1;
}

.primary-btn:hover {
    background-color: #D9685A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 121, 106, 0.3);
}

.secondary-btn {
    background-color: transparent;
    color: #6c757d;
    border: 2px solid #EAE8E5;
    flex: 1;
}

.secondary-btn:hover {
    background-color: #F7F5F2;
}

@media (max-width: 768px) {
    #chemistry-options-wrapper {
        flex-wrap: wrap; /* Allow wrapping on small screens now */
    }

    #aso-table-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        height: auto;
        position: static;
    }

    .pagination-wrapper {
        order: 2;
        position: static;
        transform: none;
        justify-content: center;
        display: flex;
    }
    #aso-table-subtitle {
        order: 1;
        text-align: center;
    }
    .action-buttons {
        order: 3;
        justify-content: center;
    }

    #email-modal {
        padding: 30px 20px;
    }

    .email-modal-buttons {
        flex-direction: column;
    }
}
