:root {
    --mint: #98FF98;
    --mint-light: #E8F5E8;
    --mint-dark: #76D7C4;
    --red: #FF6B6B;
    --red-dark: #EE5A52;
    --gray: #2C3E50;
    --gray-light: #ECF0F1;
    --gray-dark: #34495E;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--mint-light) 0%, #ffffff 100%);
    min-height: 100vh;
    color: var(--gray);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Навигация */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--mint);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.nav-logo h2 {
    color: var(--mint-dark);
    font-weight: 600;
}

.nav-search {
    flex: 0 1 400px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--mint);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(152, 255, 152, 0.3);
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--gray);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--red);
}

/* Стили для форм аутентификации */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 2rem 0;
}

.auth-form {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--mint);
    width: 100%;
    max-width: 450px;
    position: relative;
    overflow: hidden;
}

.auth-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--mint), var(--mint-dark));
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--gray-dark);
    font-size: 1.8rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-dark);
}

.form-control {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--mint-light);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--mint);
    background: white;
    box-shadow: 0 0 0 3px rgba(152, 255, 152, 0.2);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--mint);
    color: var(--gray-dark);
}

.btn-primary:hover {
    background: var(--mint-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--gray);
}

.btn-secondary:hover {
    background: var(--gray);
    color: white;
}

.auth-links {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--mint-light);
}

.auth-links a {
    color: var(--mint-dark);
    text-decoration: none;
    font-weight: 500;
}

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

.admin-info {
    background: var(--mint-light);
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.registration-info {
    background: var(--mint-light);
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.registration-info ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.registration-info li {
    margin: 0.25rem 0;
    color: var(--gray);
}

/* Герой секция */
.hero-section {
    background: linear-gradient(135deg, var(--mint) 0%, var(--mint-dark) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    border-radius: 0 0 30px 30px;
    margin-bottom: 3rem;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Сетка товаров - ВОССТАНАВЛИВАЕМ НОРМАЛЬНЫЙ ВИД */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--mint);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 480px; /* Нормальная высота */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.product-image-container {
    height: 200px;
    border-bottom: 2px solid var(--mint);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    flex-shrink: 0;
    position: relative;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
}

.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--mint-dark);
    background: var(--mint-light);
}

.product-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Простая и надежная структура */
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-dark);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.product-brand {
    color: var(--gray);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.product-short-description {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    flex-grow: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.product-price-section {
    margin: 0.5rem 0;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--red);
}

.product-stock {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.in-stock {
    color: var(--success);
    font-weight: 500;
}

.out-of-stock {
    color: var(--danger);
    font-weight: 500;
}

/* КНОПКИ В КАРТОЧКАХ - ВИДИМЫЕ И НА СВОИХ МЕСТАХ */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto; /* Прижимаем к низу */
    padding-top: 1rem;
}

.product-actions .btn {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
    font-weight: 600;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-container {
    position: relative;
    background: white;
    margin: 2% auto;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 15px;
    border: 2px solid var(--mint);
    overflow: hidden;
    z-index: 10001;
}

.modal-header {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10002;
}

.modal-close-btn {
    background: white;
    border: none;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    color: var(--gray);
    z-index: 10003;
}

.modal-close-btn:hover {
    background: var(--red);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 0;
    max-height: calc(90vh - 40px);
    overflow-y: auto;
}

.product-modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.product-modal-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-image {
    border: 2px solid var(--mint);
    border-radius: 10px;
    overflow: hidden;
    background: white;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}

.product-modal-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.product-modal-info h2 {
    font-size: 1.5rem;
    color: var(--gray-dark);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.product-modal-info .product-brand {
    font-size: 1rem;
    color: var(--gray);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.product-full-description {
    line-height: 1.6;
    color: var(--gray);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.product-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.product-modal-actions .btn {
    flex: 1;
    padding: 0.75rem;
}

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--red);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.price-with-discount {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.old-price {
    text-decoration: line-through;
    color: var(--gray);
    font-size: 0.9rem;
}

/* Карусель товаров со скидкой */
.discounted-carousel-section {
    margin: 3rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.carousel-controls {
    display: flex;
    gap: 0.5rem;
}

.carousel-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--mint);
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.carousel-btn:hover {
    background: var(--mint);
    color: white;
}

.carousel-container {
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    gap: 2rem;
}

.carousel-slide {
    flex: 0 0 280px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mint-light);
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-dot.active {
    background: var(--mint-dark);
}

/* Адаптивность */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        width: 100%;
        justify-content: flex-start;
    }
    
    .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    .nav-search {
        flex: 1 1 100%;
        order: 3;
    }
    
    .auth-form {
        padding: 2rem;
        margin: 1rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-card {
        height: 460px;
    }
    
    .product-modal-content {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .main-image {
        height: 300px;
    }
    
    .carousel-slide {
        flex: 0 0 260px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .product-modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 0 0.5rem;
    }
    
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-link {
        font-size: 0.8rem;
        padding: 0.25rem;
    }
    
    .auth-form {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .modal-container {
        width: 95%;
        margin: 1% auto;
    }
    
    .carousel-slide {
        flex: 0 0 220px;
    }
    
    .product-card {
        height: 440px;
    }
}
