/* ═══════════════════════════════════════════════════════════════════════════
   POLISHED MODERN DASHBOARD ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

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

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

/* ── Market Selector Cards with Staggered Animation ─────────────────────── */
#market-selector .card {
    animation: fadeInUp 0.6s ease-out both;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#zimbabwean-capital-markets .card { animation-delay: 0.1s; }
#zimbabwean-macroeconomics .card { animation-delay: 0.2s; }
#global-capital-markets .card { animation-delay: 0.3s; }
#global-macroeconomics .card { animation-delay: 0.4s; }
#zimbabwean-commodities .card { animation-delay: 0.5s; }
#global-commodities .card { animation-delay: 0.6s; }
#zimbabwean-money-markets .card { animation-delay: 0.7s; }
#global-money-markets .card { animation-delay: 0.8s; }

/* ── Sector Cards with Staggered Animation ──────────────────────────────── */
#agriculture .card { animation: fadeInUp 0.6s ease-out both; animation-delay: 0.9s; }
#finance .card { animation: fadeInUp 0.6s ease-out both; animation-delay: 1.0s; }
#infrastructure .card { animation: fadeInUp 0.6s ease-out both; animation-delay: 1.1s; }
#insurance .card { animation: fadeInUp 0.6s ease-out both; animation-delay: 1.2s; }
#manufacturing .card { animation: fadeInUp 0.6s ease-out both; animation-delay: 1.3s; }
#mining .card { animation: fadeInUp 0.6s ease-out both; animation-delay: 1.4s; }
#tourism .card { animation: fadeInUp 0.6s ease-out both; animation-delay: 1.5s; }

/* ── Enhanced Card Hover Effects ─────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(40, 127, 113, 0.08);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    background: #ffffff;
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #287F71, transparent);
    transition: left 0.6s ease;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(40, 127, 113, 0.18);
}

/* ── Market Selector Cards - Icon Animation ──────────────────────────────── */
#market-selector .widget-size {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#market-selector .card:hover .widget-size {
    transform: scale(1.2) rotate(-5deg);
}

/* ── Sector Cards - Chart Animation ──────────────────────────────────────── */
.col-seven .card:hover .apex-charts {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

/* ── News Feed Animation ─────────────────────────────────────────────────── */
.list-group-item {
    animation: slideInLeft 0.5s ease-out both;
    transition: all 0.3s ease;
}

.list-group-item:nth-child(1) { animation-delay: 0.1s; }
.list-group-item:nth-child(2) { animation-delay: 0.2s; }
.list-group-item:nth-child(3) { animation-delay: 0.3s; }
.list-group-item:nth-child(4) { animation-delay: 0.4s; }
.list-group-item:nth-child(5) { animation-delay: 0.5s; }

.list-group-item:hover {
    background: rgba(40, 127, 113, 0.04);
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(40, 127, 113, 0.1);
}

/* ── Top Gainers/Losers Animation ────────────────────────────────────────── */
.list-group-item .avatar {
    transition: transform 0.3s ease;
}

.list-group-item:hover .avatar {
    transform: scale(1.15) rotate(5deg);
}

/* ── Commentary Table Animation ──────────────────────────────────────────── */
#commentary .table tbody tr {
    animation: fadeInUp 0.5s ease-out both;
    transition: all 0.2s ease;
}

#commentary .table tbody tr:nth-child(1) { animation-delay: 0.1s; }
#commentary .table tbody tr:nth-child(2) { animation-delay: 0.2s; }
#commentary .table tbody tr:nth-child(3) { animation-delay: 0.3s; }
#commentary .table tbody tr:nth-child(4) { animation-delay: 0.4s; }
#commentary .table tbody tr:nth-child(5) { animation-delay: 0.5s; }

#commentary .table tbody tr:hover {
    background: rgba(40, 127, 113, 0.04);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(40, 127, 113, 0.1);
}

/* ── Table Header Gradient ───────────────────────────────────────────────── */
.table thead th {
    background: linear-gradient(135deg, #287F71 0%, #52de7a 100%);
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border: none;
    padding: 1rem;
}

/* ── Card Headers ────────────────────────────────────────────────────────── */
.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #287F71;
    padding: 1.25rem 1.5rem;
    border-radius: 16px 16px 0 0;
    animation: slideInLeft 0.6s ease-out;
}

.card-header h4,
.card-header h5 {
    font-weight: 700;
    color: #287F71;
    margin: 0;
}

/* ── Button Animations ───────────────────────────────────────────────────── */
.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 127, 113, 0.3);
}

/* ── Badge Pulse Animation ───────────────────────────────────────────────── */
.badge {
    animation: pulse 2s ease-in-out infinite;
}

/* ── Avatar/Image Hover Effects ──────────────────────────────────────────── */
.avatar, 
.rounded-circle {
    transition: all 0.3s ease;
}

.list-group-item:hover .avatar,
.list-group-item:hover .rounded-circle {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 12px rgba(40, 127, 113, 0.3);
}

/* ── Scrollbar Styling ───────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #287F71 0%, #52de7a 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #1f6659 0%, #3dc75f 100%);
}

/* ── Page Title Animation ────────────────────────────────────────────────── */
.py-3 h4 {
    animation: slideInLeft 0.6s ease-out;
    position: relative;
    display: inline-block;
}

.py-3 h4::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #287F71, #52de7a);
    border-radius: 3px;
}

/* ── Widget Numbers Animation ────────────────────────────────────────────── */
.widget-first h3,
.widget-first p.text-success,
.widget-first p.text-danger {
    animation: fadeInUp 0.5s ease-out both;
}

/* ── Floating Animation for Icons ────────────────────────────────────────── */
.widget-size svg {
    animation: float 3s ease-in-out infinite;
}

#zimbabwean-capital-markets .widget-size svg { animation-delay: 0s; }
#zimbabwean-macroeconomics .widget-size svg { animation-delay: 0.2s; }
#global-capital-markets .widget-size svg { animation-delay: 0.4s; }
#global-macroeconomics .widget-size svg { animation-delay: 0.6s; }
#zimbabwean-commodities .widget-size svg { animation-delay: 0.8s; }
#global-commodities .widget-size svg { animation-delay: 1s; }
#zimbabwean-money-markets .widget-size svg { animation-delay: 1.2s; }
#global-money-markets .widget-size svg { animation-delay: 1.4s; }

/* ── Modal Animations ────────────────────────────────────────────────────── */
.modal.show .modal-dialog {
    animation: fadeInUp 0.4s ease-out;
}

.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

/* ── AI Chat Widget Pulse ────────────────────────────────────────────────── */
.chat-toggle-btn {
    animation: pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(40, 127, 113, 0.4);
}

/* ── Status Dot Animation ────────────────────────────────────────────────── */
.status-dot {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ── Responsive Adjustments ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    #market-selector .card:hover .widget-size {
        transform: scale(1.1) rotate(-3deg);
    }
}

/* ── Loading State (Optional) ────────────────────────────────────────────── */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ── Smooth Page Load ────────────────────────────────────────────────────── */
body {
    animation: fadeInUp 0.5s ease-out;
}

/* ── Link Hover Effects ──────────────────────────────────────────────────── */
a {
    transition: all 0.3s ease;
}

a:hover {
    text-decoration: none;
    color: #287F71;
}

/* ── Form Input Focus Animation ──────────────────────────────────────────── */
.form-control:focus {
    border-color: #287F71;
    box-shadow: 0 0 0 0.2rem rgba(40, 127, 113, 0.25);
    transform: scale(1.01);
    transition: all 0.3s ease;
}

/* ── Dropdown Menu Animation ─────────────────────────────────────────────── */
.dropdown-menu.show {
    animation: fadeInUp 0.3s ease-out;
}

/* ── Chart Container Animation ───────────────────────────────────────────── */
.apex-charts {
    transition: all 0.3s ease;
}

/* ── Border Dashed Hover ─────────────────────────────────────────────────── */
.border-dashed {
    transition: all 0.3s ease;
}

.list-group-item:hover .border-dashed {
    border-color: #287F71 !important;
    background: rgba(40, 127, 113, 0.05);
}
