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

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    padding: 20px;
}

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

/* Шапка */
.header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    margin: 0;
    font-size: 24px;
}

/* Блок авторизации */
.auth-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.login-btn:hover, .logout-btn:hover {
    transform: translateY(-2px);
}

/* Навигация */
.nav {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav a {
    color: #2c3e50;
    text-decoration: none;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.2s;
}

.nav a:hover {
    background: #2c3e50;
    color: white;
}

/* Форма поиска */
.search-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-form input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-form input:focus {
    outline: none;
    border-color: #667eea;
}

.search-form button {
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.search-form button:hover {
    background: #0056b3;
}

.reset-btn {
    background: #6c757d !important;
}

.reset-btn:hover {
    background: #5a6268 !important;
}

/* Сетка товаров */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Карточка товара */
.card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f8f9fa;
}

.card-image-placeholder {
    width: 100%;
    height: 180px;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 48px;
}

.card-category {
    display: inline-block;
    padding: 4px 12px;
    background: #e9ecef;
    border-radius: 20px;
    font-size: 11px;
    color: #495057;
    margin: 12px 15px 0;
}

.card-title {
    font-size: 18px;
    font-weight: bold;
    margin: 8px 15px;
    color: #2c3e50;
}

.card-description {
    font-size: 13px;
    color: #6c757d;
    margin: 0 15px;
    line-height: 1.4;
}

.card-price {
    font-size: 22px;
    font-weight: bold;
    color: #28a745;
    margin: 10px 15px;
}

/* Кнопки администратора */
.admin-actions {
    padding: 12px 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    background: #f8f9fa;
}

.edit-btn {
    background: #ffc107;
    color: #333;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: opacity 0.2s;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: opacity 0.2s;
}

.edit-btn:hover, .delete-btn:hover {
    opacity: 0.8;
}

/* Модальные окна */
.modal, .login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content, .login-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 450px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-content h3, .login-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.modal-content input,
.modal-content textarea,
.modal-content select,
.login-content input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus,
.login-content input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-content button, .login-content button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-top: 10px;
    transition: transform 0.2s;
}

.modal-content button:hover, .login-content button:hover {
    transform: translateY(-2px);
}

/* Состояния загрузки */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 18px;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 18px;
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #dc3545;
    font-size: 18px;
}

/* Футер */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-radius: 10px;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form button {
        width: 100%;
    }
}