/**
 * Custom CSS for Splicing Predictor
 * Supplements Tailwind CSS with application-specific styles
 */

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Sequence textarea styling */
#sequence {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    letter-spacing: 0.05em;
    resize: vertical;
}

/* Sequence display styling */
.sequence-display {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    letter-spacing: 0.05em;
    word-break: break-all;
    line-height: 1.5;
}

/* Structure display styling */
.structure-display {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    letter-spacing: 0.05em;
}

/* Force plot container */
#force-plot {
    min-height: 400px;
}

/* Animation for loading spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Pulse animation for loading states */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* FAQ toggle animation */
.faq-toggle svg {
    transition: transform 0.2s ease-in-out;
}

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

/* Card hover effects */
.card-hover {
    transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.card-hover:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Example card cursor */
[onclick] {
    cursor: pointer;
}

/* Code block styling */
pre code {
    display: block;
    overflow-x: auto;
}

/* Truncate with ellipsis */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Focus styles for accessibility */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Hide focus outline for mouse users */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles */
@media print {
    /* Hide navigation and interactive elements */
    nav,
    footer,
    button,
    .no-print {
        display: none !important;
    }

    /* Ensure content is visible */
    .print-only {
        display: block !important;
    }

    /* Remove shadows and borders for cleaner print */
    .shadow-sm,
    .shadow {
        box-shadow: none !important;
    }

    /* Ensure text is black for printing */
    body {
        color: #000 !important;
        background: #fff !important;
    }
}

/* Mobile optimizations */
@media (max-width: 640px) {
    /* Larger touch targets */
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better text readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    /* Full width buttons on mobile */
    .btn-mobile-full {
        width: 100%;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .border-gray-200 {
        border-color: #000 !important;
    }

    .text-gray-500 {
        color: #000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Sortable table header styles */
.sortable-header {
    cursor: pointer;
    user-select: none;
}

.sortable-header:hover {
    background-color: #f3f4f6;
}

.sortable-header.sorted .sort-icons {
    opacity: 1 !important;
}

.sortable-header.sorted .sort-neutral {
    display: none;
}

.sortable-header.sorted.asc .sort-asc {
    display: block;
}

.sortable-header.sorted.desc .sort-desc {
    display: block;
}

/* Filter panel chevron rotation */
#filter-chevron.rotate-180 {
    transform: rotate(180deg);
}

/* Collapsible panel styles */
.collapsible-panel {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #f9fafb;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.collapsible-header:hover {
    background-color: #f3f4f6;
}

.collapsible-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.collapsible-chevron {
    transition: transform 0.2s ease;
    color: #6b7280;
}

.collapsible-header.expanded .collapsible-chevron {
    transform: rotate(180deg);
}

.collapsible-content {
    display: none;
    padding: 16px;
    border-top: 1px solid #e5e7eb;
}

.collapsible-content.expanded {
    display: block;
}

/* Variant analysis styles */
.mutation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mutation-table th,
.mutation-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.mutation-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.mutation-table tr:hover {
    background-color: #f9fafb;
}

.delta-positive {
    color: #059669;
    font-weight: 500;
}

.delta-negative {
    color: #dc2626;
    font-weight: 500;
}

/* Download tab styles */
.download-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.download-checkbox-group label:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.download-checkbox-group input[type="checkbox"]:checked + span {
    color: #2563eb;
}

/* Loading spinner for variant analysis */
.variant-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
}

.variant-loading svg {
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

/* History page floating row actions */
.row-action-buttons {
    display: flex;
    gap: 4px;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.row-action-buttons.visible {
    opacity: 1;
}

.row-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #9ca3af;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    position: relative;
}

.row-action-btn:hover {
    color: #374151;
    background-color: #f3f4f6;
}

.row-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Tooltip for row action buttons */
.row-action-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: #1f2937;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
    margin-bottom: 4px;
}

.row-action-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Preview modal PSI card colors */
.preview-psi-high {
    background-color: #dcfce7;
}

.preview-psi-high #preview-psi-value {
    color: #166534;
}

.preview-psi-low {
    background-color: #fee2e2;
}

.preview-psi-low #preview-psi-value {
    color: #991b1b;
}

.preview-psi-medium {
    background-color: #fef3c7;
}

.preview-psi-medium #preview-psi-value {
    color: #92400e;
}
