/* Global font family with country flag emoji support */
body,
html {
    font-family: "Twemoji Country Flags", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Phase 2 Interactive Learning Styles */
.learning-modal {
    backdrop-filter: blur(4px);
}

.learning-modal .modal-content {
    max-height: 90vh;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dna-animation-container,
.protein-interaction-container {
    border: 2px solid #e5e7eb;
    transition: border-color 0.3s ease;
}

.dna-animation-container:hover,
.protein-interaction-container:hover {
    border-color: #3b82f6;
}

.learning-module-card:hover {
    transform: translateY(-2px);
}

.brain-cells {
    display: flex;
    align-items: center;
    justify-content: center;
}

.neuron {
    transition: all 0.3s ease;
}

.neuron:hover {
    transform: scale(1.05);
}

.gene-structure-demo svg rect {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.gene-structure-demo svg rect:hover {
    opacity: 0.8;
}

.mutation-type:hover {
    transform: translateY(-1px);
}

.interactive-learning-box {
    border-left: 4px solid #8b5cf6;
}

.quiz-option:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.exon-intron-viz {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mutation-marker {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.exon-hover:hover {
    opacity: 0.8;
    cursor: pointer;
}

.severity-high { 
    background: linear-gradient(325deg, #fee2e2, #fc7676); 
    border-color: #ef4444; 
}

.severity-medium { 
    background: linear-gradient(325deg, #fef3c7, #ffdf5e); 
    border-color: #f59e0b; 
}

.severity-low { 
    background: linear-gradient(325deg, #dcfce7, #67ff9c); 
    border-color: #22c55e; 
}

.technical-table { 
    font-family: 'Courier New', monospace; 
}

.dna-codon { 
    display: inline-block; 
    padding: 4px 8px; 
    margin: 2px; 
    border-radius: 4px; 
    font-family: monospace; 
    font-weight: bold;
}

.codon-normal { 
    background-color: #dbeafe; 
    color: #1e40af; 
}

.codon-mutated { 
    background-color: #fee2e2; 
    color: #dc2626; 
}

.intron-line { 
    stroke-dasharray: 5,5; 
}

.cluster-indicator {
    background: linear-gradient(45deg, #fbbf24, #f59e0b);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.educational-box {
    background: linear-gradient(325deg, var(--accent), var(--secondary));
    border-left: 4px solid var(--ring);
    color: var(--foreground);
}

/* Theme Variables */
:root {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --text-primary: #111827;
    --text-secondary: #292b2e;
    --border-color: #e5e7eb;
    --accent-color: #3b82f6;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Shadcn variables for gradients */
    --background: #ffffff;
    --foreground: #0f172a;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --primary: #0f172a;
    --primary-foreground: #f8fafc;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #f1f5f9;
    --accent-foreground: #0f172a;
    --destructive: #ef4444;
    --destructive-foreground: #f8fafc;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #3b82f6;
}

[data-theme="dark"] {
    /* Simplified dark theme - 5 base colors + 3 semantic colors */
    --bg-primary: #0a0f1c;      /* Dark blue-black background */
    --bg-secondary: #1a2332;    /* Medium surface color */
    --text-primary: #e2e8f0;    /* High contrast light text */
    --text-secondary: #94a3b8;  /* Medium contrast secondary text */
    --accent-color: #3b82f6;    /* Blue for links and actions */

    /* Semantic colors */
    --color-success: #10b981;   /* Green for success states */
    --color-warning: #f59e0b;   /* Amber for warnings */
    --color-error: #ef4444;     /* Red for errors */

    /* Border and interaction states */
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);

    /* Shadcn compatibility variables */
    --background: #0a0f1c;
    --foreground: #e2e8f0;
    --card: #1a2332;
    --card-foreground: #e2e8f0;
    --primary: #3b82f6;
    --primary-foreground: #ffffff;
    --secondary: #1a2332;
    --secondary-foreground: #e2e8f0;
    --muted: #1a2332;
    --muted-foreground: #94a3b8;
    --accent: #3b82f6;
    --accent-foreground: #ffffff;
    --destructive: #ef4444;
    --destructive-foreground: #ffffff;
    --border: #334155;
    --input: #334155;
    --ring: #3b82f6;
}

/* Theme-aware styles */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* Main page background in dark mode - highest specificity */
html[data-theme="dark"] body.bg-gray-50,
[data-theme="dark"] body.bg-gray-50,
[data-theme="dark"] body {
    background-color: var(--bg-primary) !important;
}

.bg-white {
    background-color: var(--bg-secondary) !important;
    box-shadow: var(--shadow);
}

.text-gray-800 {
    color: var(--text-primary) !important;
}

.text-gray-600, .text-gray-700 {
    color: var(--text-secondary) !important;
}

.border-gray-300 {
    border-color: var(--border-color) !important;
}

/* Only apply gradients to boxes with border-left */
.bg-red-50.border-l-4,
.bg-red-50[style*="border-left"] {
    background: linear-gradient(325deg, #fecaca, #f87171) !important;
}

.bg-orange-50.border-l-4,
.bg-orange-50[style*="border-left"] {
    background: linear-gradient(325deg, #e1b814, #facc15) !important;
}
.bg-yellow-50.border-l-4,
.bg-yellow-50[style*="border-left"] {
    background: linear-gradient(325deg, #fde68a, #facc15) !important;
}

.bg-green-50.border-l-4,
.bg-green-50[style*="border-left"] {
    background: linear-gradient(325deg, #bbf7d0, #4ade80) !important;
}

.bg-blue-50.border-l-4,
.bg-blue-50[style*="border-left"] {
    background: linear-gradient(325deg, #bfdbfe, #60a5fa) !important;
}

[data-theme="dark"] .educational-box {
    background: linear-gradient(325deg, var(--accent), var(--secondary));
    border-left: 4px solid var(--ring);
    color: var(--foreground);
}

[data-theme="dark"] .text-blue-800 {
    color: var(--accent-color) !important;
}

[data-theme="dark"] .text-blue-900 {
    color: var(--accent-color) !important;
}

[data-theme="dark"] .text-blue-700 {
    color: var(--accent-color) !important;
}

[data-theme="dark"] .fill-gray-700,
[data-theme="dark"] .fill-gray-600 {
    fill: var(--text-secondary) !important;
}

[data-theme="dark"] .stroke-gray-700,
[data-theme="dark"] .stroke-gray-600 {
    stroke: var(--text-secondary) !important;
}

/* Fix intron line visibility in dark mode */
[data-theme="dark"] .intron-line {
    stroke: var(--text-secondary) !important;
    stroke-width: 2px;
}

[data-theme="dark"] .bg-yellow-50.border-l-4,
[data-theme="dark"] .bg-yellow-50[style*="border-left"] {
    background: var(--bg-secondary) !important;
    border-left-color: var(--color-warning) !important;
}

[data-theme="dark"] .border-yellow-400 {
    border-color: var(--color-warning) !important;
}

[data-theme="dark"] .text-yellow-800 {
    color: var(--color-warning) !important;
}

[data-theme="dark"] .bg-yellow-100 {
    background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .text-gray-500 {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .severity-high {
    background: linear-gradient(325deg, var(--color-critical), var(--color-error)) !important;
    border-color: var(--color-error) !important;
}

[data-theme="dark"] .severity-medium {
    background: linear-gradient(325deg, var(--bg-tertiary), var(--color-warning)) !important;
    border-color: var(--color-warning) !important;
}

[data-theme="dark"] .severity-low {
    background: linear-gradient(325deg, var(--bg-tertiary), var(--color-success)) !important;
    border-color: var(--color-success) !important;
}

[data-theme="dark"] #analyze-btn {
    background-color: var(--accent-color) !important;
}

[data-theme="dark"] #analyze-btn:hover {
    background-color: var(--accent-color) !important;
    filter: brightness(0.9);
}

/* Simple explanation blue theme */
[data-theme="dark"] .border-blue-400 {
    border-color: var(--accent-color) !important;
}

[data-theme="dark"] .bg-blue-50.border-l-4,
[data-theme="dark"] .bg-blue-50[style*="border-left"] {
    background: linear-gradient(325deg, var(--bg-tertiary), var(--accent-color)) !important;
}

/* Educational content and other elements dark theme */
[data-theme="dark"] .bg-gray-50:not(body) {
    background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .bg-gray-100 {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .border-gray-200 {
    border-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .bg-red-50.border-l-4,
[data-theme="dark"] .bg-red-50[style*="border-left"] {
    background: linear-gradient(325deg, var(--color-critical), var(--color-error)) !important;
}

[data-theme="dark"] .bg-orange-50.border-l-4,
[data-theme="dark"] .bg-orange-50[style*="border-left"] {
    background: linear-gradient(325deg, var(--color-critical), var(--color-error)) !important;
}

[data-theme="dark"] .border-red-400 {
    border-color: var(--color-error) !important;
}

[data-theme="dark"] .text-red-800 {
    color: var(--color-error) !important;
}

[data-theme="dark"] .text-red-700 {
    color: var(--color-error) !important;
}

[data-theme="dark"] .text-red-600 {
    color: var(--color-error) !important;
}

[data-theme="dark"] .bg-yellow-50.border-l-4,
[data-theme="dark"] .bg-yellow-50[style*="border-left"] {
    background: linear-gradient(325deg, var(--bg-tertiary), var(--color-warning)) !important;
}

[data-theme="dark"] .border-yellow-400 {
    border-color: var(--color-warning) !important;
}

[data-theme="dark"] .text-yellow-800 {
    color: var(--color-warning) !important;
}

[data-theme="dark"] .text-yellow-700 {
    color: var(--color-warning) !important;
}

[data-theme="dark"] .text-yellow-600 {
    color: var(--color-warning) !important;
}

[data-theme="dark"] .bg-green-50.border-l-4,
[data-theme="dark"] .bg-green-50[style*="border-left"] {
    background: linear-gradient(325deg, var(--bg-tertiary), var(--color-success)) !important;
}

[data-theme="dark"] .border-green-200 {
    border-color: var(--color-success) !important;
}

[data-theme="dark"] .text-green-800 {
    color: var(--color-success) !important;
}

[data-theme="dark"] .text-green-700 {
    color: var(--color-success) !important;
}

/* Fix summary section colors in dark mode for better readability */
[data-theme="dark"] .bg-green-50:not(.border-l-4):not([style*="border-left"]) {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .bg-blue-50:not(.border-l-4):not([style*="border-left"]) {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .text-green-800:not(.border-l-4) {
    color: var(--color-success) !important;
}

[data-theme="dark"] .text-green-700:not(.border-l-4) {
    color: var(--color-success) !important;
}

[data-theme="dark"] .bg-blue-200 {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .bg-red-200 {
    background-color: var(--color-critical) !important;
}

[data-theme="dark"] .bg-green-200 {
    background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .text-red-800 {
    color: var(--color-error) !important;
}

/* Cross-navigation dark theme */
[data-theme="dark"] .bg-gradient-to-r.from-blue-50.to-green-50 {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--bg-tertiary) !important;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.language-selector {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.language-select {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
    font-family: "Twemoji Country Flags", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.language-select:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.language-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tab Navigation Styling */
.tab-navigation {
    position: sticky;
    top: 10px;
    z-index: 100;
}

.tab-button {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    font-size: 14px;
    outline: none;
}

.tab-button:hover {
    background-color: var(--muted);
    color: var(--text-primary);
}

.tab-button.active {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.tab-content {
    min-height: 500px;
}

.tab-content.active {
    display: block !important;
}

/* Dark theme tab adjustments */
[data-theme="dark"] .tab-button {
    color: var(--text-secondary);
}

[data-theme="dark"] .tab-button:hover {
    background-color: var(--muted);
    color: var(--text-primary);
}

[data-theme="dark"] .tab-button.active {
    background-color: var(--accent-color);
    color: white;
}

/* Section-specific styling */
#section-decoder .bg-white {
    border-left: 4px solid var(--accent-color);
}

#section-education .bg-white {
    border-left: 4px solid #10b981;
}

#section-medical .bg-white {
    border-left: 4px solid #7c3aed;
}

#section-structure .bg-white {
    border-left: 4px solid #8b5cf6;
}

/* External link styling */
.external-link {
    transition: all 0.2s ease;
}

.external-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Medical classification styling */
.classification-card {
    transition: all 0.2s ease;
}

.classification-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive SVG styling */
#gene-diagram {
    max-width: 100%;
    height: auto;
}

/* Tablet responsive adjustments - larger diagram for better space utilization */
@media (max-width: 1100px) and (min-width: 768px) {
    #gene-diagram {
        width: 700px;
        height: 200px;
        margin: 0 auto;
        display: block;
    }
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    #gene-diagram {
        width: 380px;
        height: 200px;
        margin: 0 auto;
        display: block;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 80px !important; /* Add space for fixed language selector and theme toggle */
    }
    
    /* Fix mutation input width to prevent analyze button cutoff */
    #mutation-input {
        flex: 1;
        min-width: 0; /* Allow flex item to shrink */
        width: auto;
    }
    
    .flex.gap-2 {
        display: flex;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }
    
    #analyze-btn {
        flex-shrink: 0;
        min-width: 80px;
        padding: 0.5rem 1rem;
        font-size: 14px;
    }
    
    /* Make example buttons smaller and responsive on mobile */
    .example-btn {
        font-size: 11px !important;
        padding: 4px 8px !important;
        margin: 2px !important;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Force example buttons to wrap on multiple lines */
    .flex.flex-wrap.gap-2 {
        justify-content: flex-start;
        flex-wrap: wrap !important;
        gap: 4px !important;
    }
    
    /* Adjust fixed positioned elements for mobile */
    .language-selector {
        top: 10px;
        left: 10px;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 14px;
    }
    
    /* Make language selector more compact on mobile */
    .language-select {
        max-width: 140px;
        font-size: 12px;
        padding: 6px 8px;
    }
    
    /* Tab navigation responsive */
    .tab-navigation {
        position: static;
        margin-bottom: 1rem;
    }
    
    .tab-navigation .flex {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .tab-navigation .flex > * + * {
        margin-left: 0;
        margin-top: 0.25rem;
    }
    
    .tab-button {
        width: 100%;
        text-align: center;
        padding: 12px 16px;
        font-size: 16px;
    }
    
    /* Ensure diagrams don't overflow on very small screens */
    .bg-white {
        overflow-x: hidden;
    }
    
    /* Mobile-specific section adjustments */
    .tab-content {
        min-height: 300px;
    }
    
    /* Statistics grid responsive */
    .grid.md\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Navigation enhancement buttons */
.nav-enhancement-button {
    transition: all 0.3s ease;
}

.nav-enhancement-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Section-specific gradients */
.decoder-gradient {
    background: linear-gradient(325deg, #dbeafe, #bfdbfe);
}

.education-gradient {
    background: linear-gradient(325deg, #dcfce7, #bbf7d0);
}

.medical-gradient {
    background: linear-gradient(325deg, #f3e8ff, #e9d5ff);
}

/* Amino Acid Sequence Styling */
.amino-acid-sequence {
    max-height: 400px;
    overflow-y: auto;
    word-break: keep-all;
    word-wrap: break-word;
    user-select: none;
    white-space: normal;
    line-height: 1.8;
}

/* Desktop/PC mode - show all amino acids without scrolling */
/*@media (min-width: 768px) {
    .amino-acid-sequence {
        max-height: none;
        min-height: 480px;
        height: auto;
        overflow-y: visible;
    }
}*/

.amino-acid-letter {
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 2px;
    transition: all 0.2s ease;
    position: relative;
}

.amino-acid-letter:hover,
.amino-acid-letter:active,
.amino-acid-letter:focus {
    background-color: #fef3c7;
    transform: scale(1.1);
    z-index: 2;
}

/* Mobile touch support for amino acid letters */
@media (max-width: 767px) {
    .amino-acid-sequence {
        line-height: 1.4;
        white-space: normal;
        word-spacing: 0;
    }
    
    /* Force line breaks to be ignored in mobile, let text flow naturally */
    .amino-acid-sequence br {
        display: none;
    }
    
    .amino-acid-letter {
        padding: 2px 3px;
        margin: 0px 1px;
        min-width: 14px;
        min-height: 18px;
        display: inline-block;
        text-align: center;
        font-size: 12px;
        -webkit-tap-highlight-color: rgba(254, 243, 199, 0.5);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    .amino-acid-letter:active {
        background-color: #fbbf24 !important;
        transform: scale(1.05);
        z-index: 2;
    }
}

.amino-acid-letter.aa-highlighted {
    background-color: #dc2626;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.5);
}

.amino-acid-letter.aa-selected {
    background-color: #dc2626;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.7);
    transform: scale(1.1);
    z-index: 3;
}

.amino-acid-letter.aa-same-type {
    background-color: #f59e0b;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 3px rgba(245, 158, 11, 0.5);
}

#amino-acid-info {
    animation: fadeIn 0.3s ease;
    border: 2px solid #3b82f6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark theme support for amino acid sequence */
[data-theme="dark"] .amino-acid-sequence {
    background-color: #374151 !important;
    color: var(--text-primary);
}

[data-theme="dark"] .amino-acid-letter:hover {
    background-color: #92400e;
    color: white;
}

[data-theme="dark"] .amino-acid-letter.aa-highlighted {
    background-color: #dc2626;
    color: white;
}

[data-theme="dark"] .amino-acid-letter.aa-selected {
    background-color: #dc2626;
    color: white;
}

[data-theme="dark"] .amino-acid-letter.aa-same-type {
    background-color: #f59e0b;
    color: white;
}

[data-theme="dark"] #amino-acid-info {
    background-color: var(--muted) !important;
    color: var(--text-primary);
    border-color: var(--accent-color);
}

/* Protein Impact Visualization Styling */
.protein-impact-sequence {
    max-height: 400px;
    overflow-y: auto;
    word-break: keep-all;
    word-wrap: break-word;
    user-select: none;
    white-space: normal;
    line-height: 1.8;
}

.protein-impact-letter {
    padding: 1px 2px;
    border-radius: 2px;
    transition: all 0.2s ease;
    position: relative;
    font-size: 12px;
}

/* Impact highlighting styles */
.impact-normal {
    background-color: transparent;
    color: #374151;
}

.impact-changed {
    background-color: #fbbf24;
    color: #92400e;
    font-weight: bold;
    border: 1px solid #d97706;
}

.impact-frameshift {
    background-color: #ef4444;
    color: #ffffff;
    font-weight: bold;
}

.impact-nonsense {
    background-color: #6b7280;
    color: #ffffff;
    opacity: 0.7;
}

.impact-missing-protein {
    background-color: #9ca3af;
    color: #ffffff;
    opacity: 0.6;
    text-decoration: line-through;
}

.impact-deleted {
    background-color: #f87171;
    color: #ffffff;
    font-weight: bold;
    text-decoration: line-through;
}

.impact-duplicated {
    background-color: #60a5fa;
    color: #ffffff;
    font-weight: bold;
    border: 1px solid #2563eb;
}

/* Dark theme support for protein impact visualization */
[data-theme="dark"] .protein-impact-sequence {
    background-color: #374151;
    color: #f3f4f6;
    border-color: #4b5563;
}

[data-theme="dark"] .impact-normal {
    color: #f3f4f6;
}

[data-theme="dark"] .impact-changed {
    background-color: #f59e0b;
    color: #1f2937;
}

[data-theme="dark"] .impact-missing-protein {
    background-color: #6b7280;
    color: #f3f4f6;
    opacity: 0.6;
}

/* Parent information section styling */
.parent-info-section {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
}

.parent-info-title {
    color: #1e3a8a;
}

.parent-info-text {
    color: #1e40af;
}

/* Dark theme support for parent information */
[data-theme="dark"] .parent-info-section {
    background-color: #1e293b;
    border-left-color: #60a5fa;
}

[data-theme="dark"] .parent-info-title {
    color: #93c5fd;
}

[data-theme="dark"] .parent-info-text {
    color: #bfdbfe;
}

/* Mobile responsive amino acid info box */
@media (max-width: 767px) {
    /* Reset default spacing */
    #amino-acid-info .space-x-4 > * + * {
        margin-left: 0 !important;
    }
    
    /* First section: Basic Info Row */
    #amino-acid-info .space-y-3 > div:first-child {
        display: block !important;
        line-height: 1.6 !important;
    }
    
    /* Line 1: Amino Acid: I     Position: 206 /1343 */
    #amino-acid-info .space-y-3 > div:first-child span:nth-child(1),  /* Amino Acid: */
    #amino-acid-info .space-y-3 > div:first-child span:nth-child(2),  /* I */
    #amino-acid-info .space-y-3 > div:first-child span:nth-child(4),  /* Position: */
    #amino-acid-info .space-y-3 > div:first-child span:nth-child(5),  /* 206 */
    #amino-acid-info .space-y-3 > div:first-child span:nth-child(6) { /* /1343 */
        display: inline !important;
    }
    
    /* Add spacing between amino acid and position */
    #amino-acid-info .space-y-3 > div:first-child span:nth-child(2) {
        margin-right: 2rem !important;
    }
    
    /* Line 2: (Ile) Isoleucine */
    #amino-acid-info .space-y-3 > div:first-child span:nth-child(3) {
        display: block !important;
        margin-top: 0.5rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Second section: Nucleotide Info Row */
    #amino-acid-info .bg-white.p-2 {
        display: block !important;
        width: 100%;
        padding: 0.75rem !important;
        margin-top: 0.5rem;
        line-height: 1.6 !important;
    }
    
    /* Line 3: Codon (DNA): GCC */
    #amino-acid-info .bg-white span:nth-child(1) { /* Codon (DNA): */
        display: inline !important;
        margin-right: 0.5rem !important;
    }
    
    #amino-acid-info .bg-white span:nth-child(2) { /* GCC */
        display: inline !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Line 4: Nucleotide Position: 616-618 /4029 */
    #amino-acid-info .bg-white span:nth-child(3) { /* Nucleotide Position: */
        display: block !important;
        margin-top: 0.5rem !important;
        margin-right: 0.5rem !important;
        display: inline !important;
    }
    
    #amino-acid-info .bg-white span:nth-child(4),
    #amino-acid-info .bg-white span:nth-child(5) {
        display: inline !important;
        margin-right: 0.5rem !important;
    }
    
    /* Force line break after codon value */
    #amino-acid-info .bg-white span:nth-child(2)::after {
        content: "";
        display: block;
        margin: 0.5rem 0;
    }
    
    /* Third row - possible codons */
    #amino-acid-info .bg-yellow-50 {
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100%;
        display: flex;
        gap: 0.5rem;
        padding: 0.75rem !important;
        margin-top: 0.5rem;
    }
    
    /* Font sizes */
    #amino-acid-info .text-lg {
        font-size: 1rem !important;
    }
    
    #amino-acid-info .text-xl {
        font-size: 1.125rem !important;
    }
}

/* Ensure all numbered step circles are perfectly round */
.w-8.h-8.rounded-full {
    width: 2rem !important;
    height: 2rem !important;
    min-width: 2rem !important;
    min-height: 2rem !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* ========================================
   3D PROTEIN STRUCTURE VIEWER STYLING
   ======================================== */

/* Mol* viewer container */
#molstar-viewer {
    min-height: 600px;
    background-color: #f8fafc;
    border-radius: 0 0 0.5rem 0.5rem;
    position: relative;
}

/* Visualization mode buttons */
.viz-mode-btn {
    transition: all 0.2s ease;
    font-weight: 500;
    border: 1px solid transparent;
}

.viz-mode-btn:not(.active):hover {
    background-color: #e5e7eb !important;
    color: #374151 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.viz-mode-btn.active {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    border-color: #2563eb;
}

/* Structure example buttons */
.structure-example-btn {
    transition: all 0.2s ease;
}

.structure-example-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Domain info styling */
#domain-info .flex {
    transition: all 0.2s ease;
    cursor: pointer;
}

#domain-info .flex:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Residue info panel */
#residue-info {
    min-height: 200px;
}

/* Structure loading spinner */
#structure-spinner {
    border-top-color: transparent;
}

/* Mutation input error styling */
.mutation-input-error {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for 3D viewer */
@media (max-width: 1024px) {
    #molstar-viewer {
        height: 500px !important;
        min-height: 500px;
    }
    
    /* Stack visualization mode buttons on tablet */
    .viz-mode-btn {
        font-size: 13px;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 768px) {
    /* Mobile responsive adjustments */
    #molstar-viewer {
        height: 400px !important;
        min-height: 400px;
    }
    
    /* Stack domain info and residue info vertically */
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Adjust visualization mode buttons for mobile */
    .viz-mode-btn {
        font-size: 12px;
        padding: 0.4rem 0.6rem;
        margin: 0.1rem;
    }
    
    /* Reduce padding on mobile */
    #section-structure .space-y-8 > * + * {
        margin-top: 1.5rem;
    }
    
    /* Adjust structure examples for mobile */
    .structure-example-btn {
        font-size: 11px;
        padding: 0.25rem 0.5rem;
        margin: 0.1rem;
    }
    
    /* Make sure input and button fit on mobile */
    #structure-mutation-input {
        font-size: 14px;
    }
    
    #highlight-mutation-btn {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
        flex-shrink: 0;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    #molstar-viewer {
        height: 350px !important;
        min-height: 350px;
    }
    
    /* Stack visualization buttons completely */
    .flex.flex-wrap.gap-2 {
        flex-direction: column;
        align-items: stretch;
    }
    
    .viz-mode-btn {
        width: 100%;
        text-align: center;
    }
}

/* Dark theme support for 3D viewer */
[data-theme="dark"] #molstar-viewer {
    background-color: #1e293b;
}

[data-theme="dark"] .viz-mode-btn.active {
    background-color: #3b82f6 !important;
    color: white !important;
    border-color: #60a5fa;
}

[data-theme="dark"] .viz-mode-btn:not(.active) {
    background-color: #374151 !important;
    color: #d1d5db !important;
}

[data-theme="dark"] .viz-mode-btn:not(.active):hover {
    background-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

[data-theme="dark"] .structure-example-btn {
    background-color: #581c87 !important;
    color: #e9d5ff !important;
    border-color: #7c3aed;
}

[data-theme="dark"] .structure-example-btn:hover {
    background-color: #6b21a8 !important;
    color: #f3e8ff !important;
}

[data-theme="dark"] #structure-status {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] #structure-spinner {
    border-color: #60a5fa;
    border-top-color: transparent;
}

/* Loading state styling */
.viewer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(325deg, #f8fafc 0%, #e2e8f0 100%);
}

[data-theme="dark"] .viewer-loading {
    background: linear-gradient(325deg, #1e293b 0%, #0f172a 100%);
}

/* Protein domain color indicators */
.domain-color-indicator {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ===============================================
   EMAIL INTERFACE STYLES 
   =============================================== */

/* Floating Action Button */
.email-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(325deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-radius: 30px;
    display: none; /* Initially hidden until mutation is analyzed */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1000;
    padding: 0 20px;
    overflow: hidden;
}

.email-fab.expanded {
    width: 140px;
}

.email-fab-content {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-weight: 500;
    font-size: 14px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    transform: scale(1);
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.email-fab-content.morphing-out {
    opacity: 0;
    transform: scale(0.8);
}

.email-fab-content.morphing-in {
    opacity: 1;
    transform: scale(1);
}

.email-fab.visible {
    display: flex;
}

.email-fab:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.5);
}

.email-fab:active {
    transform: translateY(0) scale(0.95);
}

/* Dark theme support for FAB */
[data-theme="dark"] .email-fab {
    background: linear-gradient(325deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 8px 32px rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .email-fab:hover {
    box-shadow: 0 12px 40px rgba(96, 165, 250, 0.5);
}

/* Email Modal */
.email-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.email-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.email-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideInUp 0.4s ease-out;
}

/* Dark theme support for modal */
[data-theme="dark"] .email-modal-content {
    background: #1f2937;
    color: #f9fafb;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.email-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .email-modal-header {
    border-bottom-color: #374151;
}

.email-modal-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.email-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

[data-theme="dark"] .email-modal-close {
    color: #9ca3af;
}

[data-theme="dark"] .email-modal-close:hover {
    background: #374151;
    color: #d1d5db;
}

/* Modal Body */
.email-modal-body {
    padding: 20px 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Custom Scrollbar */
.email-modal-body::-webkit-scrollbar {
    width: 6px;
}

.email-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.email-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.email-modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

[data-theme="dark"] .email-modal-body::-webkit-scrollbar-track {
    background: #374151;
}

[data-theme="dark"] .email-modal-body::-webkit-scrollbar-thumb {
    background: #6b7280;
}

[data-theme="dark"] .email-modal-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Checkbox Styles */
.email-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.email-checkbox-label:hover {
    background: #f8fafc;
}

[data-theme="dark"] .email-checkbox-label:hover {
    background: #374151;
}

/* Select All checkbox special styling */
#select-all-sections + .email-checkbox-custom {
    border-color: #2563eb;
    border-width: 2px;
}

#select-all-sections:indeterminate + .email-checkbox-custom {
    background-color: #3b82f6;
    border-color: #2563eb;
}

#select-all-sections:indeterminate + .email-checkbox-custom::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 2px;
    background-color: white;
    transform: translate(-50%, -50%);
    border-radius: 1px;
}

.email-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.email-checkbox-custom {
    position: relative;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 12px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.email-checkbox:checked + .email-checkbox-custom {
    background: #3b82f6;
    border-color: #3b82f6;
}

.email-checkbox:checked + .email-checkbox-custom::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

[data-theme="dark"] .email-checkbox-custom {
    border-color: #6b7280;
}

[data-theme="dark"] .email-checkbox:checked + .email-checkbox-custom {
    background: #60a5fa;
    border-color: #60a5fa;
}

/* Email Input */
.email-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
}

.email-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.email-input:invalid {
    border-color: #ef4444;
}

[data-theme="dark"] .email-input {
    background: #374151;
    border-color: #6b7280;
    color: #f9fafb;
}

[data-theme="dark"] .email-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* Fix input field text color in dark mode - applies to all input fields */
[data-theme="dark"] input[type="text"] {
    background-color: #374151 !important;
    border-color: #6b7280 !important;
    color: #f9fafb !important;
}

[data-theme="dark"] input[type="text"]:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

[data-theme="dark"] input[type="text"]::placeholder {
    color: #9ca3af !important;
}

/* Modal Footer */
.email-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px 24px;
    border-top: 1px solid #e5e7eb;
    justify-content: flex-end;
}

[data-theme="dark"] .email-modal-footer {
    border-top-color: #374151;
}

/* Buttons */
.email-btn-primary,
.email-btn-secondary {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.email-btn-primary {
    background: #3b82f6;
    color: white;
}

.email-btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.email-btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.email-btn-secondary {
    background: white;
    color: #374151;
    border: 2px solid #d1d5db;
}

.email-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

[data-theme="dark"] .email-btn-primary {
    background: #60a5fa;
}

[data-theme="dark"] .email-btn-primary:hover:not(:disabled) {
    background: #3b82f6;
}

[data-theme="dark"] .email-btn-secondary {
    background: #374151;
    color: #d1d5db;
    border-color: #6b7280;
}

[data-theme="dark"] .email-btn-secondary:hover {
    background: #4b5563;
    border-color: #9ca3af;
}

/* Loading state */
.email-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .email-fab {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .email-modal {
        padding: 16px;
        align-items: flex-end;
    }
    
    .email-modal-content {
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
    }
    
    .email-modal-header,
    .email-modal-body,
    .email-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .email-modal-footer {
        flex-direction: column-reverse;
    }
    
    .email-btn-primary,
    .email-btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* Ribbon */
.ribbon-container {
    --d: 6px; /* folded part */
    --c: #ff0000; /* color - matches primary-color */
    --f: 14px; /* ribbon font-size */

    position: fixed;
    bottom: 0;
    left: 0;
    width: 200px;
    height: 100px;
    z-index: var(--z-dropdown);
}

.ribbon-container::before {
    content: attr(data-ribbon);
    position: absolute;
    font-size: var(--f);
    bottom: 0;
    right: 0;
    transform: translate(29.29%, 100%) rotate(-45deg);
    color: #fff;
    text-align: center;
    border: 1px solid transparent;
    border-top: 0;
    transform-origin: top left;
    padding: calc(var(--d) + 5px) 35px 5px;
    background: linear-gradient(rgba(0, 0, 0, 0.5) 0 0) top/100% var(--d)
        no-repeat var(--c);
    background-clip: padding-box;
    clip-path: polygon(0 0, var(--d) var(--d), calc(100% - var(--d)) var(--d), 100% 0, 100% 100%, 0 100%);
    -webkit-mask: linear-gradient(45deg, transparent calc(50% - var(--d) * 0.707), #fff 0) top left,
        linear-gradient(-45deg, transparent calc(50% - var(--d) * 0.707), #fff 0) top right;
    mask: linear-gradient(45deg, transparent calc(50% - var(--d) * 0.707), #fff 0) top left,
        linear-gradient(-45deg, transparent calc(50% - var(--d) * 0.707), #fff 0) top right;
    -webkit-mask-size: 300vmax 300vmax;
    mask-size: 300vmax 300vmax;
    -webkit-mask-composite: destination-in;
    mask-composite: intersect;
}

.ribbon-container.left::before {
    left: 0;
    right: auto;
    transform: translate(-29.29%, 100%) rotate(45deg);
    transform-origin: top right;
}

/* Responsive adjustments for ribbon */
@media (max-width: 768px) {
    .ribbon-container {
        --f: 12px;
        width: 160px;
        height: 70px;
    }
}

@media (max-width: 576px) {
    .ribbon-container {
        --f: 10px;
        width: 140px;
        height: 60px;
    }
}