/* ========== СБРОС ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    color: #232f3e;
}

/* ========== КОНТЕЙНЕР ========== */
.container-fluid {
    width: 100%;
    padding: 0 15px;
    margin: 0 auto;
}

/* ========== ШАПКА ========== */
.navbar {
    background-color: #c9daf8;
    padding: 0.8rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.hamburger-menu {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    padding: 0.5rem;
    color: #232f3e;
    font-size: 1rem;
}

.hamburger-icon {
    font-size: 1.2rem;
}

.hamburger-label {
    font-weight: bold;
}

.hamburger-menu:hover,
.catalog-link:hover {
    color: #ff9900;
}

.navbar-brand {
    color: #232f3e;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

.search-form {
    flex: 1;
    display: flex;
    min-width: 0;
}

.search-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid #ddd;
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 1rem;
    outline: none;
    width: 100%;
}

.search-input:focus {
    border-color: #ff9900;
}

.search-button {
    padding: 0.6rem 1.2rem;
    background-color: #ff9900;
    border: 2px solid #ff9900;
    border-radius: 0 8px 8px 0;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
}

.search-button:hover {
    background-color: #e68900;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.nav-link {
    color: #232f3e;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link:hover {
    color: #ff9900;
}

.cart-link {
    position: relative;
}

.cart-count {
    background-color: #ff9900;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    margin-left: 4px;
}

.logout-btn {
    background: none;
    border: none;
    color: #232f3e;
    font-size: 0.9rem;
    cursor: pointer;
}

.logout-btn:hover {
    color: #ff9900;
}

/* ========== ОСНОВНОЙ КОНТЕНТ ========== */
.main-content {
    min-height: calc(100vh - 280px);
    padding: 2rem 0;
}

/* ========== ФУТЕР ========== */
.footer {
    background-color: #c9daf8 !important;
    color: #232f3e !important;
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer .footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.footer .footer-grid {
    display: flex;
    justify-content: center;
    gap: 4rem;
    flex-wrap: wrap;
}

.footer .footer-grid > div {
    min-width: 180px;
    text-align: left;
}

.footer h4 {
    color: #232f3e;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
}

.footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.footer li {
    margin-bottom: 0.6rem;
    text-align: left;
}

.footer a {
    color: #232f3e;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.footer a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.footer .footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(35, 47, 62, 0.2);
    font-size: 0.85rem;
}

.footer .footer-bottom p {
    margin: 0.3rem 0;
}

@media (max-width: 768px) {
    .footer .footer-grid {
        gap: 2rem;
        flex-direction: column;
        align-items: center;
    }
    
    .footer .footer-grid > div {
        width: 100%;
        max-width: 250px;
    }
}

/* Адаптивность футера */
@media (max-width: 768px) {
    .footer .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }
    
    .footer h4 {
        margin-bottom: 0.8rem;
    }
}

/* ========== БОКОВОЕ МЕНЮ КАТЕГОРИЙ ========== */
.categories-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 365px;
    height: 100%;
    background-color: #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.categories-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 0 18px;
    height: 50px;
    background: #232f3e;
    color: #fff;
}

.sidebar-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    display: none;
    white-space: nowrap;
    margin-right: 12px;
}

.sidebar-back:hover {
    opacity: 0.8;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 400;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

.sidebar-close:hover {
    opacity: 0.8;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    min-height: 44px;
    cursor: pointer;
}

.category-item:hover {
    background-color: #f7f7f7;
}

.category-item .category-name {
    flex: 1;
    text-decoration: none;
    color: #111;
    font-size: 14px;
    font-weight: 400;
    display: block;
    padding: 10px 0;
}

.category-item .category-name:hover {
    color: #c45500;
}

.category-arrow {
    color: #999;
    font-size: 32px;
    padding: 12px 0 12px 20px;
    margin: -12px -18px -12px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.category-arrow:hover {
    color: #c45500;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* ========== СООБЩЕНИЯ ========== */
.messages {
    position: fixed;
    top: 70px;
    right: 20px;
    left: auto;
    z-index: 9999;
    width: auto;
    max-width: 400px;
    pointer-events: none;
    margin: 0;
}

.message {
    pointer-events: auto;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
    cursor: pointer;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.message-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

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

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .messages {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

.noscript-warning {
    background-color: #fff3cd;
    color: #856404;
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #ffeaa7;
    font-size: 14px;
}

.noscript-controls {
    margin-top: 10px;
    display: flex;
    gap: 5px;
}

.btn-update,
.btn-remove-fallback {
    padding: 4px 8px;
    font-size: 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.btn-update:hover {
    background: #ff9900;
    color: #fff;
}

.btn-remove-fallback:hover {
    background: #dc3545;
    color: #fff;
}

/* ========== АВТОРИЗАЦИЯ ========== */

.auth-container {
    max-width: 500px;
    margin: 40px auto;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    margin-bottom: 10px;
    font-size: 24px;
    color: #333;
}

.auth-header p {
    color: #666;
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.auth-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: #ff9900;
}

.auth-form .help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.auth-form .error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #ff9900;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #e68900;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.auth-footer p {
    margin: 5px 0;
    font-size: 14px;
}

.auth-footer a {
    color: #0066c0;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Добавьте в ваш основной CSS файл */

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.auth-divider span {
    padding: 0 10px;
    color: #999;
    font-size: 14px;
}

.auth-links {
    text-align: center;
    margin-top: 10px;
}

.auth-links p {
    margin: 8px 0;
}

.auth-links a {
    color: #007bff;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.message-warning {
    background-color: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
}
/* Стили для переключателя способов входа */
.auth-switch {
    text-align: center;
    margin: 20px 0 10px;
    padding: 15px 0 10px;
    border-top: 1px solid #eee;
}

.switch-link {
    margin: 0;
}

.switch-link a {
    display: inline-block;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.switch-link a:hover {
    background-color: #e9ecef;
    border-color: #007bff;
    text-decoration: none;
}

/* Единые стили для всех auth-форм */
.auth-footer {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.auth-footer p {
    margin: 8px 0;
}

.auth-footer a {
    color: #007bff;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.profile-info {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.profile-info p {
    margin: 10px 0;
}

.profile-links {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.profile-link {
    color: #0066c0;
    text-decoration: none;
    font-size: 14px;
}

.profile-link:hover {
    text-decoration: underline;
    color: #c45500;
}

.profile-link-admin {
    color: #6c757d;
}

.profile-link-admin:hover {
    color: #5a6268;
}

.profile-password-change {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.profile-password-change h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
}

.password-form {
    max-width: 400px;
}

/* Стили полей такие же как на странице входа */
.password-form .form-group {
    margin-bottom: 20px;
}

.password-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.password-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.password-form input:focus {
    outline: none;
    border-color: #ff9900;
}

.password-form .error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

.password-form .btn-primary {
    width: 100%;
    padding: 12px;
    background: #ff9900;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.password-form .btn-primary:hover {
    background: #e68900;
}
.password-form {
    max-width: 400px;
}
.password-form {
    max-width: 400px;
}
.generated-password-box {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}
.password-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}
.password-display code {
    background: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 1.1em;
    font-family: monospace;
    border: 1px solid #ddd;
}
.btn-copy {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-copy:hover {
    background: #218838;
}
.password-hint {
    margin-top: 8px;
    color: #666;
}

.info-page {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 12px;
}

.info-page h1 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.info-page h2 {
    font-size: 1.5rem;
    margin: 1.5rem 0 1rem;
}

.info-page h3 {
    font-size: 1.2rem;
    margin: 1rem 0 0.5rem;
}

.info-page p {
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.contacts-info h2,
.contacts-form h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.contacts-info p {
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

.contacts-info a {
    color: #0066c0;
    text-decoration: none;
}

.contacts-info a:hover {
    text-decoration: underline;
}

.contacts-form .form-group {
    margin-bottom: 1rem;
}

.contacts-form .form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.contacts-form .form-group input,
.contacts-form .form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
}

.contacts-form .form-group input:focus,
.contacts-form .form-group textarea:focus {
    outline: none;
    border-color: #ff9900;
}

.contacts-form .btn-submit {
    background-color: #ff9900;
    color: #000;
    border: none;
    padding: 0.8rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
}

.contacts-form .btn-submit:hover {
    background-color: #e68900;
}

.map-placeholder {
    margin-top: 2rem;
    background: #e9ecef;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #6c757d;
}

@media (max-width: 768px) {
    .info-page {
        padding: 1.5rem;
    }
    .info-page h1 {
        font-size: 1.5rem;
    }
    .info-page h2 {
        font-size: 1.3rem;
    }
    .contacts-grid {
        gap: 1.5rem;
    }
}

/* ========== АДАПТИВНАЯ ШАПКА ========== */

/* Базовые стили для всех экранов */
.navbar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* Левая часть (меню + логотип) */
.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Поиск - по умолчанию занимает оставшееся место */
.search-form {
    flex: 1;
    min-width: 0; /* позволяет сжиматься */
}

/* Правая часть (ссылки) */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* ========== ДЛЯ МАЛЕНЬКИХ ЭКРАНОВ (до 768px) ========== */
@media (max-width: 768px) {
    .navbar-top {
        /* Принудительно разбиваем на две строки */
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    /* Левая часть - первая строка, занимает всю ширину */
    .navbar-left {
        flex: 1; /* растягивается */
        order: 1;
    }
    
    /* Правая часть - на той же строке, что и левая */
    .navbar-right {
        order: 2;
        flex-shrink: 0;
    }
    
    /* Поиск - переносим на вторую строку на всю ширину */
    .search-form {
        order: 3;
        flex: 0 0 100%; /* занимает 100% ширины */
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* Скрываем текст "Каталог", оставляем только иконку ☰ */
    .hamburger-label {
        display: none;
    }
    
    .hamburger-icon {
        font-size: 1.4rem;
    }
    
    /* Уменьшаем отступы между ссылками */
    .navbar-right {
        gap: 0.75rem;
    }
    
    /* Скрываем текст у ссылок, оставляем только иконки */
    .nav-link {
        font-size: 0;
    }
    
    /* Но показываем иконки через ::before или content */
    .nav-link::before {
        font-size: 1.2rem;
    }
    
    /* Отдельно для ссылки входа - показываем иконку ключа */
    .nav-link:first-child::before {
        content: "🔑";
    }
    
    /* Для избранного */
    .wishlist-link::before {
        content: "❤️";
    }
    
    /* Для корзины - оставляем цифру отдельно */
    .cart-link::before {
        content: "🛒";
    }
    
    /* Счетчик корзины показываем отдельно */
    .cart-count {
        font-size: 0.75rem;
        margin-left: 2px;
    }
    
    /* Кнопка выхода */
    .logout-btn {
        font-size: 0;
    }
    
    .logout-btn::before {
        content: "🚪";
        font-size: 1.2rem;
    }
    
    /* Убираем лишние отступы у формы выхода */
    .logout-form {
        display: inline-block;
        margin: 0;
        padding: 0;
    }
}