/* Base CSS for Mini Omics Data Portal - Theme-Independent Styles */

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Accessibility Styles */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: var(--text-white);
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-to-main:focus {
    top: 0;
}

/* Focus indicators */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:focus,
.nav-link:focus {
    outline: 3px solid var(--primary-500);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--text-primary) !important;
    }
    
    .btn-primary {
        border: 2px solid var(--text-primary);
    }
    
    .species-card:hover {
        border-color: var(--text-primary) !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;
        scroll-behavior: auto !important;
    }
    
    .species-card,
    .hover-lift {
        transform: none !important;
    }
}

/* Hero Section */
.hero-section {
    background: var(--gradient-primary);
    min-height: 20vh;
    display: flex;
    align-items: center;
    color: var(--text-white);
}

/* Hero Section with Background Image */
.hero-with-bg {
    background-image: url('../images/genomics-bg.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
}

.hero-with-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-overlay);
    z-index: 1;
}

.hero-with-bg .container {
    position: relative;
    z-index: 2;
}

.bg-gradient-primary {
    background: var(--gradient-primary);
}

.hero-stats {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
    padding: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-white);
    font-family: 'Courier New', monospace;
}

.stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Species Cards */
.species-card {
    transition: all 0.3s ease;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    background: var(--card-bg);
}

.species-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg) !important;
}

.species-card a {
    text-decoration: none !important;
    color: inherit;
}

.species-card a:hover {
    color: inherit;
}

.card-img-container {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.species-card .card-body {
    padding: 1.5rem;
}

.species-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.species-card:hover .species-image {
    transform: scale(1.05);
}

.card-img-overlay {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 1.5rem;
}

.species-overlay-content {
    width: 100%;
}

.species-stats {
    background: var(--light-bg);
    border-radius: 10px;
    padding: 1rem;
}

.stat-mini {
    padding: 0.25rem;
}

.stat-mini .fw-bold {
    font-size: 1.1rem;
}

.stat-mini .small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Feature Cards */
.feature-card {
    background: var(--card-bg);
    border-radius: 15px;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-100);
}

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Navigation */
.navbar {
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    background: var(--primary-color) !important;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white) !important;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.nav-link:hover {
    color: var(--text-white) !important;
}

/* Footer */
footer {
    background: var(--dark-bg) !important;
    color: var(--text-white);
}

/* Species Page Styles */
.species-header {
    background: var(--gradient-primary);
    color: var(--text-white);
    min-height: 20vh;
    display: flex;
    align-items: center;
}

.species-nav {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.tool-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.iframe-container {
    position: relative;
    width: 100%;
    height: 700px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-medium);
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Hover Effects */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.species-card {
    animation: fadeInUp 0.6s ease forwards;
}

.species-card:nth-child(1) { animation-delay: 0.1s; }
.species-card:nth-child(2) { animation-delay: 0.2s; }
.species-card:nth-child(3) { animation-delay: 0.3s; }
.species-card:nth-child(4) { animation-delay: 0.4s; }
.species-card:nth-child(5) { animation-delay: 0.5s; }
.species-card:nth-child(6) { animation-delay: 0.6s; }

/* Responsive Design */
@media (max-width: 1200px) {
    .species-card {
        margin-bottom: 1.5rem;
    }
    
    .iframe-container {
        min-height: 500px;
    }
}

@media (max-width: 992px) {
    .hero-section {
        min-height: 25vh;
        text-align: center;
        padding: 2rem 0;
    }
    
    .hero-stats {
        margin-top: 1.5rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .species-nav .nav-pills .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        min-height: 20vh;
        padding: 1.5rem 0;
    }
    
    .hero-stats {
        margin-top: 1rem;
    }
    
    .hero-stats .row {
        justify-content: center;
    }
    
    .hero-stats .col-6 {
        flex: 0 0 45%;
        margin-bottom: 0.5rem;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    .h1 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .species-card .card-body {
        padding: 1rem;
    }
    
    .species-stats {
        padding: 0.75rem;
    }
    
    .stat-mini .fw-bold {
        font-size: 1rem;
    }
    
    .iframe-container {
        min-height: 400px;
    }
    
    .tool-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .species-nav .nav-pills {
        flex-direction: column;
    }
    
    .species-nav .nav-pills .nav-link {
        margin: 0.125rem 0;
        text-align: center;
    }
    
    .feature-card {
        padding: 1.5rem 1rem;
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 1rem 0;
    }
    
    .hero-stats {
        margin-top: 0.75rem;
        padding: 0.75rem;
    }
    
    .hero-stats .small {
        font-size: 0.75rem;
    }
    
    .h3 {
        font-size: 1.25rem;
    }
    
    .species-card .card-img-container {
        height: 150px;
    }
    
    .species-stats {
        padding: 0.5rem;
    }
    
    .species-stats .row {
        margin: 0;
    }
    
    .species-stats .col-6 {
        padding: 0.25rem;
    }
    
    .stat-mini {
        padding: 0.25rem;
    }
    
    .stat-mini .fw-bold {
        font-size: 0.9rem;
    }
    
    .stat-mini .small {
        font-size: 0.7rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .iframe-container {
        min-height: 350px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand i {
        display: none;
    }
    
    .skip-to-main {
        left: 3px;
        padding: 6px;
        font-size: 0.8rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .species-card:hover {
        transform: none;
    }
    
    .btn {
        min-height: 44px; /* Touch target size */
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .species-card {
        transition: none;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .species-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}
