/* ============================================================================
   AQUARIUM TAB - Digital Fish Tank
   ============================================================================ */

/* Override tab-content.active flex display so absolute children work */
#aquarium-tab.active {
    display: block !important;
}

#aquarium-tab {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 0;
    background: transparent;
}

/* ============================================================================
   WATER BACKGROUND
   ============================================================================ */

.aquarium-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        #011a33 0%,
        #012d55 20%,
        #014477 45%,
        #015799 65%,
        #014a80 85%,
        #012244 100%
    );
    overflow: hidden;
    z-index: 0;
}

/* Animated shimmer layer */
.aquarium-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 200px 80px at 25% 8%, rgba(0,160,255,0.07) 0%, transparent 70%),
        radial-gradient(ellipse 140px 60px at 65% 12%, rgba(0,200,255,0.05) 0%, transparent 70%),
        radial-gradient(ellipse 100px 50px at 88% 6%, rgba(50,180,255,0.06) 0%, transparent 70%);
    animation: shimmerShift 7s ease-in-out infinite alternate;
}

/* Bottom depth darkness */
.aquarium-bg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(0deg, rgba(0,0,0,0.5) 0%, transparent 100%);
    pointer-events: none;
}

@keyframes shimmerShift {
    from { opacity: 0.6; transform: scale(1); }
    to   { opacity: 1.0; transform: scale(1.04); }
}

/* ============================================================================
   LIGHT RAYS
   ============================================================================ */

.aquarium-rays {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 65%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.ray {
    position: absolute;
    top: 0;
    background: linear-gradient(180deg, rgba(100,210,255,0.10) 0%, transparent 100%);
    transform-origin: top center;
    animation: rayPulse ease-in-out infinite;
}

.ray:nth-child(1) { left: 6%;  width: 30px; animation-duration: 4s;   animation-delay: 0s;   transform: rotate(-6deg); }
.ray:nth-child(2) { left: 20%; width: 55px; animation-duration: 5s;   animation-delay: 1.2s; transform: rotate(3deg); height: 100%; }
.ray:nth-child(3) { left: 38%; width: 35px; animation-duration: 3.8s; animation-delay: 0.6s; transform: rotate(-2deg); }
.ray:nth-child(4) { left: 57%; width: 48px; animation-duration: 4.5s; animation-delay: 2s;   transform: rotate(4deg); height: 100%; }
.ray:nth-child(5) { left: 74%; width: 28px; animation-duration: 3.5s; animation-delay: 0.9s; transform: rotate(-3deg); }
.ray:nth-child(6) { left: 90%; width: 40px; animation-duration: 4.8s; animation-delay: 1.8s; transform: rotate(2deg); height: 100%; }

.ray { height: 100%; }

@keyframes rayPulse {
    0%, 100% { opacity: 0.25; }
    50%       { opacity: 0.65; }
}

/* ============================================================================
   BUBBLES
   ============================================================================ */

.aquarium-bubbles {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.bubble {
    position: absolute;
    bottom: 14%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.1) 45%, transparent 65%);
    border: 1px solid rgba(255,255,255,0.2);
    animation: bubbleRise linear infinite;
}

.bubble:nth-child(1)  { width:5px;  height:5px;  left:4%;  animation-duration:6s;   animation-delay:0s; }
.bubble:nth-child(2)  { width:9px;  height:9px;  left:11%; animation-duration:8s;   animation-delay:1.4s; }
.bubble:nth-child(3)  { width:4px;  height:4px;  left:19%; animation-duration:5.5s; animation-delay:2.8s; }
.bubble:nth-child(4)  { width:7px;  height:7px;  left:29%; animation-duration:7s;   animation-delay:0.7s; }
.bubble:nth-child(5)  { width:5px;  height:5px;  left:38%; animation-duration:6.5s; animation-delay:1.9s; }
.bubble:nth-child(6)  { width:11px; height:11px; left:49%; animation-duration:9s;   animation-delay:0.3s; }
.bubble:nth-child(7)  { width:6px;  height:6px;  left:57%; animation-duration:7.5s; animation-delay:3.5s; }
.bubble:nth-child(8)  { width:8px;  height:8px;  left:67%; animation-duration:6s;   animation-delay:1.1s; }
.bubble:nth-child(9)  { width:4px;  height:4px;  left:76%; animation-duration:8.5s; animation-delay:2.3s; }
.bubble:nth-child(10) { width:7px;  height:7px;  left:85%; animation-duration:5s;   animation-delay:0.5s; }
.bubble:nth-child(11) { width:5px;  height:5px;  left:93%; animation-duration:7s;   animation-delay:3s; }
.bubble:nth-child(12) { width:10px; height:10px; left:23%; animation-duration:9.5s; animation-delay:1.7s; }

@keyframes bubbleRise {
    0%   { transform: translateY(0) translateX(0px);  opacity: 0; }
    8%   { opacity: 0.8; }
    85%  { opacity: 0.4; }
    100% { transform: translateY(-90vh) translateX(18px); opacity: 0; }
}

/* ============================================================================
   SEAWEED
   ============================================================================ */

.aquarium-flora {
    position: absolute;
    bottom: 9%;
    left: 0;
    right: 0;
    height: 110px;
    z-index: 3;
    pointer-events: none;
}

.seaweed {
    position: absolute;
    bottom: 0;
    width: 10px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    transform-origin: bottom center;
    animation: swayWeed ease-in-out infinite;
}

.seaweed-node {
    width: 10px;
    height: 16px;
    border-radius: 50% 50% 20% 20%;
    margin-bottom: -3px;
}

.seaweed:nth-child(odd)  .seaweed-node { background: linear-gradient(160deg, #1f8f45 0%, #0e5c28 100%); }
.seaweed:nth-child(even) .seaweed-node { background: linear-gradient(160deg, #22a050 0%, #106030 100%); }

.seaweed:nth-child(1)  { left:2%;  animation-duration:3.1s; animation-delay:0s; }
.seaweed:nth-child(2)  { left:6%;  animation-duration:3.6s; animation-delay:0.4s; }
.seaweed:nth-child(3)  { left:10%; animation-duration:2.9s; animation-delay:0.9s; }
.seaweed:nth-child(4)  { left:21%; animation-duration:3.3s; animation-delay:0.2s; }
.seaweed:nth-child(5)  { left:25%; animation-duration:3.8s; animation-delay:0.7s; }
.seaweed:nth-child(6)  { left:44%; animation-duration:2.8s; animation-delay:0.5s; }
.seaweed:nth-child(7)  { left:48%; animation-duration:3.4s; animation-delay:1.1s; }
.seaweed:nth-child(8)  { left:63%; animation-duration:3.0s; animation-delay:0.6s; }
.seaweed:nth-child(9)  { left:67%; animation-duration:2.7s; animation-delay:0.8s; }
.seaweed:nth-child(10) { left:79%; animation-duration:3.7s; animation-delay:0.3s; }
.seaweed:nth-child(11) { left:83%; animation-duration:3.2s; animation-delay:1.0s; }
.seaweed:nth-child(12) { left:91%; animation-duration:2.9s; animation-delay:0.6s; }

@keyframes swayWeed {
    0%   { transform: rotate(-9deg); }
    50%  { transform: rotate(9deg); }
    100% { transform: rotate(-9deg); }
}

/* ============================================================================
   FLOOR / SAND
   ============================================================================ */

.aquarium-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10%;
    z-index: 4;
    pointer-events: none;
}

.sand-layer {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #c8a96a 0%, #b09050 40%, #906830 100%);
    border-radius: 55% 55% 0 0 / 40% 40% 0 0;
}

.sand-layer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg,
        rgba(210,180,120,0.3) 0%, rgba(230,200,140,0.8) 12%,
        rgba(210,180,120,0.3) 25%, rgba(230,200,140,0.8) 45%,
        rgba(210,180,120,0.3) 62%, rgba(230,200,140,0.8) 78%,
        rgba(210,180,120,0.3) 100%
    );
    border-radius: 50%;
}

.rock {
    position: absolute;
    border-radius: 50% 50% 40% 40%;
    background: linear-gradient(140deg, #6e7f8e 0%, #3c4d5e 100%);
    box-shadow: inset -3px -3px 6px rgba(0,0,0,0.45);
}
.rock:nth-child(2) { width:30px; height:18px; left:14%;  bottom:38%; }
.rock:nth-child(3) { width:18px; height:12px; left:17%;  bottom:56%; }
.rock:nth-child(4) { width:38px; height:22px; right:16%; bottom:36%; }
.rock:nth-child(5) { width:22px; height:14px; right:13%; bottom:57%; }
.rock:nth-child(6) { width:24px; height:15px; left:47%;  bottom:42%; }

/* ============================================================================
   FISH SWIM TANK
   ============================================================================ */

.aquarium-tank {
    position: absolute;
    top: 36px;   /* below info bar */
    left: 0;
    right: 0;
    bottom: 10%; /* above floor */
    z-index: 5;
    overflow: hidden;
}

/* ============================================================================
   SWIMMING FISH
   ============================================================================ */

/* Position wrapper — JS sets left/top in px */
.aqua-fish {
    position: absolute;
    cursor: pointer;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* GPU hint for smooth animation */
    will-change: left, top;
}

/* Body wrapper — JS sets scaleX(1/-1) to flip direction */
.aqua-fish-body {
    display: block;
    line-height: 0;
    /* will-change helps GPU composite the flip */
    will-change: transform;
}

/* The image — JS sets rotate() for the "meliuk-liuk" wiggle */
.aqua-fish-img {
    display: block;
    object-fit: contain;
    image-rendering: auto;
    /* pivot at nose (left-center of unflipped image) for tail-wagging */
    transform-origin: 30% center;
    will-change: transform;
}

/* Rarity glow — applied via filter on the image */
.aqua-fish[data-rarity="celestial"]    .aqua-fish-img { filter: drop-shadow(0 0 7px #ffd700) drop-shadow(0 0 14px rgba(255,215,0,0.4)); }
.aqua-fish[data-rarity="secret_shiny"] .aqua-fish-img { filter: drop-shadow(0 0 6px #ff66ff) drop-shadow(0 0 12px rgba(255,100,255,0.4)); }
.aqua-fish[data-rarity="secret"]       .aqua-fish-img { filter: drop-shadow(0 0 6px #66bbff) drop-shadow(0 0 12px rgba(80,160,255,0.4)); }
.aqua-fish[data-rarity="myth"]         .aqua-fish-img { filter: drop-shadow(0 0 5px #ff3296) drop-shadow(0 0 10px rgba(255,50,150,0.3)); }
.aqua-fish[data-rarity="artefak"]      .aqua-fish-img { filter: drop-shadow(0 0 5px #ffa500) drop-shadow(0 0 10px rgba(255,165,0,0.3)); }
.aqua-fish[data-rarity="epic"]         .aqua-fish-img { filter: drop-shadow(0 0 4px #b464ff) drop-shadow(0 0 8px rgba(180,100,255,0.25)); }
.aqua-fish[data-rarity="normal"]       .aqua-fish-img { filter: drop-shadow(0 0 3px rgba(120,180,255,0.4)); }

/* Hover: brighten (override rarity glow) */
.aqua-fish:hover .aqua-fish-img {
    filter: brightness(1.4) drop-shadow(0 0 10px rgba(255,220,100,0.95)) !important;
}

/* Fish name label on hover */
.aqua-fish-label {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,15,35,0.88);
    border: 1px solid rgba(0,180,255,0.45);
    border-radius: 5px;
    padding: 3px 7px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 30;
}

.aqua-fish:hover .aqua-fish-label {
    opacity: 1;
}

.label-name {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #00d9ff;
    line-height: 1.5;
}

.label-rarity {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 5px;
    line-height: 1.5;
    text-transform: capitalize;
}

.label-rarity.rarity-celestial  { color: #ffd700; }
.label-rarity.rarity-secret_shiny{ color: #ff80ff; }
.label-rarity.rarity-secret     { color: #80ccff; }
.label-rarity.rarity-myth       { color: #ff3296; }
.label-rarity.rarity-artefak    { color: #ffa500; }
.label-rarity.rarity-epic       { color: #b464ff; }
.label-rarity.rarity-normal     { color: #8ab4f8; }

/* ============================================================================
   INFO BAR (top overlay)
   ============================================================================ */

.aquarium-infobar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: rgba(0,8,22,0.72);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(0,180,255,0.18);
    z-index: 15;
    pointer-events: none;
}

.aquarium-infobar-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #00d9ff;
    text-shadow: 0 0 8px rgba(0,217,255,0.5);
    letter-spacing: 1px;
}

.aquarium-infobar-count {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #7ec8e8;
}

/* ============================================================================
   EMPTY / LOADING STATE
   ============================================================================ */

.aquarium-overlay-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 20;
    pointer-events: none;
}

.aquarium-overlay-state .state-emoji {
    font-size: 3rem;
    animation: floatIcon 3s ease-in-out infinite;
}

.aquarium-overlay-state .state-msg {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #aad4f0;
    text-align: center;
    line-height: 2;
    max-width: 80%;
}

.aquarium-overlay-state .state-hint {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: rgba(150,200,230,0.5);
    text-align: center;
    line-height: 2;
    max-width: 75%;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-10px); }
}
