:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #22d3ee;
    --success: #10b981;
    --danger: #ef4444;
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(34, 211, 238, 0.15) 0, transparent 50%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Full Screen Layout (No Sidebar) */
.full-screen-lab {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 3rem;
    overflow: hidden;
    position: relative;
    animation: fadeIn 0.5s ease;
}

.lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.lab-header h2 {
    font-size: 2rem;
    font-weight: 600;
}

.back-home {
    text-decoration: none;
    color: var(--accent);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.8rem 1.5rem;
    background: var(--glass);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.back-home:hover {
    background: var(--border);
    transform: translateX(-5px);
}

/* Genotype Toggle Group */
.genotype-toggle-group {
    display: flex;
    gap: 0.5rem;
    background: var(--glass);
    padding: 6px;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.toggle-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.toggle-btn:hover:not(.active) {
    background: var(--glass);
    color: var(--text-color);
}

.app-container {
    display: flex;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--primary-color);
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    padding: 1.2rem;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--glass);
    color: var(--text-color);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.nav-btn .icon {
    font-size: 1.2rem;
}

/* Main Content */
.content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    max-height: 100vh;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

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

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

.tab-header {
    margin-bottom: 3rem;
}

.tab-header h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tab-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Simulator Layout */
/* Simulator Layout - Horizontal Split */
.simulator-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    flex: 1;
    overflow: hidden;
}

.lab-main-zone {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 1rem;
}

.parent-selection {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    justify-content: center;
}

.parent-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 24px;
    flex: 1;
    max-width: 400px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Touch-friendly Feedback */
.toggle-btn:active, .primary-btn:active, .secondary-btn:active, .interactive:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.interactive.selected {
    background: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 0 15px var(--primary-color);
    transform: translateY(-2px);
}

.results-area {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.parent-box h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.genotype-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.allele-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--glass);
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.allele-btn:hover {
    border-color: var(--primary-color);
}

.allele-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.selected-display {
    font-size: 3.5rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 2px;
}

.vs {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 300;
    display: flex;
    align-items: center;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: var(--glass);
    color: var(--text-color);
    border: 1px solid var(--border);
    padding: 1.2rem 2.5rem;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: var(--border);
}

/* Results Area & Charts */
.results-area {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-section {
    width: 100%;
}

.chart-section h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.chart-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.chart-label {
    width: 100px;
    font-weight: 600;
    color: var(--text-muted);
}

.chart-bar-bg {
    flex: 1;
    height: 12px;
    background: var(--glass);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.05);
}

.chart-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: 6px;
    box-shadow: 0 0 15px var(--primary-color);
}

.chart-value {
    width: 80px;
    text-align: right;
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
}

/* Reproduction Arena */
.reproduction-arena {
    height: 180px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 24px;
    border: 2px dashed var(--border);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.gamete {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    color: black;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.8rem;
    position: absolute;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
    z-index: 10;
}

.gamete.male { border: 4px solid #6366f1; top: -60px; left: calc(50% - 65px); }
.gamete.female { border: 4px solid #ec4899; top: -60px; left: calc(50% + 15px); }

.offspring-preview {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    background: var(--glass);
    border: 2px solid var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-color);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 30px rgba(34, 211, 238, 0.3);
}

.offspring-preview.show {
    opacity: 1;
    transform: scale(1);
}

@keyframes glideDownMale {
    0% { top: -60px; opacity: 0; transform: scale(0.8); }
    20% { opacity: 1; transform: scale(1); }
    100% { top: 65px; left: calc(50% - 50px); }
}

@keyframes glideDownFemale {
    0% { top: -60px; opacity: 0; transform: scale(0.8); }
    20% { opacity: 1; transform: scale(1); }
    100% { top: 65px; left: calc(50% + 0px); }
}

/* Punnett Interaction */
.punnett-table th.interactive {
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.punnett-table th.interactive:hover {
    background: var(--glass);
    color: var(--primary-color);
}

.punnett-table th.selected {
    background: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 0 15px var(--primary-color);
}

.punnett-table td.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.punnett-table td.clickable:hover {
    background: var(--glass);
}

.punnett-table td.filled {
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ABO Column Styles */
.blood-select {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-color);
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
}

.blood-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.blood-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.blood-type {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--danger);
    margin-bottom: 0.5rem;
}

.genotypes {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Punnett Tool */
.punnett-tool .inputs {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 3rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group input {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-color);
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
}

.punnett-container {
    overflow-x: auto;
}

.punnett-table {
    table-layout: fixed;
    width: auto;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 10px;
}

.punnett-table th, .punnett-table td {
    background: var(--card-bg);
    padding: 0;
    border-radius: 12px;
    border: 2px solid rgba(34, 211, 238, 0.3); /* Using accent color with alpha */
    font-size: 2.2rem;
    font-weight: 700;
    width: 140px;
    height: 140px;
    min-width: 140px;
    max-width: 140px;
    min-height: 140px;
    max-height: 140px;
    text-align: center;
    vertical-align: middle;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.punnett-table th.interactive {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

.punnett-table th {
    background: var(--glass);
    color: var(--accent);
}

.punnett-table .corner {
    background: transparent;
    border: none;
}

/* Multi-page Navigation Cards */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
    margin-top: 1rem;
}

.portal-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 3rem;
    border-radius: 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    transition: 0.6s;
}

.portal-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.portal-card:hover::before {
    transform: translateX(100%);
}

.portal-card .card-icon {
    font-size: 3.5rem;
    background: var(--glass);
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    margin-bottom: 0.5rem;
}

.portal-card h3 {
    font-size: 1.8rem;
    font-weight: 600;
}

.portal-card p {
    color: var(--text-muted);
    line-height: 1.6;
}

.card-action {
    margin-top: auto;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Animations and Responsive */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        padding: 1.5rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: auto;
        position: relative;
        gap: 1rem;
    }
    nav {
        flex-direction: row;
        gap: 0.5rem;
    }
    .nav-item {
        padding: 0.8rem;
    }
    .nav-item span:last-child {
        display: none;
    }
}
