/* Стили модального окна архива автомобилей */

/* Overlay и основное модальное окно */
.catalog-archive-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 2000;
    padding: 20px;
    overflow: auto;
}

.catalog-archive-modal-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.catalog-archive-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
    margin: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.catalog-archive-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.catalog-archive-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.catalog-archive-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.catalog-archive-close:hover {
    background: #f3f4f6;
    color: #4b5563;
}

/* Tabs */
.catalog-archive-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.archive-tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.archive-tab-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.archive-tab-btn.active {
    background: #3b82f6;
    color: white;
}

/* Actions */
.catalog-archive-actions {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* Content */
.catalog-archive-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

/* Catalog Tree */
.catalog-tree {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.catalog-tree-item {
    margin: 0;
}

.catalog-tree-brand,
.catalog-tree-model {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.catalog-tree-brand {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    cursor: pointer;
    padding-left: 0;
}

.catalog-tree-model {
    font-weight: 500;
    font-size: 0.9375rem;
    color: #374151;
    cursor: pointer;
    padding-left: 20px;
}

.catalog-tree-trim {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 6px 40px;
    font-size: 0.875rem;
    color: #4b5563;
}

.catalog-tree-trim-name {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.catalog-tree-trim-name::before {
    content: '•';
    font-size: 1.25rem;
    color: #9ca3af;
}

.catalog-tree-trim-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.catalog-tree-trim:hover .catalog-tree-trim-actions {
    opacity: 1;
}

.tree-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: transform 0.2s;
}

.tree-toggle.collapsed {
    transform: rotate(-90deg);
}

.tree-children {
    display: none;
    padding-left: 16px;
}

.tree-children.expanded {
    display: block;
}

/* Buttons in tree */
.tree-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.tree-btn-archive {
    background: #fee2e2;
    color: #dc2626;
}

.tree-btn-archive:hover {
    background: #fecaca;
}

.tree-btn-restore {
    background: #d1fae5;
    color: #059669;
}

.tree-btn-restore:hover {
    background: #a7f3d0;
}

.tree-btn-edit {
    background: #dbeafe;
    color: #2563eb;
}

.tree-btn-edit:hover {
    background: #bfdbfe;
}

/* Pricing Editor */
.pricing-editor {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: #f9fafb;
}

.pricing-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pricing-editor-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.pricing-editor-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.pricing-editor-close:hover {
    background: #e5e7eb;
    color: #4b5563;
}

.pricing-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row-double {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.form-group .form-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-group .form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-hint {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Discounts & Compensations Sections */
.discounts-section,
.compensations-section {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.discounts-section h4,
.compensations-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
}

.discounts-grid,
.compensations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

/* Pricing Editor Footer */
.pricing-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
}

/* Archive Footer */
.catalog-archive-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* Loading spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Empty state */
.catalog-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.catalog-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Archive badge */
.archive-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .catalog-archive-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .catalog-archive-modal-overlay {
        padding: 0;
    }
    
    .form-row-double {
        grid-template-columns: 1fr;
    }
    
    .discounts-grid,
    .compensations-grid {
        grid-template-columns: 1fr;
    }
    
    .catalog-archive-actions {
        flex-wrap: wrap;
    }
}

/* Add Model Modal */
.add-model-modal-overlay,
.add-trim-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 2100;
    padding: 20px;
    overflow: auto;
}

.add-model-modal-overlay.active,
.add-trim-modal-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.add-model-modal,
.add-trim-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
    margin: auto;
}

.add-model-header,
.add-trim-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.add-model-header h3,
.add-trim-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.add-model-close,
.add-trim-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.add-model-close:hover,
.add-trim-close:hover {
    background: #e5e7eb;
    color: #4b5563;
}

.add-model-body,
.add-trim-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.add-model-footer,
.add-trim-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .add-model-modal,
    .add-trim-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .add-model-modal-overlay,
    .add-trim-modal-overlay {
        padding: 0;
    }
}
