/* Products Page Specific Styles */

/* Products Section */
.products-section {
    padding: 6rem 0 3rem;
    background: var(--bg-dark);
    min-height: 100vh;
}

/* Value Proposition Banner */
.value-banner {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(10, 10, 15, 0.95) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.value-banner h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.value-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 900px;
    margin: 0 auto 1.5rem;
}

.benefits {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.benefit-icon {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: bold;
}

/* Blockchain Info in Form */
.blockchain-info {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.blockchain-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.5rem 0;
}

.blockchain-info strong {
    color: var(--primary-color);
}

/* Header Controls */
.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    gap: 1rem;
    flex: 1;
    max-width: 600px;
}

.search-bar input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-search {
    padding: 0.8rem 1.5rem;
    background: var(--gradient-1);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary {
    padding: 0.8rem 1.5rem;
    background: var(--gradient-1);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

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

.btn-secondary {
    padding: 0.8rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Filter Panel */
.filter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 200px;
}

.filter-group label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    padding: 0.6rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.filter-group select {
    cursor: pointer;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Product Card */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.2);
    transform: translateY(-5px);
}

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

.product-title {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.product-sku {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
}

.product-badge {
    padding: 0.3rem 0.8rem;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.product-badge.owner {
    background: rgba(0, 255, 135, 0.1);
    border-color: #00ff87;
    color: #00ff87;
}

.product-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.product-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.product-detail-label {
    color: var(--text-secondary);
}

.product-detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.product-timestamp {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.product-owner {
    color: var(--text-secondary);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 2rem;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-hint {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.char-count {
    display: block;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Product Detail View */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.detail-section {
    background: var(--bg-dark);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detail-section h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    text-align: right;
    word-break: break-word;
}

.detail-full {
    grid-column: 1 / -1;
}

.blockchain-address {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

/* Form Sections */
.form-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-section-title {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    font-size: 1.1rem;
}

.info-tooltip {
    background: rgba(255, 107, 53, 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s ease;
}

.info-tooltip:hover {
    background: var(--primary-color);
    color: white;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Product Flags */
.product-flags,
.detail-flags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.flag {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.flag.hazardous {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.flag.perishable {
    background: rgba(0, 188, 212, 0.2);
    color: #00bcd4;
    border: 1px solid rgba(0, 188, 212, 0.5);
}

/* Status Badge */
.status-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.valid {
    background: rgba(0, 255, 135, 0.2);
    color: #00ff87;
}

.status-badge.discontinued {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

.status-badge.recalled {
    background: rgba(255, 53, 53, 0.2);
    color: #ff3535;
}

/* Attribute Info Popup */
.attribute-info-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.attribute-info-popup .popup-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    color: var(--text-secondary);
    line-height: 1.6;
}

.attribute-info-popup h4 {
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.attribute-info-popup p {
    margin-bottom: 0.75rem;
}

.attribute-info-popup strong {
    color: var(--primary-color);
}

.attribute-info-popup a {
    color: var(--primary-color);
}

.popup-close {
    margin-top: 1rem;
    padding: 0.6rem 1.5rem;
    background: var(--gradient-1);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.popup-close:hover {
    opacity: 0.9;
}

/* Attribute Tables in Info Modal */
.attribute-table {
    margin-top: 1rem;
}

.attribute-table h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin: 1.5rem 0 0.5rem 0;
}

.attribute-table h4:first-child {
    margin-top: 0;
}

.attribute-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.attribute-table th,
.attribute-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.attribute-table th {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.attribute-table td {
    color: var(--text-secondary);
}

.attribute-table td:first-child {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.attribute-table code {
    background: rgba(255, 107, 53, 0.15);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .products-section {
        padding: 5rem 1rem 2rem;
    }

    .products-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        max-width: 100%;
    }

    .filter-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 1rem;
    }

    .modal-content {
        max-height: 95vh;
    }
}

/* Success/Error Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background: rgba(0, 255, 135, 0.1);
    border: 1px solid #00ff87;
    color: #00ff87;
}

.alert-error {
    background: rgba(255, 53, 53, 0.1);
    border: 1px solid #ff3535;
    color: #ff3535;
}

.alert-info {
    background: rgba(53, 159, 255, 0.1);
    border: 1px solid #359fff;
    color: #359fff;
}

/* Header Buttons Container */
.header-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Info Modal Styles */
.modal-wide {
    max-width: 800px;
}

.info-modal-body {
    max-height: 69vh;
    overflow-y: auto;
}

.info-content {
    color: var(--text-secondary);
    line-height: 1.7;
}

.info-section {
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

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

.info-section h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.info-section p {
    margin-bottom: 0.4rem;
}

.info-section strong {
    color: var(--primary-color);
}

.info-section ul,
.info-section ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.info-section li {
    margin-bottom: 0.5rem;
}

.info-section a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-section a:hover {
    text-decoration: underline;
}

.info-section pre {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.info-section code {
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.attribute-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.attribute-item {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Info Button specific styling */
#infoBtn {
    white-space: nowrap;
}

#infoBtn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Info Modal Footer */
#infoModal .modal-footer {
    justify-content: center;
    padding: 1rem 2rem;
}

#infoModal .modal-footer .btn-primary {
    padding: 0.7rem 2.5rem;
    font-size: 1rem;
    border-radius: 25px;
    display: inline-block;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .header-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .header-buttons button {
        width: 100%;
    }
    
    .modal-wide {
        max-width: 95%;
    }
    
    .attribute-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
