/* ============================================================
   بخش هوش مصنوعی (AI) — کارت افقی
   ============================================================ */

:root {
    --ai-primary: #FF9800;
    --ai-primary-dark: #F57C00;
    --ai-primary-light: #FFB74D;
    --ai-playing: #FF9800;
    --ai-playing-dark: #F57C00;
    --ai-bg-card: rgba(255, 255, 255, 0.06);
    --ai-bg-card-hover: rgba(255, 255, 255, 0.1);
    --ai-border: rgba(255, 255, 255, 0.08);
    --ai-border-hover: rgba(255, 152, 0, 0.4);
    --ai-text-primary: #ffffff;
    --ai-text-secondary: #c8c8e0;
    --ai-text-muted: #8a8aa0;
    --ai-radius: 18px;
    --ai-radius-sm: 12px;
    --ai-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ai-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   بخش کلی
   ============================================ */

.ai-section-modern {
    margin: 30px 0 40px;
    padding: 0 4px;
    position: relative;
}

.ai-glass-wrapper {
    background: rgba(26, 26, 46, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 24px 20px 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
}

/* هدر */
.ai-section-modern .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 4px;
    position: relative;
    z-index: 1;
}

.ai-section-modern .section-title {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: "bakhb", sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.ai-section-modern .section-title i {
    color: var(--ai-primary);
    font-size: 1.3rem;
    filter: drop-shadow(0 0 12px rgba(255, 152, 0, 0.6));
    animation: pulse-icon-orange 2s ease-in-out infinite;
}

@keyframes pulse-icon-orange {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(255, 152, 0, 0.6)); }
    50%      { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(255, 152, 0, 0.9)); }
}

.ai-section-modern .section-more {
    color: var(--ai-text-muted);
    font-size: 0.75rem;
    font-family: "bakhn", sans-serif;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s var(--ai-ease);
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.ai-section-modern .section-more:hover {
    color: var(--ai-primary);
    background: rgba(255, 152, 0, 0.08);
    border-color: rgba(255, 152, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.2);
    transform: translateX(-4px);
}

/* گرید — ۳ کارت */
.ai-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    position: relative;
    z-index: 1;
    padding-bottom: 8px;
}

/* کارت */
.ai-card {
    min-width: 0;
    opacity: 0;
    transform: translateY(20px);
    animation: ai-entrance 0.6s var(--ai-ease) forwards;
}

.ai-card:nth-child(1) { animation-delay: 0.05s; }
.ai-card:nth-child(2) { animation-delay: 0.10s; }
.ai-card:nth-child(3) { animation-delay: 0.15s; }
.ai-card:nth-child(4) { animation-delay: 0.20s; }
.ai-card:nth-child(5) { animation-delay: 0.25s; }
.ai-card:nth-child(6) { animation-delay: 0.30s; }
.ai-card:nth-child(7) { animation-delay: 0.35s; }
.ai-card:nth-child(8) { animation-delay: 0.40s; }
.ai-card:nth-child(9) { animation-delay: 0.45s; }
.ai-card:nth-child(10) { animation-delay: 0.50s; }
.ai-card:nth-child(11) { animation-delay: 0.55s; }
.ai-card:nth-child(12) { animation-delay: 0.60s; }

@keyframes ai-entrance {
    to { opacity: 1; transform: translateY(0); }
}

.ai-card-inner {
    position: relative;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 16px;
    align-items: center;
    padding: 14px;
    background: var(--ai-bg-card);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: all 0.5s var(--ai-ease);
}

.ai-card-inner:hover {
    background: var(--ai-bg-card-hover);
    border-color: var(--ai-border-hover);
    box-shadow: 
        0 16px 48px rgba(255, 152, 0, 0.2),
        0 0 0 1px rgba(255, 152, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-4px);
}

/* کاور */
.ai-cover-wrap {
    position: relative;
    grid-column: 1;
    grid-row: 1;
}

.ai-cover-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ai-cover {
    position: relative;
    width: 130px;
    height: 130px;
    border-radius: var(--ai-radius-sm);
    overflow: hidden;
    background: #1a0f00;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.5s var(--ai-ease);
}

.ai-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s var(--ai-ease);
}

.ai-card-inner:hover .ai-cover img {
    transform: scale(1.08);
}

/* دکمه پلی — وسط سمت راست کاور، نیمه بیرون */
.ai-play {
    position: absolute;
    top: 50%;
    right: -25px;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 8px 24px rgba(255, 152, 0, 0.5),
        0 0 0 0 rgba(255, 152, 0, 0.7);
    transition: all 0.4s var(--ai-ease-bounce);
    z-index: 10;
    animation: ai-play-pulse 2s ease-in-out infinite;
}

@keyframes ai-play-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(255, 152, 0, 0.5), 0 0 0 0 rgba(255, 152, 0, 0.7); }
    50%      { box-shadow: 0 8px 24px rgba(255, 152, 0, 0.5), 0 0 0 10px rgba(255, 152, 0, 0); }
}

.ai-play:hover {
    transform: translateY(-50%) scale(1.15);
    background: linear-gradient(135deg, var(--ai-primary-light), var(--ai-primary));
    box-shadow: 0 12px 40px rgba(255, 152, 0, 0.8);
}

.ai-play i {
    color: #fff;
    font-size: 1.3rem;
    margin-right: 3px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.ai-play:hover i {
    transform: scale(1.1);
}

/* حالت در حال پخش */
.ai-card-inner.is-playing {
    border-color: rgba(255, 152, 0, 0.5);
    box-shadow: 
        0 20px 60px rgba(255, 152, 0, 0.2),
        0 0 0 1px rgba(255, 152, 0, 0.3);
}

.ai-card-inner.is-playing .ai-play {
    background: linear-gradient(135deg, var(--ai-playing), var(--ai-playing-dark));
    border-color: rgba(255, 152, 0, 0.6);
    box-shadow: 
        0 8px 24px rgba(255, 152, 0, 0.7),
        0 0 0 8px rgba(255, 152, 0, 0.15);
    animation: ai-playing-pulse 1.5s ease-in-out infinite;
}

@keyframes ai-playing-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(255, 152, 0, 0.7), 0 0 0 0 rgba(255, 152, 0, 0.4); }
    50%      { box-shadow: 0 8px 24px rgba(255, 152, 0, 0.7), 0 0 0 12px rgba(255, 152, 0, 0); }
}

/* اطلاعات */
.ai-info-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    padding-left: 12px;
    padding-right: 4px;
}

.ai-artist {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ai-text-secondary);
    font-size: 0.75rem;
    font-family: "bakhn", sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ai-artist i {
    color: var(--ai-primary);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.ai-song-link {
    text-decoration: none;
    color: inherit;
}

.ai-song {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ai-text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: "bakhb", sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.ai-song i {
    color: var(--ai-primary);
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: color 0.3s ease;
}

.ai-card-inner:hover .ai-song {
    color: var(--ai-primary-light);
}

.ai-card-inner:hover .ai-song i {
    color: var(--ai-primary-light);
}

/* موج صوتی — فقط در حال پخش */
.ai-wave {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    margin-top: 2px;
}

.ai-card-inner.is-playing .ai-wave {
    opacity: 1;
    visibility: visible;
}

.ai-wave span {
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--ai-primary-light), var(--ai-primary));
    border-radius: 2px;
    transform-origin: bottom;
    box-shadow: 0 0 6px rgba(255, 152, 0, 0.6);
    animation: ai-wave-bounce 1s ease-in-out infinite;
}

.ai-wave span:nth-child(1) { animation-delay: 0.0s; height: 40%; }
.ai-wave span:nth-child(2) { animation-delay: 0.1s; height: 70%; }
.ai-wave span:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.ai-wave span:nth-child(4) { animation-delay: 0.3s; height: 60%; }
.ai-wave span:nth-child(5) { animation-delay: 0.4s; height: 90%; }
.ai-wave span:nth-child(6) { animation-delay: 0.5s; height: 50%; }
.ai-wave span:nth-child(7) { animation-delay: 0.6s; height: 80%; }
.ai-wave span:nth-child(8) { animation-delay: 0.7s; height: 45%; }
.ai-wave span:nth-child(9) { animation-delay: 0.8s; height: 75%; }

@keyframes ai-wave-bounce {
    0%, 100% { transform: scaleY(0.3); }
    50%      { transform: scaleY(1); }
}

/* آمار — افقی */
.ai-stats {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 2px;
}

.ai-like,
.ai-views {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--ai-text-muted);
    font-family: "bakhn", sans-serif;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.ai-like:hover,
.ai-views:hover {
    background: rgba(255, 152, 0, 0.1);
    color: var(--ai-primary);
}

.ai-like i,
.ai-views i {
    font-size: 0.9rem;
    line-height: 1;
    transition: all 0.3s ease;
}

.ai-like.liked i {
    color: #ef4444;
}

.ai-like.liked i::before {
    content: "\e90b";
    color: #ef4444;
}

.ai-stat-count {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    font-family: "bakhb", sans-serif;
}

/* موبایل: دکمه پلی همیشه نمایان */
@media (hover: none) {
    .ai-play {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* ریسپانسیو */
@media (max-width: 1200px) {
    .ai-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
    
    .ai-card-inner {
        grid-template-columns: 110px 1fr;
        gap: 14px;
        padding: 12px;
    }
    
    .ai-cover {
        width: 110px;
        height: 110px;
    }
    
    .ai-play {
        width: 44px;
        height: 44px;
        right: -22px;
    }
    
    .ai-play i {
        font-size: 1.15rem;
    }
}

@media (max-width: 1024px) {
    .ai-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    
    .ai-card-inner {
        grid-template-columns: 110px 1fr;
        gap: 14px;
        padding: 12px;
    }
    
    .ai-cover {
        width: 110px;
        height: 110px;
    }
    
    .ai-play {
        width: 44px;
        height: 44px;
        right: -22px;
    }
}

@media (max-width: 768px) {
    .ai-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .ai-card-inner {
        grid-template-columns: 100px 1fr;
        gap: 14px;
        padding: 12px;
    }
    
    .ai-cover {
        width: 100px;
        height: 100px;
    }
    
    .ai-play {
        width: 40px;
        height: 40px;
        right: -20px;
        border-width: 2.5px;
    }
    
    .ai-play i {
        font-size: 1rem;
    }
    
    .ai-song {
        font-size: 0.88rem;
    }
    
    .ai-artist {
        font-size: 0.7rem;
    }
    
    .ai-stat-count {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .ai-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .ai-card-inner {
        grid-template-columns: 85px 1fr;
        gap: 12px;
        padding: 10px;
    }
    
    .ai-cover {
        width: 85px;
        height: 85px;
    }
    
    .ai-play {
        width: 36px;
        height: 36px;
        right: -18px;
        border-width: 2px;
    }
    
    .ai-play i {
        font-size: 0.9rem;
    }
    
    .ai-song {
        font-size: 0.82rem;
    }
    
    .ai-artist {
        font-size: 0.65rem;
    }
    
    .ai-stat-count {
        font-size: 0.6rem;
    }
    
    .ai-like i,
    .ai-views i {
        font-size: 0.8rem;
    }
    
    .ai-wave {
        height: 16px;
    }
    
    .ai-wave span {
        width: 2px;
    }
}