/* ================================
   Animals Calculator
   Type tabs, options row, level table
   ================================ */

/* ── Animal Type Tabs ── */
.animal-type-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
}
.animal-type-tab {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}
.animal-type-tab:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.animal-type-tab.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
    font-weight: 600;
}
.animal-tab-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* ── Animal Options Row ── */
.animal-options-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin: 8px 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    user-select: none;
}
.animal-option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.animal-option-group:last-child {
    margin-left: auto;
}
.option-group-label {
    font-size: 0.78rem;
    color: var(--muted);
}
.affection-toggle-inner {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}
.affection-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.affection-toggle-track {
    position: relative;
    width: 32px;
    height: 18px;
    background: rgba(214,203,184,0.4);
    border: 1px solid var(--border);
    border-radius: 18px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}
.affection-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: var(--muted);
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}
.animal-options-row:has(.affection-toggle-input:checked) .affection-toggle-track {
    background: rgba(184,134,11,0.2);
    border-color: rgba(184,134,11,0.5);
}
.animal-options-row:has(.affection-toggle-input:checked) .affection-toggle-thumb {
    transform: translateX(14px);
    background: var(--warning);
}
.affection-toggle-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    image-rendering: pixelated;
}
.affection-toggle-text {
    font-size: 0.78rem;
    color: var(--muted);
    transition: color 0.2s;
}
.animal-options-row:has(.affection-toggle-input:checked) .affection-toggle-text {
    color: var(--warning);
}
.affection-count-group {
    display: flex;
    gap: 4px;
}
.affection-count-btn {
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.affection-count-btn:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.affection-count-btn.active {
    background: rgba(184,134,11,0.15);
    border-color: rgba(184,134,11,0.5);
    color: var(--warning);
    font-weight: 600;
}

/* ── Animal Level Section Spacing ── */
#animalLevelSection {
    margin-top: 12px;
}

/* ── Animal Level Table ── */
.animal-level-table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}
.animal-level-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.animal-level-table th,
.animal-level-table td {
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.animal-level-table th {
    background: rgba(214,203,184,0.3);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.animal-level-table tbody tr {
    background: rgba(255,253,248,0.25);
}
.animal-level-table tbody tr:nth-child(even) {
    background: rgba(214,203,184,0.23);
}
.animal-level-table tbody tr:hover {
    background: rgba(214,203,184,0.15);
}
.table-header-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
}
.level-cell {
    color: var(--text);
    font-weight: 600;
    font-size: 0.75rem;
}
.xp-cell {
    color: var(--info);
    font-family: monospace;
    font-size: 0.85rem;
}
.xp-cell .xp-value { font-size: 0.85rem; }
.xp-overflow-indicator {
    font-size: 0.6rem;
    color: var(--warning);
    margin-left: 2px;
}
.affection-xp-cell {
    color: var(--warning);
    font-family: monospace;
}
.affection-xp-cell.inactive {
    color: var(--muted);
    opacity: 0.5;
}
.total-xp-cell {
    color: var(--muted);
    font-family: monospace;
}
.feeds-cell {
    color: var(--text);
    font-family: monospace;
    font-weight: 600;
}
.reward-cell {
    color: var(--green);
    font-family: monospace;
}
.reward-cell.boosted { color: var(--warning); }
.food-cell {
    text-align: center;
}
.food-name {
    color: var(--muted);
    font-size: 0.6rem;
    display: block;
}
.food-qty {
    color: var(--text);
    font-size: 0.7rem;
    font-weight: 500;
}
.food-cell.modified .food-qty { color: var(--green); }
.cost-cell {
    color: var(--negative);
    font-family: monospace;
}
.revenue-cell {
    color: var(--warning);
    font-family: monospace;
}
.profit-cell {
    font-family: monospace;
    font-weight: 600;
}
.profit-cell.positive { color: var(--positive); }
.profit-cell.negative { color: var(--negative); }

/* Summary Row */
.animal-level-table tfoot .summary-row {
    background: rgba(214,203,184,0.3);
    border-top: 2px solid var(--green);
}
.animal-level-table tfoot .summary-row td {
    padding: 8px 4px;
    font-size: 0.75rem;
}
.animal-level-table tfoot .summary-row td.positive { color: var(--positive); }
.animal-level-table tfoot .summary-row td.negative { color: var(--negative); }

/* Table tooltips */
.food-cell .stat-tooltip-wrapper { display: flex; width: 100%; }
.food-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.reward-cell .stat-tooltip-wrapper { display: inline-flex; }
.reward-cell .reward-value { font-family: monospace; }

.animal-level-table .stat-tooltip {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    min-width: 180px;
    z-index: 999999;
}
.animal-level-table .stat-tooltip::after {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}
.animal-level-table td { position: relative; }
.animal-level-table .stat-tooltip-wrapper { position: relative; z-index: 100; }
.animal-level-table .stat-tooltip-wrapper:hover { z-index: 999999; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .animal-level-table { font-size: 0.6rem; }
    .animal-level-table th,
    .animal-level-table td { padding: 4px 2px; }
}
