/* css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    background-color: #f9f9f9;
    font-size: 16px;
}

.header {
    background-color: #2c3e50;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.customer-form {
    background-color: #f1f1f1;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
}

.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.product-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s;
    display: grid;
    grid-template-columns: 12% 88%;
    height: auto;
    min-height: 100px;
    border: 1px solid #e0e0e0;
    margin: 0;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-card.ordered {
    background-color: #f8f9fa;
    opacity: 0.95;
    border: 1px solid #d1ecf1;
}

.product-image-container {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background-color: #f8f9fa;
    border-right: 1px solid #eaeaea;
}

.product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-info {
    grid-column: 2;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 6px;
    color: #2c3e50;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 14px;
    color: #e74c3c;
    margin-bottom: 5px;
    font-weight: bold;
}

.product-stock {
    font-size: 12px;
    color: #5a6268;
    margin-bottom: 8px;
}

.order-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.quantity-input {
    width: 50px;
    padding: 5px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 13px;
    text-align: center;
}

.order-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.order-button:hover {
    background-color: #218838;
}

.order-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.ordered-label {
    color: #155724;
    font-weight: bold;
    font-size: 11px;
    background-color: #d4edda;
    padding: 5px 8px;
    border-radius: 3px;
    border: 1px solid #c3e6cb;
    margin-bottom: 8px;
    line-height: 1.3;
}

.error-message {
    color: #721c24;
    font-size: 12px;
    background-color: #f8d7da;
    padding: 5px 8px;
    border-radius: 3px;
    border: 1px solid #f5c6cb;
    margin-top: 8px;
}

.refresh-info {
    text-align: right;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 12px;
    padding: 0 5px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 10px;
    }
    
    .product-card {
        grid-template-columns: 15% 85%;
        min-height: 90px;
    }
    
    .product-image-container {
        padding: 6px;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    
    .product-price {
        font-size: 13px;
    }
    
    .product-stock {
        font-size: 11px;
    }
    
    .ordered-label {
        font-size: 10px;
        padding: 4px 6px;
        margin-bottom: 6px;
    }
    
    .order-form {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .quantity-input {
        width: 45px;
        padding: 4px;
        font-size: 12px;
    }
    
    .order-button {
        padding: 5px 8px;
        font-size: 12px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .product-card {
        grid-template-columns: 18% 82%;
    }
    
    .product-title {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
    
    .ordered-label {
        font-size: 9px;
        padding: 3px 5px;
    }
    
    .order-form {
        flex-direction: row;
        align-items: center;
        gap: 4px;
    }
    
    .quantity-input {
        width: 45px;
        margin-bottom: 0;
    }
    
    .order-button {
        width: auto;
    }
}

/* Горизонтальная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .product-card {
        grid-template-columns: 12% 88%;
    }
}

/* Большие экраны */
@media (min-width: 1200px) {
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 15px;
    }
    
    .product-card {
        grid-template-columns: 12% 88%;
        min-height: 110px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-title {
        font-size: 15px;
    }
    
    .product-price {
        font-size: 15px;
    }
    
    .product-stock {
        font-size: 13px;
    }
}
