/* --- Global & Reset Styles for a cleaner look --- */
body {
    font-family: 'Vazirmatn', 'IranSans', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* --- Alphabet Filter Styles --- */
.alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 50px;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    direction: rtl;
}

.alphabet-letter {
    cursor: pointer;
    padding: 10px 20px;
    background-color: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-weight: 600;
    color: #666;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
    font-size: 1.05em;
    min-width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alphabet-letter:hover {
    background-color: #25A59512;
    color: #25A595;
    border-color: #25A595;
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.4);
    transform: translateY(-3px);
}

.alphabet-letter.active {
    background-color: #25A595;
    color: white;
    border-color: #25A595;
    box-shadow: 0 6px 20px rgba(0, 86, 179, 0.5);
    transform: translateY(-1px);
    pointer-events: none;
}

/* --- Brand Cards Grid Styles --- */
.brand-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 50px;
    margin-bottom: 50px;
    padding: 20px;
    direction: rtl;
}

.brand-card {
    background-color: #ffffff;
    border-radius: 18px;
    text-align: center;
    padding: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    overflow: hidden;
    position: relative;
}

.brand-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
    z-index: 1;
}

.brand-card img {
    max-width: 90%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 20px;
    filter: grayscale(0.7);
    opacity: 0.9;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.brand-card:hover img {
    filter: grayscale(0);
    opacity: 1;
    transform: scale(1.05);
}

.brand-card h4 {
    font-size: 1.1em;
    color: #444;
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
}

/* --- Pagination Styles --- */
.brand-pagination {
    text-align: center;
    margin-top: 50px;
    margin-bottom: 80px;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
    
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    direction: rtl;
}

.brand-pagination .brand-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    padding: 0 12px;
    background-color: #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: #666;
    font-weight: 600;
    font-size: 1.05em;
    border: 1px solid #e5e5e5;
    text-decoration: none;
}

.brand-pagination .brand-page:hover {
    background-color: #25A59512;
    color: #25A595;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    border-color: #25A595;
    transform: translateY(-2px);
}

.brand-pagination .brand-page.active {
    background-color: #25A595;
    color: #fff;
    box-shadow: 0 4px 18px rgba(0, 86, 179, 0.4);
    border-color: #25A595;
    transform: translateY(-1px);
    pointer-events: none;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .alphabet-filter {
        padding: 15px;
        gap: 8px;
        margin-bottom: 30px;
    }
    .alphabet-letter {
        padding: 8px 15px;
        font-size: 1em;
        min-width: 40px;
    }
    .brand-cards {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
        padding: 15px;
        margin-top: 30px;
        margin-bottom: 30px;
    }
    .brand-card {
        padding: 20px;
        min-height: 200px;
    }
    .brand-card img {
        height: 100px;
        margin-bottom: 15px;
    }
    .brand-card h4 {
        font-size: 1em;
    }
    .brand-pagination {
        padding: 10px;
        gap: 6px;
        margin-top: 30px;
        margin-bottom: 50px;
    }
    .brand-pagination .brand-page {
        min-width: 40px;
        height: 40px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .alphabet-filter {
        display: flex;
        flex-wrap: wrap;
        gap: 4px; 
        padding: 5px;
        justify-content: center;
    }
    .alphabet-letter {
        padding: 4px 8px;
        font-size: 0.75em;
        min-width: auto; 
        border-radius: 14px;
        flex: 0 0 auto;
    }
    .brand-cards {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        padding: 10px;
        margin-top: 20px;
        margin-bottom: 20px;
    }
    .brand-card {
        padding: 15px;
        min-height: 160px;
        border-radius: 12px;
    }
    .brand-card img {
        height: 80px;
        margin-bottom: 10px;
    }
    .brand-card h4 {
        white-space: normal !important;
        overflow: visible;
        text-overflow: unset;
        display: block;
        font-size: 0.85em;
        line-height: 1.4;
    }
    .brand-pagination {
        padding: 8px;
        gap: 4px;
        margin-top: 20px;
        margin-bottom: 30px;
        border-radius: 10px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding-left: 10px;
        padding-right: 10px;
    }
    .brand-pagination .brand-page {
        min-width: 30px;
        height: 30px;
        font-size: 0.8em;
        border-radius: 6px;
        flex-shrink: 0;
    }
}