/********************************************************************************
 * Eclipse Tractus-X - Industry Core Hub Frontend
 *
 * Copyright (c) 2025 Contributors to the Eclipse Foundation
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Apache License, Version 2.0 which is available at
 * https://www.apache.org/licenses/LICENSE-2.0.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the
 * License for the specific language govern in permissions and limitations
 * under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
********************************************************************************/

@use "../config/variables" as *;
@use '../config/mixins';

.productDetail {
    padding: 20px;
    margin: 20px 50px 30px;

    @media (max-width: 600px) {
        margin: 0;
    }
  
    * {
        color: $brand-text !important;
    }

    // Force override for black status chip with higher specificity
    &.productDetail .black-status-chip {
      color: #000000 !important;
      
      &, & *, & .MuiChip-label, & .MuiSvgIcon-root {
        color: #000000 !important;
      }
    }
  
    .product-card {
        background: $brand-dark !important;
        @include mixins.rounded-bordered;
        @include mixins.space-shadow($brand-blue);
        padding: 20px;
        
        .MuiBox-root, .MuiGrid2-root {
            margin: 10px 0;
        }
    }

    .product-card-details {
        background: $brand-dark !important;
        @include mixins.rounded-bordered;
        @include mixins.space-shadow($brand-blue);
        padding: 40px;
        width: 100%;
        height: 100%;
        
        .MuiBox-root, .MuiGrid2-root {
            margin: 10px 0;
        }
    }

  
    &, 
    .cx-card__decision--item .cx-card__decision--button {
        background: $brand-dark !important;
        @include mixins.rounded-bordered;
    }

    .MuiChip-root span {
        color: #ffffff !important;
    }

    .MuiChip-root .MuiChip-label {
        color: #ffffff !important;
    }

    .MuiChip-root .MuiChip-icon {
        color: #ffffff !important;
    }

    .cx-dropdown-menu {
        button {
            @include mixins.dark-bg-white-text;
            border: 1px solid $brand-text;

            &:hover {
                @include mixins.dark-bg-white-text;
            }
        }

        .dropdown-buttons {
            @include mixins.dark-bg-white-text;
        }
    }
  
    button.update-button {
        background-color: $brand-gray;
        height: 32px;
        box-sizing: border-box;
        border-radius: 6px;
        font-size: 0.8125rem;
    }
  
    .title-subtitle {
        padding: 10px 0px 40px 0px;
    }
  
    .add-on-buttons button {
        padding: 10px;
    }

    .product-image{
        display: block;
        max-height: 250px;
        max-width: 100%;
        height: auto;
        border-radius: 25px;
    }
      
}
  
.MuiChip-icon {
    color: #ffffff !important;
}

.cx-card__decision *,
.productDetail * {
    color: $brand-text !important;
}

div[role="presentation"] {
    > div.MuiPaper-root.MuiPopover-paper.MuiMenu-paper {
        background-color: $brand-dark;
        @include mixins.space-shadow($brand-shadow);

        button {
            background-color: $brand-orange;
            color: $brand-dark;
            font-weight: 600;
        }

        svg {
            fill: $brand-text;
        }

        p {
            color: $brand-text;
            margin-left: 10px;
        }
    }
}

.share-dropdown-btn {
    border-radius: 0 !important;
    @include mixins.dark-bg-white-text;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  
    &:hover {
        background: $blue-gradient-bg;
    }
}

.update-button-content{
    font-size: 15px;
}

.submodel-button-content{
    padding-right: 5px;
    font-size: 15px;
    text-transform:initial 
}

.submodel-button{
    border-radius: 8px!important;
    border: 1px solid $gradient-green-start!important;
    background: $green-gradient-bg-light;

    &:hover {
        background: $green-gradient-bg-hover!important;
        transform: translateY(-1px)!important;
        box-shadow: 0 8px 24px rgba(33, 122, 0, 0.606)!important;
        transition: all 0.2s ease-in-out;
    }
    &:disabled{
        background-color: $brand-gray;
        color: $brand-dark;
        cursor: not-allowed;
        opacity: 0.5;
    }
    &:active{
        border: 2px solid $gradient-green-start!important;
        box-shadow: none!important;
    }
    &:focus{
        border: 2px solid $gradient-green-start!important;
        box-shadow: none!important;
    }
}

// Actions dropdown button styling
button.actions-button {
    background: linear-gradient(135deg, #1976d2 0%, #42a5f5 100%) !important;
    height: 32px;
    box-sizing: border-box;
    border-radius: 6px !important;
    border: 1px solid $brand-blue !important;
    font-size: 0.8125rem !important;
    color: $brand-text !important;
    text-transform: none !important;
    font-weight: 500 !important;

    &:hover {
        background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%) !important;
        border-color: $brand-shadow !important;
    }

    &:disabled {
        background-color: transparent !important;
        color: $brand-gray !important;
        border-color: $brand-gray !important;
        cursor: not-allowed;
        opacity: 0.5;
    }

    // Icon styling with higher specificity
    .MuiSvgIcon-root,
    svg {
        color: $brand-text !important;
        font-size: 1.125rem !important;
        fill: $brand-text !important;
    }

    &:hover .MuiSvgIcon-root,
    &:hover svg {
        color: $brand-text !important;
        fill: $brand-text !important;
    }

    &:disabled .MuiSvgIcon-root,
    &:disabled svg {
        color: $brand-gray !important;
        fill: $brand-gray !important;
    }

    // Ensure text is visible
    span {
        color: $brand-text !important;
    }

    &:disabled span {
        color: $brand-text !important;
    }

    // Force icon color with even higher specificity
    .MuiButton-endIcon .MuiSvgIcon-root {
        color: $brand-text !important;
        fill: $brand-text !important;
    }
}

// Actions dropdown menu styling
.MuiPaper-root {
    &.actions-dropdown-menu {
        background-color: white !important;
        border: 1px solid rgba($brand-light-blue, 0.3) !important;
        border-radius: 8px !important;
        box-shadow: 0px 4px 20px rgba($brand-primary, 0.1) !important;
        min-width: 200px !important;
        margin-top: 4px !important;

        .MuiMenuItem-root {
            color: $brand-dark !important;
            font-size: 14px !important;
            min-height: 36px !important;
            padding: 8px 16px !important;

            &:hover {
                background-color: rgba($brand-light-blue, 0.08) !important;
            }

            .MuiListItemIcon-root {
                color: $brand-dark !important;
                min-width: 36px !important;

                .MuiSvgIcon-root,
                svg {
                    font-size: 1.125rem !important;
                    color: $brand-dark !important;
                    fill: $brand-dark !important;
                }
            }

            .MuiListItemText-root {
                .MuiListItemText-primary {
                    font-size: 14px !important;
                    color: $brand-dark !important;
                    font-weight: 400 !important;
                }
            }

            // Danger/delete styling
            &.danger-item {
                color: #d32f2f !important;

                &:hover {
                    background-color: rgba(211, 47, 47, 0.04) !important;
                }

                .MuiListItemIcon-root {
                    color: #d32f2f !important;

                    .MuiSvgIcon-root,
                    svg {
                        color: #d32f2f !important;
                        fill: #d32f2f !important;
                    }
                }

                .MuiListItemText-primary {
                    color: #d32f2f !important;
                }
            }
        }

        .MuiDivider-root {
            border-color: rgba($brand-light-blue, 0.2) !important;
            margin: 4px 0 !important;
        }
    }
}