.alphabet {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
    position: relative;
}
.alphabet-brands{
    padding: 0px 20px;
}
.alp-br {
    font-weight: bold;
    margin-right: 10px;
}

.brand-title {
    text-align: center;
    width: 100%;
    font-weight: bold;
    margin-bottom: 10px;
}

.brand-letter, .all-brands-link {
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    color: #580405;
    margin: 0 5px;
}

.all-brands-link {
    margin-left: auto;
}

.brand-modal {
    position: absolute;
    top: 180px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
}

.brand-modal-content {
    max-width: 100%;
    margin: 0 auto;
}

.brand-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 20px 0;
}

.brand-list a {
    text-decoration: none;
    font-weight: normal;
}

.brand-list a.highlighted {
    font-weight: bold;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}

@media (max-width: 768px) {
    .alphabet {
        display: grid;
        grid-template-columns: repeat(13, 1fr);
        text-align: center;
    }

    .alp-br {
        grid-column: span 13;
        text-align: center;
        margin-bottom: 10px;
    }

    .brand-letter {
        font-size: 14px;
        margin: 5px 0;
    }

    .brand-title {
        font-size: 16px;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .alphabet {
        gap: 3px;
    }

    .brand-list {
        grid-template-columns: 1fr;
    }

    .brand-modal {
        width: 95%;
    }
}

.alphabet-brands-container {
    padding-top: 10px;
    border-top: 1px solid #d65d8626;
    position: relative;
    font-family: inherit;
    width: 100%;
}

.alphabet-brands-header {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border-radius: 6px;
}

.alphabet-row {
    display: flex;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

.alphabet-title {
    font-size: 18px;
    font-weight: 600;
    margin-right: 15px;
    color: #333;
    white-space: nowrap;
}

.alphabet-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
    justify-content: space-between;
}

.brand-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f7f7f7;
    color: #d65d86;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    margin: 3px;
    font-size: 16px;
}

.brand-letter:hover, .brand-letter:focus {
    background-color: #d65d86;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(214, 93, 134, 0.3);
    text-decoration: none;
}

/* Мобильная версия */
.alphabet-brands-mobile {
    margin-bottom: 10px;
    display: none;
}

.mobile-brands-button {
    display: block;
    width: 100%;
    background-color: #d65d86;
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.mobile-brands-button:hover, 
.mobile-brands-button:focus {
    background-color: #b84c71;
}

.mobile-letters-container {
    margin-top: 10px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    overflow: hidden;
}

.mobile-letters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.mobile-brand-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    background-color: #f7f7f7;
    color: #d65d86;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mobile-brand-letter:hover,
.mobile-brand-letter:focus {
    background-color: #d65d86;
    color: white;
}

/* Всплывающее меню */
.brand-popup {
    display: none;
    position: absolute;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 10px auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.brand-popup-content {
    padding: 0;
    width: 100%;
}

.brand-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background-color: #d65d86;
    border-radius: 8px 8px 0 0;
}

.popup-letter {
    margin: 0;
    color: white;
    font-size: 20px;
    font-weight: 600;
}

.popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.popup-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.brand-popup-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.brand-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.brand-item {
    padding: 8px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
    background-color: #f7f7f7;
}

.brand-item a {
    color: #333;
    text-decoration: none;
    display: block;
    font-size: 14px;
}

.brand-item:hover {
    background-color: #d65d86;
}

.brand-item:hover a {
    color: white;
    text-decoration: none;
}

.brand-item.highlighted {
    box-shadow: 0 2px 4px rgba(214, 93, 134, 0.3);
}

.brand-item.highlighted a {
	color: #323232;
    font-weight: 600;
}
.brand-item.highlighted a:hover {
	color: #fff;
}
/* Состояния загрузки и ошибки */
.loading, .error, .no-brands {
    padding: 20px;
    text-align: center;
    color: #666;
}

.error {
    color: #d65d86;
}

/* Адаптивность */
@media (max-width: 768px) {
    .desktop-view {
        display: none;
    }
    
    .mobile-view {
        display: block;
    }
    
    .mobile-letters-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .brand-list-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .brand-popup {
        position: fixed;
        top: 10%;
        left: 5%;
        right: 5%;
        width: 90%;
        max-height: 80vh;
        margin: 0 auto;
    }
    
    .brand-popup-body {
        max-height: 60vh;
    }
	.alphabet-brands-container{
		padding-top:0px;
		border-top:none;
	}
}

@media (max-width: 480px) {
    .mobile-letters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .brand-list-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .brand-popup {
        top: 5%;
        left: 2.5%;
        right: 2.5%;
        width: 95%;
    }
    
    .brand-popup-body {
        padding: 15px 10px;
    }
}
