/* ============================================
   Dynamic Styles
   Previously injected via JavaScript in app.js
   ============================================ */

/* ============================================
   Notifications / Toast
   ============================================ */
.notification {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 480px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: blur(20px);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: slideInNotification 0.4s var(--ease-out-expo);
    pointer-events: auto;
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    overflow: hidden;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 18px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.4;
}

.notification-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 14px 14px;
    animation: toast-progress 4s linear forwards;
}

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Success Toast */
.notification-success {
    border-color: rgba(74, 222, 128, 0.3);
    background: linear-gradient(135deg,
        rgba(74, 222, 128, 0.15) 0%,
        var(--bg-card) 100%);
}

.notification-success .notification-icon {
    background: rgba(74, 222, 128, 0.2);
    color: var(--green-main);
}

.notification-success .notification-title {
    color: var(--green-light);
}

.notification-success .notification-progress {
    background: linear-gradient(90deg, var(--green-main), var(--green-light));
}

/* Error Toast */
.notification-error {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg,
        rgba(239, 68, 68, 0.15) 0%,
        var(--bg-card) 100%);
}

.notification-error .notification-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.notification-error .notification-title {
    color: #fca5a5;
}

.notification-error .notification-progress {
    background: linear-gradient(90deg, #ef4444, #fca5a5);
}

/* Warning Toast */
.notification-warning {
    border-color: rgba(255, 217, 61, 0.3);
    background: linear-gradient(135deg,
        rgba(255, 217, 61, 0.15) 0%,
        var(--bg-card) 100%);
}

.notification-warning .notification-icon {
    background: rgba(255, 217, 61, 0.2);
    color: var(--yellow-main);
}

.notification-warning .notification-title {
    color: var(--yellow-light);
}

.notification-warning .notification-progress {
    background: linear-gradient(90deg, var(--yellow-main), var(--yellow-light));
}

/* Info Toast */
.notification-info {
    border-color: rgba(107, 207, 255, 0.3);
    background: linear-gradient(135deg,
        rgba(107, 207, 255, 0.15) 0%,
        var(--bg-card) 100%);
}

.notification-info .notification-icon {
    background: rgba(107, 207, 255, 0.2);
    color: var(--blue-main);
}

.notification-info .notification-title {
    color: var(--blue-light);
}

.notification-info .notification-progress {
    background: linear-gradient(90deg, var(--blue-main), var(--blue-light));
}

/* Toast Hover Pause */
.notification:hover .notification-progress {
    animation-play-state: paused;
}

/* Mobile Toast */
@media (max-width: 768px) {
    .notification {
        left: 16px;
        right: 16px;
        min-width: auto;
        max-width: none;
        top: auto;
        bottom: 24px;
        transform: translateY(120%);
    }

    .notification.show {
        transform: translateY(0);
    }
}

/* ============================================
   Loading Spinner
   ============================================ */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    border-right-color: currentColor;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Breeding Parent Selection
   ============================================ */
.selected-parent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.selected-parent .remove-parent {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
}

/* ============================================
   Blorp Selection Slots
   ============================================ */
.filled-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.selected-blorp {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

.selected-blorp .blorp-name {
    font-family: 'Lilita One', cursive;
    color: #a8ff6b;
}

.selected-blorp .remove-blorp {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inventory-item.selected {
    border-color: #a8ff6b;
    box-shadow: 0 0 20px rgba(168, 255, 107, 0.4);
}

.blorp-option.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ============================================
   Expedition Animations
   ============================================ */
.expedition-card.claiming {
    animation: claimPulse 0.5s ease;
}

@keyframes claimPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); }
    100% { transform: scale(0.95); opacity: 0; }
}

/* ============================================
   Raid Animations
   ============================================ */
.target-card.raided {
    animation: raidedShake 0.3s ease;
}

@keyframes raidedShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ============================================
   Page & Content Animations
   ============================================ */
.main-content {
    animation: pageLoad 0.5s var(--ease-out-expo);
}

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

.tab-content {
    animation: fadeSlideIn 0.4s var(--ease-out-expo);
}

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

/* Badge bounce on update */
.nav-badge.updated {
    animation: badgeBounce 0.5s var(--ease-bounce);
}

@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Success flash animation */
.success-flash {
    animation: successFlash 0.6s ease;
}

@keyframes successFlash {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
    50% { box-shadow: 0 0 30px 10px rgba(74, 222, 128, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* Time pulse animation */
@keyframes timePulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 0 4px rgba(74, 222, 128, 0);
    }
}

/* Notification slide animation */
@keyframes slideInNotification {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Toast stacking: toasts live inside a fixed container and flow as a
   column instead of each being independently fixed (which made every new
   toast overlap/replace the last). */
#notificationStack {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
}

#notificationStack .notification {
    position: static;
    top: auto;
    right: auto;
}

/* Mobile: re-anchor the toast stack to the BOTTOM, full-width with small
   side margins, so it doesn't cover the header wallet/bell controls. Desktop
   (top-right) behavior above is unchanged. */
@media (max-width: 600px) {
    #notificationStack {
        top: auto;
        bottom: 16px;
        left: 12px;
        right: 12px;
        align-items: stretch;
        gap: 8px;
    }

    #notificationStack .notification {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    /* Bigger tap target for the toast close button on touch screens. */
    #notificationStack .notification-close {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
}

.notification-action {
    margin-top: 8px;
    padding: 6px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    color: var(--bg-dark, #051828);
    background: var(--green-main);
    border: 1px solid var(--green-main);
    transition: filter 0.2s ease;
}

.notification-action:hover {
    filter: brightness(1.1);
}
