/* Product Calculator Frontend Styles */

.product-calculator-container {
    position: relative;
    font-family: 'Oswald', 'Arial', sans-serif;
}

.pc-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    position: relative;
}

.pc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.pc-tabs {
    display: flex;
    gap: 10px;
}

.pc-tab {
    padding: 10px 20px;
    background-color: #e9e9e9;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-family: inherit;
}

.pc-tab.active {
    background-color: #2c3e50;
    color: white;
}

.pc-tab:hover:not(.active) {
    background-color: #d4d4d4;
}

.pc-search-container {
    display: flex;
    align-items: center;
}

.pc-search-input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 250px;
    font-family: inherit;
}

.pc-search-button {
    background-color: #2c3e50;
    color: white;
    border: none;
    padding: 8px 15px;
    margin-left: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.pc-search-button:hover {
    background-color: #34495e;
}

.pc-tab-content {
    display: none;
}

.pc-tab-content.active {
    display: block;
}

.pc-calculator-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.pc-filters {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
}

.pc-filter-group {
    margin-bottom: 15px;
}

.pc-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.pc-filter-group select, 
.pc-filter-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.pc-filter-group select:focus, 
.pc-filter-group input:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.pc-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.pc-btn {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.pc-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.pc-btn-small {
    padding: 5px 10px;
    font-size: 0.9em;
}

.pc-btn-primary {
    background-color: #2c3e50;
    color: white;
}

.pc-btn-secondary {
    background-color: #7f8c8d;
    color: white;
}

.pc-btn-success {
    background-color: #ff6600;
    color: white;
}

.pc-btn-success:hover {
    background-color: #e55a00;
    transform: translateY(-2px);
}

.pc-btn-danger {
    background-color: #e74c3c;
    color: white;
}

.pc-product-info {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
}

.pc-product-image {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
    background-color: #fff;
    border-radius: 4px;
    padding: 10px;
}

.pc-calculation-result {
    background-color: #ecf0f1;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.pc-calculation-result h4 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.pc-found-products {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    min-height: 100px;
}

.pc-found-products h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

#pcFoundProductsList {
    min-height: 50px;
}

#pcFoundProductsList:empty::before {
    content: "Введите текст для поиска товаров...";
    color: #888;
    font-style: italic;
}

.pc-product-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.pc-product-item:hover {
    background-color: #f0f0f0;
}

.pc-product-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 4px;
}

.pc-order-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    color: #000; /* Черный цвет текста для секции заказа */
}

.pc-order-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    color: #000; /* Черный цвет текста */
}

.pc-order-table th, 
.pc-order-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    color: #000; /* Черный цвет текста для ячеек */
}

.pc-order-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.pc-total-row {
    font-weight: bold;
    background-color: #f9f9f9;
    color: #000; /* Черный цвет текста для итоговой строки */
}

.pc-empty-cart {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
}

.pc-order-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.pc-import-export-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
}

.pc-order-history {
    margin-top: 30px;
}

.pc-history-list {
    margin-top: 15px;
}

.pc-history-item {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pc-history-actions {
    display: flex;
    gap: 10px;
}

.pc-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pc-catalog-item {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    background-color: #fff;
}

.pc-catalog-item:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.pc-catalog-item img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 4px;
}

.pc-catalog-item h3 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #2c3e50;
}

.pc-catalog-item .pc-price {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 18px;
}

.pc-catalog-item .pc-btn {
    width: 100%;
}

/* Пагинация */
.pc-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px 0;
}

.pc-page-info {
    font-weight: 500;
    color: #2c3e50;
    font-size: 16px;
    min-width: 150px;
    text-align: center;
}

.pc-pagination .pc-btn {
    min-width: 120px;
}

.pc-pagination .pc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pc-pagination .pc-btn:disabled:hover {
    transform: none;
    opacity: 0.5;
}

/* Уведомления */
.pc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px;
}

.pc-notification.pc-hidden {
    display: none;
}

.pc-notification.success {
    background-color: #ff6600;
    color: white;
}

.pc-notification.error {
    background-color: #e74c3c;
    color: white;
}

.pc-notification.info {
    background-color: #3498db;
    color: white;
}

.pc-notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: 15px;
}

/* Индикатор загрузки */
.pc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.pc-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: pc-spin 1s linear infinite;
}

@keyframes pc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pc-loading-text {
    color: white;
    margin-top: 15px;
    font-size: 1.2em;
}

.pc-loading-content {
    text-align: center;
}

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

.pc-modal {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 80vh;
    overflow-y: auto;
}

.pc-order-modal {
    max-width: 600px;
}

.pc-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.pc-form-group {
    margin-bottom: 15px;
}

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

.pc-form-group input,
.pc-form-group textarea,
.pc-form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.pc-form-group input:focus,
.pc-form-group textarea:focus,
.pc-form-group select:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

/* Адаптивность */
@media (max-width: 768px) {
    .pc-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .pc-tabs {
        width: 100%;
        justify-content: center;
    }
    
    .pc-search-container {
        width: 100%;
    }
    
    .pc-search-input {
        width: 100%;
    }
    
    .pc-calculator-content {
        grid-template-columns: 1fr;
    }
    
    .pc-catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .pc-order-actions {
        flex-wrap: wrap;
    }
    
    .pc-order-actions .pc-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .pc-history-item {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .pc-history-actions {
        width: 100%;
    }
}

/* Улучшенные стили для таблицы заказа */
.pc-order-table input[type="number"] {
    width: 70px;
    min-width: 70px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
    font-size: 14px;
}

.pc-order-table .quantity-cell {
    width: 80px;
    text-align: center;
}

.pc-order-table .name-cell {
    max-width: 200px;
    word-wrap: break-word;
}

.pc-order-table .price-cell,
.pc-order-table .total-cell {
    text-align: right;
    white-space: nowrap;
}

.pc-order-table .actions-cell {
    width: 60px;
    text-align: center;
}

@media (max-width: 480px) {
    .pc-order-table {
        font-size: 12px;
    }
    
    .pc-order-table th, 
    .pc-order-table td {
        padding: 4px 2px;
    }
    
    .pc-order-table input[type="number"] {
        width: 50px;
        min-width: 50px;
        font-size: 12px;
    }
    
    .pc-order-table .quantity-cell {
        width: 60px;
    }
    
    .pc-order-table .name-cell {
        max-width: 120px;
        font-size: 11px;
    }
    
    .pc-catalog-grid {
        grid-template-columns: 1fr;
    }
    
    .pc-container {
        padding: 10px;
    }
    
    .pc-notification {
        max-width: calc(100% - 40px);
    }
    
    .pc-modal {
        width: 95%;
        margin: 20px;
    }
}

/* Стили для печати */
@media print {
    /* Скрываем элементы управления */
    .pc-header,
    .pc-tabs,
    .pc-search-container,
    .pc-filters,
    .pc-actions,
    .pc-order-actions,
    .pc-import-export-section,
    .pc-order-history,
    .pc-modal-overlay,
    .pc-notification,
    .pc-loading-overlay,
    .pc-catalog-grid,
    .pc-pagination,
    .pc-found-products,
    .pc-calculation-result,
    .pc-product-info {
        display: none !important;
    }
    
    /* Общие стили для печати */
    body {
        background: white !important;
        margin: 0 !important;
        padding: 20px !important;
    }
    
    .product-calculator-container {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
    }
    
    .pc-container {
        max-width: none !important;
        width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    
    /* Показываем информацию о компании при печати */
    .pc-print-only {
        display: block !important;
        margin-bottom: 30px !important;
        page-break-inside: avoid !important;
    }
    
    /* Шапка компании для печати */
    .pc-print-company-header {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        margin-bottom: 30px !important;
        padding-bottom: 20px !important;
        border-bottom: 2px solid #333 !important;
        page-break-inside: avoid !important;
    }
    
    /* Левая секция: Логотип + Название */
    .pc-print-left-section {
        flex: 0 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .pc-print-logo {
        margin-bottom: 10px !important;
    }
    
    .pc-print-logo img {
        max-width: 180px !important;
        max-height: 100px !important;
        width: auto !important;
        height: auto !important;
        display: block !important;
    }
    
    .pc-print-company-name {
        margin: 5px 0 0 0 !important;
        font-size: 18px !important;
        font-weight: bold !important;
        color: #000 !important;
        line-height: 1.3 !important;
    }
    
    /* Правая секция: Контакты */
    .pc-print-right-section {
        flex: 0 0 auto !important;
        text-align: right !important;
        padding-top: 5px !important;
    }
    
    .pc-print-contacts {
        font-size: 13px !important;
        color: #333 !important;
    }
    
    .pc-print-contact-item {
        margin: 6px 0 !important;
        line-height: 1.4 !important;
    }
    
    .pc-print-contact-item strong {
        font-weight: bold !important;
        color: #000 !important;
        min-width: 60px !important;
        display: inline-block !important;
    }
    
    /* Заголовок заказа */
    .pc-order-section {
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    
    .pc-order-section h3 {
        font-size: 24px !important;
        margin: 20px 0 30px 0 !important;
        padding: 0 !important;
        border-bottom: 2px solid #333 !important;
        padding-bottom: 10px !important;
        color: #000 !important;
    }
    
    /* Таблица заказа */
    .pc-order-table-container {
        margin-top: 0 !important;
    }
    
    .pc-order-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 15px 0 !important;
    }
    
    .pc-order-table th,
    .pc-order-table td {
        padding: 10px !important;
        border: 1px solid #ddd !important;
        text-align: left !important;
        font-size: 13px !important;
        color: #000 !important;
    }
    
    .pc-order-table th {
        background: #f5f5f5 !important;
        font-weight: bold !important;
        color: #000 !important;
    }
    
    .pc-total-row {
        background: #e8e8e8 !important;
        font-weight: bold !important;
        color: #000 !important;
    }
    
    /* Скрываем кнопки и поля ввода в таблице при печати */
    .pc-order-table input[type="number"],
    .pc-order-table .pc-btn,
    .pc-order-table button {
        display: none !important;
    }
    
    /* Отображаем количество как текст */
    .pc-order-table .quantity-cell::before {
        content: attr(data-quantity) !important;
    }
    
    /* Разрыв страницы */
    .pc-order-section {
        page-break-inside: avoid !important;
    }
    
    /* Форматирование сумм */
    strong {
        font-weight: bold !important;
        color: #000 !important;
    }
    
    /* Скрываем пустую корзину */
    .pc-empty-cart {
        display: none !important;
    }
}