/* Основные стили */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 10px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

/* Анимации */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

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

/* Header */
.header {
    background: linear-gradient(90deg, var(--primary-color), var(--dark-color));
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    animation: fadeIn 1s ease-out;
}

.logo i {
    font-size: 2.5rem;
    color: var(--secondary-color);
    animation: pulse 2s infinite;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    color: #3498db;
}

.system-status {
    display: flex;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.status-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.status-item i {
    font-size: 1.2rem;
}

.status-item.healthy i {
    color: var(--success-color);
    animation: pulse 2s infinite;
}

.status-item.unhealthy i {
    color: var(--danger-color);
}

/* Search Section */
.search-section {
    padding: 15px 20px;
    background: var(--light-color);
    border-bottom: 1px solid #ddd;
}

.search-box {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    font-size: 1.2rem;
}

#partInput {
    flex: 1;
    padding: 15px 20px 15px 50px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    transition: var(--transition);
    background: white;
}

#partInput:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    transform: translateY(-1px);
}

#searchBtn {
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

#searchBtn:hover {
    background: linear-gradient(135deg, #2980b9, var(--secondary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.3);
}

#searchBtn:active {
    transform: translateY(0);
}

#refreshBtn {
    padding: 15px;
    background: var(--warning-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

#refreshBtn:hover {
    background: #e67e22;
    transform: rotate(90deg);
}

.search-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--dark-color);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--secondary-color);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control label {
    font-weight: 500;
    color: var(--dark-color);
}

#quantity {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    text-align: center;
    transition: var(--transition);
}

#quantity:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.spinner {
    margin-bottom: 20px;
}

.spinner i {
    font-size: 4rem;
    color: var(--secondary-color);
    animation: spin 1.5s linear infinite;
}

#loadingText {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 30px;
    font-weight: 500;
    text-align: center;
}

.parsers-status {
    display: flex;
    gap: 30px;
}

.parser-checking {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.parser-checking i {
    font-size: 1.5rem;
    color: var(--secondary-color);
    animation: spin 1s linear infinite;
}

.parser-checking span {
    font-size: 0.9rem;
    color: var(--dark-color);
    font-weight: 500;
}

/* Results Container */
.results-container {
    padding: 15px 20px;
    animation: fadeIn 0.5s ease-out;
}

.results-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-color);
}

#partNumberTitle {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
}

.source-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.source-badge.parser {
    background: rgba(52, 152, 219, 0.1);
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.source-badge.parser-force {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
    animation: pulse 1.5s infinite;
}

.source-badge.cache {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

/* Supplier Sections */
.supplier-section {
    margin-bottom: 30px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

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

.supplier-title {
    background: linear-gradient(90deg, var(--light-color), white);
    padding: 20px 30px;
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-container {
    padding: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

thead {
    background: linear-gradient(90deg, var(--primary-color), var(--dark-color));
    color: white;
}

th {
    padding: 5px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: var(--transition);
}


tbody tr:hover {
    background: rgba(52, 152, 219, 0.05);
}


tbody tr.fade-in-row {
    animation: fadeIn 0.5s ease-out;
}

td {
    padding: 5px 15px;
    font-size: 0.8rem;
}

.price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--success-color);
}

.price-zero {
    color: #999;
}

.price-zero .no-price {
    opacity: 0.6;
}

.stock {
    font-weight: 600;
}

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

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

.status-badge {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-badge.available {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.status-badge.unavailable {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.no-data {
    text-align: center;
    padding: 30px !important;
    color: #666;
    font-style: italic;
}

.no-data i {
    margin-right: 10px;
    color: var(--warning-color);
}

/* Supplier Summary */
.supplier-summary {
    padding: 15px 20px;
    background: rgba(236, 240, 241, 0.5);
    border-top: 1px solid #eee;
}

.supplier-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.stat-item i {
    color: var(--secondary-color);
}

/* Costex Summary */
.costex-summary {
    padding: 20px;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.05), rgba(41, 128, 185, 0.05));
    border-bottom: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-label {
    font-weight: 600;
    color: var(--dark-color);
}

.summary-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.summary-value.no-data {
    color: #999;
    font-weight: normal;
}

/* Historical Section */
.historical-section {
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.historical-title {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.historical-data {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.historical-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid #eee;
}

.historical-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary-color);
}

.historical-card.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.historical-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.historical-header i {
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.historical-date {
    font-size: 0.8rem;
    color: #666;
}

.historical-body p {
    margin: 5px 0;
    font-size: 0.9rem;
}

.historical-body i {
    margin-right: 8px;
    color: var(--primary-color);
}

.no-historical {
    text-align: center;
    padding: 30px;
    color: #666;
}

.no-historical i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 10px;
}

/* Summary Section */
.summary-section {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    border-radius: var(--border-radius);
    color: white;
}

.summary-section h3 {
    margin-bottom: 25px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.summary-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
    border-color: var(--secondary-color);
}

.summary-card.pop-in {
    animation: slideIn 0.5s ease-out;
}

.card-title {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 15px 0;
    color: var(--secondary-color);
}

.card-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Error Container */
.error-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.error-content {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.error-content i {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 20px;
}

.error-content h3 {
    font-size: 1.8rem;
    color: var(--danger-color);
    margin-bottom: 15px;
}

.error-content p {
    font-size: 1.1rem;
    color: var(--dark-color);
    margin-bottom: 25px;
    line-height: 1.6;
}

.error-btn {
    padding: 12px 30px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.error-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Footer */
.footer {
    padding: 20px 30px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-info p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.footer-info p:first-child {
    font-size: 1rem;
    color: white;
}

.footer-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

#partsInCache {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.stats-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    width: 90%;
    max-width: 600px;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    padding: 20px 30px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--secondary-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.stats-section {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.stats-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.stats-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.stats-item i {
    color: var(--secondary-color);
}

.stats-label {
    flex: 1;
    font-weight: 500;
}

.stats-value {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
}

.stats-value.healthy {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
}

.stats-value.warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
}

.error {
    color: var(--danger-color);
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: var(--border-radius);
    text-align: center;
}

.no-stats {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .system-status {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    #partInput {
        width: 100%;
    }
    
    #searchBtn, #refreshBtn {
        width: 100%;
        justify-content: center;
    }
    
    .search-options {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .supplier-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .footer {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Utility Classes */
.fade-in-row {
    animation: fadeIn 0.5s ease-out;
}

.pop-in {
    animation: slideIn 0.5s ease-out;
}
.logout-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    margin-left: 20px;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(238, 90, 36, 0.3);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.system-status {
    display: flex;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s;
}

.status-item.active {
    background: #e8f6ef;
}

.status-item i {
    font-size: 1.2rem;
}
/* Вариант 2: Просто убираем иконку */
#searchBtn i.fa-search {
    /* display: inline-block !important; */
    margin-right: 8px;
}

#searchBtn {
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#searchBtn:hover {
    background: linear-gradient(135deg, #2980b9, var(--secondary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.3);
}
/* Кнопки режимов отображения */
.mode-toggle {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.mode-btn {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: #e9ecef;
}

.mode-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}