/**
 * HTN Area Pages Enhancement - Additional Animations & Effects
 * Loaded alongside the main inline styles for progressive enhancement
 */

/* ── Animation Keyframes ──────────────────────────────────────────────────── */
@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.6);
    }
}

@keyframes chipHover {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
    100% {
        transform: translateY(0);
    }
}

/* ── Progressive Enhancement Animations ───────────────────────────────────── */
.htn-area-builder-card {
    animation: cardEntrance 0.6s cubic-bezier(.165,.84,.44,1) forwards;
    opacity: 0;
}

.htn-area-builder-card:nth-child(1) { animation-delay: 0.1s; }
.htn-area-builder-card:nth-child(2) { animation-delay: 0.2s; }
.htn-area-builder-card:nth-child(3) { animation-delay: 0.3s; }
.htn-area-builder-card:nth-child(4) { animation-delay: 0.4s; }
.htn-area-builder-card:nth-child(5) { animation-delay: 0.5s; }
.htn-area-builder-card:nth-child(6) { animation-delay: 0.6s; }

/* ── Enhanced Hover States ────────────────────────────────────────────────── */
.htn-area-builder-card:hover .htn-area-builder-chip {
    animation: chipHover 0.4s ease-in-out;
}

.htn-area-builder-card:hover .htn-area-builder-chip:nth-child(1) { animation-delay: 0.05s; }
.htn-area-builder-card:hover .htn-area-builder-chip:nth-child(2) { animation-delay: 0.1s; }
.htn-area-builder-card:hover .htn-area-builder-chip:nth-child(3) { animation-delay: 0.15s; }
.htn-area-builder-card:hover .htn-area-builder-chip:nth-child(4) { animation-delay: 0.2s; }

/* ── Footer Status Badge Pulse Effect ─────────────────────────────────────── */
.status-badge.pulse-animation {
    animation: pulseGlow 1.5s ease-in-out infinite;
}

/* ── Focus States for Accessibility ───────────────────────────────────────── */
.htn-area-builder-card-link:focus {
    outline: 2px solid #163496;
    outline-offset: 2px;
    border-radius: 20px;
}

.htn-area-builder-card-link:focus .htn-area-builder-card {
    border-color: #163496;
    box-shadow: 0 0 0 3px rgba(22, 52, 150, 0.1);
}

/* ── Loading States ────────────────────────────────────────────────────────── */
.htn-area-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #64748b;
}

.htn-area-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #163496;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* ── Error States ──────────────────────────────────────────────────────────── */
.htn-area-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #dc2626;
    margin: 20px 0;
}

/* ── Reduced Motion Preferences ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .htn-area-builder-card {
        animation: none;
        opacity: 1;
    }
    
    .htn-area-builder-card:hover {
        transform: none;
    }
    
    .htn-area-builder-card:hover .htn-area-builder-img {
        transform: none;
    }
    
    .htn-area-builder-chip {
        animation: none;
    }
    
    .status-badge.pulse-animation {
        animation: none;
    }
}

/* ── Print Styles ──────────────────────────────────────────────────────────── */
@media print {
    .htn-area-builder-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .htn-area-builder-card-btn {
        display: none;
    }
    
    .htn-area-builder-filters {
        display: none;
    }
}