/* css/creatures.css — Creature page styles */

.creatures-container {
    text-align: center;
    padding: 8rem 1rem 4rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.creatures-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1rem;
    background: linear-gradient(to right, #d6b46a, #f0ddaf, #d6b46a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.creatures-subtitle {
    color: var(--text-soft);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.tab-btn {
    padding: 0.8rem 2rem;
    background: var(--bg-muted);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: var(--border);
    color: var(--gold);
}

.tab-btn.active {
    background: linear-gradient(135deg, #74c69d, #95d5b2);
    border-color: #74c69d;
    color: #0b1a0f;
    box-shadow: 0 4px 20px rgba(116, 198, 157, 0.4);
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Creatures Grid */
.creatures-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 4rem;
}

.creature-card {
    background: linear-gradient(135deg, var(--bg-panel), var(--bg-muted));
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    width: 260px;
}

.creature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(74, 222, 128, 0.2);
    border-color: var(--accent);
}

.creature-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.creature-name {
    color: #ffe066;
    text-align: center;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.creature-type {
    color: var(--text-soft);
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.creature-rarity {
    text-align: center;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
    margin: 0 auto;
    font-weight: bold;
}

.rarity-common { background: #5a6b4e; color: #c8d6c1; }
.rarity-rare { background: #2d6a9f; color: #87ceeb; }
.rarity-epic { background: #6a3d6e; color: #c084fc; }
.rarity-legendary { background: linear-gradient(135deg, #d6b46a, #f0ddaf); color: #1a1a2e; }

/* Creature Card — Personality Badge */
.card-personality {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(139, 92, 246, 0.18);
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.78rem;
    color: #c4b5fd;
    margin: 0.35rem auto 0;
    font-weight: 600;
}

/* Creature Card — Taming Bar */
.card-tame-bar-bg {
    margin-top: 0.5rem;
    width: 100%;
    height: 7px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
}

.card-tame-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #86efac);
    border-radius: 10px;
    transition: width 0.4s ease;
    box-shadow: 0 0 6px rgba(74,222,128,0.5);
}

.card-tame-label {
    font-size: 0.77rem;
    color: #86efac;
    margin-top: 0.25rem;
    text-align: center;
}

.card-tame-label.tame-done {
    color: #4ade80;
    font-weight: bold;
}

/* Personality panel in modal */
.personality-panel {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 1rem 1.2rem;
}

.personality-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

/* Progress Bar */
.tame-progress {
    margin-top: 1rem;
    width: 100%;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
}

.tame-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #6ee7a7);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 10, 5, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-panel), var(--bg-muted));
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 2.5rem 2rem 2rem;
    max-width: 800px;
    width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 20px 80px rgba(74, 222, 128, 0.2);
}

.modal-header {
    flex-shrink: 0;
    text-align: center;
}

.modal-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.2rem 0 0.8rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.8rem;
    flex-wrap: wrap;
}

.modal-tab-btn {
    padding: 0.6rem 1.2rem;
    background: var(--bg-muted);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.modal-tab-btn:hover {
    background: var(--border);
    color: var(--gold);
}

.modal-tab-btn.active {
    background: linear-gradient(135deg, #74c69d, #95d5b2);
    border-color: #74c69d;
    color: #0b1a0f;
    box-shadow: 0 4px 20px rgba(116, 198, 157, 0.4);
    font-weight: bold;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-top: 0.5rem;
}

.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: var(--bg); border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.modal-tab-content { display: none; }
.modal-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-soft);
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.3s ease;
}

.modal-close:hover { color: #ff6b6b; }

.modal-icon {
    font-size: 6rem;
    text-align: center;
    margin-bottom: 1rem;
}

.modal-name {
    color: #ffe066;
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-section {
    margin: 1.2rem 0;
    padding: 1.2rem;
    background: linear-gradient(135deg, rgba(15, 43, 29, 0.6), rgba(11, 26, 15, 0.8));
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: left;
}

.modal-section:last-child { margin-bottom: 0; }

.modal-section h3 {
    color: #ffe066;
    font-size: 1.05rem;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: rgba(11, 26, 15, 0.7);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.25s ease;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.15);
}

.stat-label {
    color: #b8ccbe;
    font-size: 0.92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-value {
    color: #ffe066;
    font-weight: 700;
    font-size: 1.05rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-base-val {
    color: #ffe066;
    font-weight: 700;
    position: relative;
    cursor: default;
}

.stat-base-val.has-tooltip {
    cursor: help;
}

.stat-mod {
    font-size: 0.82rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    cursor: help;
    position: relative;
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.stat-mod.positive {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.4);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.2);
}

.stat-mod.positive:hover {
    background: rgba(34, 197, 94, 0.28);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.35);
}

.stat-mod.negative {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.4);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.stat-mod.negative:hover {
    background: rgba(239, 68, 68, 0.28);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

/* Floating Detail Tooltip — fixed-position so it escapes modal overflow clipping */
.stat-tooltip {
    position: fixed;
    min-width: 200px;
    max-width: 280px;
    background: linear-gradient(145deg, rgba(10, 25, 16, 0.98), rgba(6, 16, 10, 0.98));
    border: 1px solid rgba(116, 198, 157, 0.45);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), 0 0 15px rgba(74, 222, 128, 0.15);
    backdrop-filter: blur(10px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    text-align: left;
    white-space: normal;
}

.stat-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 14px;
    border-width: 6px;
    border-style: solid;
    border-color: rgba(116, 198, 157, 0.45) transparent transparent transparent;
}

/* JS adds this class to show the tooltip */
.stat-tooltip.stat-tooltip-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* When near top of viewport, tooltip flips below — arrow points up */
.stat-tooltip.stat-tooltip-below::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent rgba(116, 198, 157, 0.45) transparent;
}

.tooltip-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f0ddaf;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
    margin-bottom: 6px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    margin-bottom: 4px;
    gap: 12px;
}

.tooltip-row .tooltip-source {
    color: #b8ccbe;
    font-weight: 500;
}

.tooltip-row .tooltip-val {
    font-family: monospace, sans-serif;
    font-size: 0.85rem;
}

.tooltip-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 5px;
    margin-top: 6px;
}

.tooltip-total .tooltip-source {
    color: #cbd5e1;
}

.tooltip-total .tooltip-val {
    color: #ffe066;
    font-size: 0.95rem;
}

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

/* Gear Slots */
.gear-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gear-slot {
    background: rgba(0,0,0,0.2);
    border: 2px dashed var(--border);
    border-radius: 4px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    font-size: 0.9rem;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gear-slot:hover {
    border-color: var(--gold);
    background: rgba(214, 180, 106, 0.1);
}

.gear-slot .equipped-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    height: 100%;
    padding: 0 1rem;
    font-size: 1.2rem;
    color: var(--gold);
}

.equipped-item .unequip-btn {
    margin-left: auto;
    background: rgba(255, 74, 74, 0.2);
    border: 1px solid #ff4a4a;
    color: #ff4a4a;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Equip Modal */
#equip-modal {
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.equip-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1rem;
}

.equip-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.equip-item-row:hover {
    border-color: var(--gold);
    background: rgba(214, 180, 106, 0.1);
}

/* =========================================================
   NURSERY TAB STYLES
   ========================================================= */

/* Nursery tab button — violet theme */
.tab-nursery-btn {
    border-color: rgba(168, 85, 247, 0.4) !important;
    color: #c084fc !important;
}

.tab-nursery-btn:hover {
    background: rgba(168, 85, 247, 0.15) !important;
    border-color: rgba(192, 132, 252, 0.6) !important;
    color: #e9d5ff !important;
}

.tab-nursery-btn.active {
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    border-color: #a855f7 !important;
    color: #f3e8ff !important;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.45) !important;
    font-weight: bold;
}

/* Pulse badge when nursery has occupants */
.tab-nursery-btn.has-newborns {
    animation: nursery-pulse 2.5s ease-in-out infinite;
}

@keyframes nursery-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
    50% { box-shadow: 0 0 0 6px rgba(168, 85, 247, 0.25); }
}

/* Nursery banner */
.nursery-banner {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.3), rgba(109, 40, 217, 0.15));
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 16px;
    padding: 1.2rem 1.6rem;
    margin-bottom: 2rem;
    text-align: left;
}

.nursery-banner-icon {
    font-size: 3rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(192, 132, 252, 0.5));
}

.nursery-banner-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e9d5ff;
    margin-bottom: 0.3rem;
    letter-spacing: 0.5px;
}

.nursery-banner-desc {
    color: #c084fc;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Nursery creature card — wider to fit requirements */
.nursery-card {
    background: linear-gradient(135deg, rgba(46, 16, 101, 0.6), rgba(30, 10, 60, 0.8)) !important;
    border-color: rgba(168, 85, 247, 0.4) !important;
    width: 300px !important;
    position: relative;
    overflow: visible;
}

.nursery-card:hover {
    border-color: rgba(192, 132, 252, 0.75) !important;
    box-shadow: 0 12px 40px rgba(168, 85, 247, 0.3) !important;
    transform: translateY(-5px);
}

/* Newborn sparkle badge top ribbon */
.nursery-sparkle-badge {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #7c3aed, #a855f7, #7c3aed);
    color: #f3e8ff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 3px 16px;
    border-radius: 0 0 10px 10px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.45);
    white-space: nowrap;
}

/* Graduation requirements block */
.nursery-reqs {
    margin-top: 0.9rem;
    background: rgba(88, 28, 135, 0.25);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    text-align: left;
}

.nursery-req-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #d8b4fe;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 0.55rem;
    border-bottom: 1px solid rgba(168, 85, 247, 0.25);
    padding-bottom: 0.35rem;
}

.nursery-req-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nursery-req-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #e9d5ff;
    line-height: 1.4;
}

.nursery-req-icon {
    flex-shrink: 0;
    font-size: 0.85rem;
    margin-top: 0.05rem;
}

.nursery-req-item strong {
    color: #f3e8ff;
    font-weight: 700;
}

.nursery-req-note {
    font-size: 0.75rem;
    color: #a78bfa;
    font-style: italic;
    margin-top: 0.4rem;
    border-top: 1px solid rgba(168, 85, 247, 0.2);
    padding-top: 0.4rem;
    line-height: 1.4;
}
