/* Product Attributes Styles */
/* services/frontend_ui/css/product-attributes.css */

/* Layout for attributes section */
.attributes-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .attributes-layout {
        grid-template-columns: 1fr;
    }
}

/* Products Grid */
.products-grid {
    display: grid;
    gap: 1rem;
}

.products-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.empty-state.small {
    padding: 2rem;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.2);
}

.empty-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.product-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.product-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.product-header h4 {
    margin: 0;
    font-size: 1.1rem;
}

.product-details {
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.detail-label {
    opacity: 0.7;
    min-width: 80px;
}

.detail-value {
    font-weight: 500;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Selected Product Info */
.selected-product-card {
    background: var(--glass);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.selected-product-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.product-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Mappings List */
.mappings-list {
    max-height: 500px;
    overflow-y: auto;
}

.mapping-group {
    margin-bottom: 1.5rem;
}

.mapping-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.attribute-type-badge {
    font-weight: 600;
    font-size: 0.95rem;
}

.mapping-count {
    font-size: 0.85rem;
    opacity: 0.7;
}

.mapping-item {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.mapping-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.mapping-info {
    flex: 1;
}

.mapping-field {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.mapping-field strong {
    margin-right: 0.5rem;
}

.required-indicator {
    color: var(--danger);
    font-weight: bold;
    margin-left: 0.25rem;
}

.mapping-details {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.mapping-details .badge {
    font-size: 0.75rem;
}

.default-value {
    font-size: 0.85rem;
    opacity: 0.8;
    font-style: italic;
}

.mapping-actions {
    display: flex;
    gap: 0.5rem;
}

/* Import modal */
.import-products-modal {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.import-products-modal .modal-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.import-products-modal .modal-toolbar .form-input {
    flex: 1;
}

.import-products-modal .button-group {
    display: flex;
    gap: 0.5rem;
}

.product-import-list {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.3);
}

.import-product-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.6rem;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.import-product-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.import-product-item input[type="checkbox"] {
    margin-top: 0.35rem;
}

.import-product-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.import-product-name {
    font-weight: 600;
}

.import-product-subtitle {
    font-size: 0.85rem;
    opacity: 0.75;
}

.import-product-details {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Test Section */
.test-section {
    padding: 1.5rem 0;
}

.code-input {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.2);
    color: #e0e0e0;
}

.test-result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.test-result pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #10b981;
    white-space: pre-wrap;
}

/* Tabs for mappings section */
.tabs-container {
    margin-bottom: 2rem;
}

.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 0;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.tab:hover {
    background: var(--glass);
}

.tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

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

/* Empty States */
.products-list .empty-state,
.mappings-list .empty-state {
    text-align: center;
    padding: 2rem;
    opacity: 0.7;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Form Elements for Modals */
.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    opacity: 0.7;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Loading States */
.products-list.loading,
.mappings-list.loading {
    position: relative;
    min-height: 200px;
}

.products-list.loading::after,
.mappings-list.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
/* Validation Panel */
.validation-panel {
    margin-top: 1.5rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
}

.validation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.validation-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.validation-actions {
    display: flex;
    gap: 0.5rem;
}

.validation-meta {
    display: grid;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.validation-meta code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
}

.validation-audit-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.validation-audit-table th,
.validation-audit-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.validation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.validation-badge.valid {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.validation-badge.transformed {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.validation-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.fallback-editor {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.fallback-column {
    flex: 1;
    min-width: 220px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
}

.fallback-column h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.fallback-list,
.fallback-selected {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.chip {
    display: inline-flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chip:hover {
    background: rgba(99, 102, 241, 0.25);
}

.chip-add {
    font-weight: 700;
    margin-left: 0.5rem;
}

.fallback-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
}

.fallback-actions {
    display: flex;
    gap: 0.25rem;
}

.fallback-actions button {
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
    cursor: pointer;
}

.fallback-actions button:hover {
    background: rgba(255, 255, 255, 0.25);
}

.history-entry {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.history-entry pre {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 6px;
}
