/* ========== تنظیمات پایه ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #006A4E;
    --primary-dark: #004D37;
    --primary-light: #8FDDC5;
    --primary-lighter: #E8F5F0;
    --secondary: #FF9800;
    --text-primary: #1A1A2E;
    --text-secondary: #4A4A6A;
    --text-muted: #8888AA;
    --bg-body: #F5F7FA;
    --bg-card: #FFFFFF;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== هدر ========== */
.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 30px 0 25px;
    box-shadow: 0 4px 20px rgba(0, 106, 78, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1px;
}

.logo i {
    font-size: 2.8rem;
    color: var(--primary-light);
}

.subtitle {
    font-size: 1rem;
    opacity: 0.85;
    font-weight: 300;
    margin-top: 4px;
}

/* ========== بخش فیلتر ========== */
.filter-section {
    background: white;
    padding: 16px 0;
    border-bottom: 1px solid #E8ECF0;
    position: sticky;
    top: 89px;
    z-index: 99;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.filter-wrapper {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    border: 2px solid #E8ECF0;
    border-radius: 50px;
    background: white;
    color: var(--text-secondary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn i {
    font-size: 1.1rem;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 106, 78, 0.3);
}

.filter-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 106, 78, 0.4);
}

.result-count {
    text-align: center;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.result-count span {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

/* ========== شبکه کارت‌ها ========== */
.breeds-section {
    flex: 1;
    padding: 30px 0 40px;
}

.breeds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* ========== کارت نژاد ========== */
.breed-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid #F0F2F5;
    position: relative;
    overflow: hidden;
}

.breed-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.breed-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* برچسب نوع */
.breed-type-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.type-sheep {
    background: #E8F5E9;
    color: #2E7D32;
}

.type-goat {
    background: #FFF3E0;
    color: #E65100;
}

.breed-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}

.breed-card-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.breed-origin {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.breed-origin i {
    font-size: 0.9rem;
}

.breed-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 12px;
}

.breed-tag {
    padding: 2px 12px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--primary-lighter);
    color: var(--primary);
    border: 1px solid #D4E8E0;
}

.breed-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid #F0F2F5;
    margin-top: 6px;
}

.breed-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.breed-stat i {
    color: var(--primary);
    width: 18px;
    font-size: 0.9rem;
}

.breed-stat strong {
    color: var(--text-primary);
}

/* نشان شاخص */
.breed-key-feature {
    background: linear-gradient(135deg, #FFF8E1, #FFF3CD);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: #7A5A00;
    margin-top: 8px;
    border: 1px solid #FFE69A;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breed-key-feature i {
    color: #FFB300;
}

/* ========== مودال ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px 35px;
    position: relative;
    animation: slideUp 0.35s ease;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: sticky;
    top: 0;
    float: left;
    background: #F5F5F5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    z-index: 5;
}

.modal-close:hover {
    background: #FFEBEE;
    color: #D32F2F;
    transform: rotate(90deg);
}

.modal-type-badge {
    display: inline-block;
    padding: 4px 18px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.modal-origin {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-divider {
    border: none;
    border-top: 2px dashed #E8ECF0;
    margin: 16px 0;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 24px;
}

.modal-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #F5F6F8;
    font-size: 0.92rem;
}

.modal-item .label {
    color: var(--text-muted);
    font-weight: 400;
}

.modal-item .value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
}

.modal-feature-box {
    background: var(--primary-lighter);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
    border-right: 4px solid var(--primary);
}

.modal-feature-box .label {
    font-weight: 700;
    color: var(--primary-dark);
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.modal-feature-box .value {
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* ========== فوتر ========== */
.footer {
    background: var(--text-primary);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 24px 0;
    font-size: 0.9rem;
    margin-top: auto;
}

.footer-emoji {
    font-size: 1.2rem;
    margin-top: 4px;
    letter-spacing: 4px;
}

/* ========== ریسپانسیو ========== */
@media (max-width: 768px) {
    .header {
        padding: 20px 0 16px;
    }
    
    .logo {
        font-size: 1.7rem;
    }
    
    .logo i {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .filter-section {
        top: 73px;
        padding: 12px 0;
    }
    
    .filter-wrapper {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 7px 16px;
        font-size: 0.8rem;
    }
    
    .breeds-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .modal-title {
        font-size: 1.4rem;
    }
    
    .modal-grid {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    
    .breed-card-header h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .breed-stats {
        gap: 10px;
    }
    
    .breed-stat {
        font-size: 0.7rem;
    }
    
    .modal-content {
        padding: 16px;
    }
}

/* اسکرول‌بار مودال */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #F0F2F5;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #CCC;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #AAA;
}

/* ========== انیمیشن کارت‌ها ========== */
.breed-card {
    animation: cardAppear 0.4s ease forwards;
    opacity: 0;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breed-card:nth-child(1) { animation-delay: 0.02s; }
.breed-card:nth-child(2) { animation-delay: 0.05s; }
.breed-card:nth-child(3) { animation-delay: 0.08s; }
.breed-card:nth-child(4) { animation-delay: 0.11s; }
.breed-card:nth-child(5) { animation-delay: 0.14s; }
.breed-card:nth-child(6) { animation-delay: 0.17s; }
.breed-card:nth-child(7) { animation-delay: 0.20s; }
.breed-card:nth-child(8) { animation-delay: 0.23s; }
.breed-card:nth-child(9) { animation-delay: 0.26s; }
.breed-card:nth-child(10) { animation-delay: 0.29s; }