/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Страница входа */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1em;
}

.error-message {
    color: #dc3545;
    margin-top: 12px;
    padding: 10px;
    background: #fff5f5;
    border-left: 3px solid #dc3545;
    border-radius: 4px;
    display: none;
}

.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Страница заказа */
.header {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    margin-bottom: 30px;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #667eea;
}

.notification {
    margin: 20px 0;
    padding: 16px 20px;
    border-radius: 8px;
    font-weight: 500;
}

.notification-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.notification-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.notification-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.info-block {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.info-block p {
    margin: 0;
    color: #666;
}

/* Сетка товаров (для мобильных) */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.product-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
}

.product-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.product-header h3 {
    color: #333;
    font-size: 1.2em;
    flex: 1;
}

.product-unit {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.product-details {
    margin-bottom: 15px;
}

.product-details p {
    margin: 5px 0;
    color: #666;
    font-size: 0.9em;
}

.product-price {
    color: #667eea;
    font-size: 1.3em;
    font-weight: 700;
}

.product-order {
    margin-top: 15px;
}

.product-order label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 0.9em;
}

.product-order input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1.1em;
    text-align: center;
}

.product-order input:focus {
    outline: none;
    border-color: #667eea;
}

.no-products {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Таблица товаров (для больших экранов) */
.products-table {
    display: none;
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.products-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.products-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95em;
}

.products-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.products-table tbody tr {
    transition: background-color 0.2s;
}

.products-table tbody tr:hover {
    background-color: #f8f9fa;
}

.products-table .table-product-name {
    color: #333;
    font-weight: 600;
    font-size: 1.05em;
}

.products-table .table-articul {
    color: #666;
    font-size: 0.9em;
}

.products-table .table-unit {
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.products-table .table-price {
    color: #667eea;
    font-weight: 700;
    font-size: 1.1em;
}

.products-table .table-quantity-input {
    width: 100px;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    text-align: center;
    transition: border-color 0.3s;
}

.products-table .table-quantity-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Переключение между таблицей и карточками в зависимости от размера экрана */
@media (min-width: 769px) {
    .products-grid {
        display: none;
    }
    
    .products-table {
        display: table;
    }
}

/* Сводка заказа */
.summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary h2 {
    color: white;
}

.summary-content {
    padding: 10px 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.summary-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 1.3em;
}

.form-actions {
    margin: 40px 0;
    text-align: center;
}

textarea {
    resize: vertical;
}

/* Страница успешного заказа */
.success-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.success-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 50px 40px;
    width: 100%;
    max-width: 700px;
    text-align: center;
}

.success-icon {
    margin: 0 auto 30px;
    animation: successPop 0.5s ease-out;
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-card h1 {
    color: #28a745;
    font-size: 2.2em;
    margin-bottom: 10px;
}

.success-subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 40px;
}

.order-details {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: left;
}

.order-details h2 {
    color: #667eea;
    font-size: 1.3em;
    margin-bottom: 20px;
    text-align: center;
}

.order-info .info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.order-info .info-row:last-of-type {
    border-bottom: none;
}

.order-info .info-label {
    color: #666;
    font-weight: 500;
}

.order-info .info-value {
    color: #333;
    font-weight: 600;
    text-align: right;
}

.order-items-section {
    margin-top: 25px;
}

.order-items-section h3 {
    color: #667eea;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.order-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.order-item .item-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-item .item-name strong {
    color: #333;
    font-size: 1.05em;
}

.order-item .item-unit {
    background: #667eea;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.order-item .item-details {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 0.95em;
}

.order-item .item-subtotal {
    color: #667eea;
    font-weight: 700;
}

.order-summary {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #667eea;
}

.order-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 1.05em;
}

.order-summary .summary-row.total {
    color: #667eea;
    font-size: 1.3em;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.notification-info-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 30px;
    text-align: left;
}

.notification-info-box p {
    margin: 0;
    color: #0c5460;
    font-size: 0.95em;
}

.success-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.success-actions .btn {
    min-width: 200px;
}

.no-data {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.hint {
    color: #999;
    font-size: 0.9em;
    text-align: center;
    margin-top: 10px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 20px;
    }
    
    .success-card {
        padding: 30px 20px;
    }
    
    .success-card h1 {
        font-size: 1.8em;
    }
    
    .success-actions {
        flex-direction: column;
    }
    
    .success-actions .btn {
        width: 100%;
    }
    
    .order-details {
        padding: 20px;
    }
    
    .order-item .item-name {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

