@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --bg-deep: var(--color-bg-primary, #0b101e);
    --card-glass: var(--color-bg-secondary, rgba(20, 26, 45, 0.6));
    --border-glass: var(--color-border, rgba(255, 255, 255, 0.08));
    --neon-pink: #ff2d75;
    --neon-blue: #00d2ff;
    --neon-green: #39ff14;
    --text-main: var(--color-text-primary, #e2e8f0);
    --text-muted: var(--color-text-secondary, #94a3b8);
    --accent: var(--color-accent-blue, #6366f1);
    --mono: 'JetBrains Mono', monospace;
    
    
    --pastel-pink: #ff85a1;
    --pastel-blue: #8ec5fc;
    --pastel-green: #b2f2bb;
    --glass-opacity: 0.6;
}

[data-theme="light"] {
    --bg-deep: #f8f9ff;
    --card-glass: rgba(255, 255, 255, 0.8);
    --border-glass: rgba(125, 137, 221, 0.15);
    --neon-pink: var(--pastel-pink);
    --neon-blue: var(--pastel-blue);
    --neon-green: #40c057;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --accent: #7d89dd;
    --glass-opacity: 0.9;
}

.breeding-calculator-container {
    max-width: 1300px;
    width: 100%;
    margin: 20px auto;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    color: var(--text-main);
}

.rg-hero { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.rg-hero-text h1 { font-size: clamp(1.5rem,3.5vw,2.5rem); font-weight: 900;
  background: linear-gradient(135deg, #facc15, #ef4444);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: .25rem; line-height: 1.1; }
.rg-hero-text p { color: var(--text-muted); font-size: .95rem; margin: 0; }

.grid-2 { display: flex; flex-wrap: wrap; gap: 20px; }
.parent-panel { flex: 1; min-width: 450px; }
.grid-3 { display: flex; flex-wrap: wrap; gap: 20px; }
.target-settings > div { flex: 1; min-width: 300px; }

.glass-panel {
    background: var(--card-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow-md, 0 8px 32px 0 rgba(0, 0, 0, 0.37));
    transition: 0.3s ease;
}


.parent-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.parent-panel h2 { font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

.neon-pink { border-top: 3px solid var(--neon-pink); box-shadow: inset 0 10px 20px -10px rgba(255, 133, 161, 0.1); }
.neon-blue { border-top: 3px solid var(--neon-blue); box-shadow: inset 0 10px 20px -10px rgba(142, 197, 252, 0.1); }

.gender-toggle { display: flex; gap: 5px; background: rgba(0,0,0,0.1); padding: 4px; border-radius: 10px; }
[data-theme="light"] .gender-toggle { background: rgba(0,0,0,0.05); }

.gender-btn {
    background: transparent; border: none; font-size: 1.2rem; color: var(--text-muted);
    cursor: pointer; padding: 2px 10px; border-radius: 8px; transition: 0.2s;
}
.gender-btn:hover { color: var(--text-main); }
.gender-btn.active.female { background: var(--neon-pink); color: white; }
.gender-btn.active.male { background: var(--neon-blue); color: white; }
.gender-btn.active.genderless { background: var(--text-muted); color: white; }


.search-wrapper { position: relative; margin-bottom: 20px; }
.search-controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 12px 15px; background: rgba(0,0,0,0.1); border: 1px solid var(--border-glass);
    border-radius: 12px; color: var(--text-main); font-size: 0.95rem; outline: none; transition: 0.2s;
}
[data-theme="light"] .search-input { background: #ffffff; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 10px rgba(125, 137, 221, 0.2); }

.filter-actions {
    display: flex;
    gap: 5px;
}

.filter-btn {
    background: var(--card-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.filter-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    max-height: 250px; overflow-y: auto; background: #1a1d2e !important; border: 1px solid var(--border-glass);
    border-radius: 12px; margin-top: 5px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .search-dropdown {
    background: #ffffff !important;
}

.search-dropdown .result-item {
    display: flex; align-items: center; gap: 10px; padding: 10px; cursor: pointer; border-bottom: 1px solid var(--border-glass);
    color: var(--text-main);
}
.search-dropdown .result-item:hover { background: var(--color-surface-hover); }
.search-dropdown .result-item img { width: 40px; }


.poke-display { display: flex; align-items: center; gap: 20px; background: rgba(0,0,0,0.05); padding: 15px; border-radius: 15px; margin-bottom: 20px; }
.poke-img { width: 80px; height: 80px; filter: drop-shadow(0 0 10px rgba(0,0,0,0.1)); }
.poke-meta h3 { text-transform: capitalize; font-size: 1.2rem; margin: 0; }
.poke-meta p { color: var(--text-muted); font-size: 0.85rem; margin-top: 5px; }


.modifiers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.input-group label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; text-transform: uppercase; }
.flex-row { display: flex !important; flex-direction: row; justify-content: space-between; align-items: center; }

.custom-select {
    width: 100%; padding: 10px; background: #0b1120; border: 1px solid var(--border-glass);
    border-radius: 10px; color: var(--text-main); outline: none; cursor: pointer; font-size: 0.85rem;
}
select.custom-select option { background: #0b1120; color: #fff; }
[data-theme="light"] .custom-select { background: #ffffff; color: var(--text-main); }
[data-theme="light"] select.custom-select option { background: #ffffff; color: var(--text-main); }


.iv-section { background: rgba(0,0,0,0.05); padding: 15px; border-radius: 15px; }
.iv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.btn-tiny {
    background: var(--accent); border: none; color: white; font-size: 0.7rem;
    padding: 4px 10px; border-radius: 6px; cursor: pointer; text-transform: uppercase; font-weight: 700;
}
.iv-inputs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.iv-box { text-align: center; }
.iv-box label { display: block; font-size: 0.65rem; color: var(--text-muted); font-weight: 700; margin-bottom: 5px; }
.iv-box input {
    width: 100%; padding: 8px 0; text-align: center; border-radius: 8px;
    background: rgba(0,0,0,0.05); border: 1px solid var(--border-glass); color: var(--text-main); font-family: var(--mono);
}
[data-theme="light"] .iv-box input { background: #ffffff; }


.target-section { margin: 25px 0; border: 1px solid var(--border-glass); position: relative; overflow: hidden; }
.target-section::before {
    content: ''; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(125, 137, 221, 0.05), transparent); pointer-events: none;
}
.target-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.target-header .icon { font-size: 1.5rem; }
.target-header h2 { font-size: 1.1rem; margin: 0; text-transform: uppercase; }

.iv-toggle-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.iv-toggle {
    background: rgba(0,0,0,0.05); border: 1px solid var(--border-glass); color: var(--text-muted);
    padding: 8px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: 0.2s;
}
[data-theme="light"] .iv-toggle { background: #ffffff; }
.iv-toggle[data-active="true"] { background: var(--accent); color: white; border-color: var(--accent); box-shadow: var(--glow-accent); }

.shiny-opt { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.shiny-result { background: rgba(0,0,0,0.05); padding: 15px; border-radius: 12px; text-align: center; }
[data-theme="light"] .shiny-result { background: #ffffff; }
.shiny-result .label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.shiny-result .value { display: block; font-size: 1.4rem; font-weight: 800; color: #f59f00; margin-top: 5px; text-shadow: 0 0 10px rgba(245, 159, 0, 0.2); }


.dashboard-section { border: 1px solid var(--border-glass); }
.dashboard-grid { display: flex; flex-wrap: wrap; gap: 30px; }
.dash-card { flex: 1; min-width: 300px; }

.dash-card h3 { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 15px; letter-spacing: 1px; }

.status-badge { display: inline-block; padding: 8px 15px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; margin-bottom: 10px; }
.status-badge.bad { background: rgba(255, 45, 117, 0.1); color: var(--neon-pink); border: 1px solid var(--neon-pink); }
.status-badge.good { background: rgba(64, 192, 87, 0.1); color: var(--neon-green); border: 1px solid var(--neon-green); }
.quote { font-style: italic; font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

.huge-number { margin: 15px 0; }
.huge-number span { display: block; font-size: 3rem; font-weight: 900; color: var(--neon-green); text-shadow: 0 0 20px rgba(64, 192, 87, 0.2); }
.huge-number small { font-size: 0.9rem; color: var(--text-muted); font-family: var(--mono); }

.progress-container { width: 100%; height: 8px; background: rgba(0,0,0,0.05); border-radius: 999px; overflow: hidden; margin-top: 15px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--neon-green)); transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }


.inheritance-grid { display: flex; flex-direction: column; gap: 10px; }
.stat-line { display: flex; align-items: center; gap: 10px; }
.stat-line .label { font-size: 0.75rem; width: 35px; color: var(--text-muted); font-weight: 700; }
.track { flex-grow: 1; height: 12px; background: rgba(0,0,0,0.05); border-radius: 4px; display: flex; overflow: hidden; border: 1px solid var(--border-glass); }
.bar { height: 100%; transition: width 0.5s ease; }
.bar-a { background: var(--neon-pink); }
.bar-b { background: var(--neon-blue); }
.bar-r { background: var(--text-muted); opacity: 0.3; }

.legend { display: flex; gap: 15px; margin-top: 15px; }
.legend span { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--text-muted); }
.legend .color { width: 8px; height: 8px; border-radius: 2px; }
.legend .color.a { background: var(--neon-pink); }
.legend .color.b { background: var(--neon-blue); }
.legend .color.r { background: var(--text-muted); opacity: 0.3; }


.bc-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.bc-popup-content {
    background: var(--bg-deep);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.bc-popup-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bc-popup-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

.bc-close {
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}

.bc-close:hover {
    color: var(--neon-pink);
}

.bc-popup-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.bc-grid-item {
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

[data-theme="light"] .bc-grid-item {
    background: #ffffff;
}

.bc-grid-item:hover {
    transform: translateY(-5px);
    background: var(--accent);
    color: white;
}

.bc-grid-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
}

.bc-grid-item span {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}


.ios-switch { position: relative; width: 40px; height: 20px; appearance: none; background: rgba(0,0,0,0.1); border-radius: 20px; cursor: pointer; transition: 0.3s; }
.ios-switch:checked { background: var(--accent); }
.ios-switch::before {
    content: ''; position: absolute; width: 16px; height: 16px; background: white; border-radius: 50%;
    top: 2px; left: 2px; transition: 0.3s;
}
.ios-switch:checked::before { left: 22px; }

.ai-coach-box {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .ai-coach-box {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .coach-content {
    color: #475569 !important;
}


@media (max-width: 1000px) {
    .breeding-calculator-container { margin-left: 5px; margin-right: 5px; }
    .grid-2, .grid-3, .dashboard-grid { flex-direction: column; }
    .parent-panel, .target-settings > div, .dash-card { min-width: 100%; }
}

.hidden { display: none !important; }


.bc-guide-box {
    margin-top: 3rem;
    background: var(--card-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    overflow: hidden;
}

.bc-guide-box details { width: 100%; }

.bc-guide-box details summary {
    padding: 1.25rem 1.5rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.05); 
    transition: background .2s;
}

.bc-guide-box details summary::-webkit-details-marker { display: none; }

[data-theme="light"] .bc-guide-box details summary {
    background: #f1f5f9;
}

.bc-guide-box details summary:hover {
    background: var(--border-glass);
}

.bc-guide-box details summary::after {
    content: "▼";
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.bc-guide-box details[open] summary::after { transform: rotate(180deg); }
.bc-guide-box details[open] summary { border-bottom: 1px solid var(--border-glass); }

.bc-guide-content {
    padding: 2rem;
    line-height: 1.8;
    color: var(--text-muted);
    font-size: 1rem;
}

[data-theme="light"] .bc-guide-content {
    color: #475569;
}

.bc-guide-content h2 { color: var(--text-main); margin: 2.5rem 0 1rem; font-size: 1.5rem; font-weight: 800; }
.bc-guide-content h3 { color: #dc2626; margin: 2rem 0 1rem; font-size: 1.25rem; font-weight: 800; }
.bc-guide-content h2:first-child, .bc-guide-content h3:first-child { margin-top: 0; }
.bc-guide-content p { margin-bottom: 1.5rem; }
.bc-guide-content p:last-child { margin-bottom: 0; }
.bc-guide-content ul, .bc-guide-content ol { margin: 0 0 1.5rem 1.5rem; padding: 0; }
.bc-guide-content li { margin-bottom: 0.75rem; list-style-type: disc; }
.bc-guide-content li strong { color: var(--text-main); }