/* CA Product Manager - Frontend Styles */

.ca-pm-product-list {
    margin: 30px 0;
    width: 100%;
}

.ca-pm-category-description {
    margin-bottom: 30px;
    font-size: 16px;
    color: #666;
}

.ca-pm-products-grid {
    display: grid;
    gap: 100px;
}

.ca-pm-product-item {
    background: #fff;
    padding: 0;
    width: 100%;
}

/* Product Title */
.ca-pm-product-title {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    padding: 0;
    color: #003087;
    text-transform: uppercase;
    word-wrap: break-word;
}

/* Title and Icons Row */
.ca-pm-product-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 30px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #003087;
    width: 100%;
}

.ca-pm-product-header-left {
    flex: 1;
    min-width: 0;
}

.ca-pm-product-header-right {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
}

/* Product Icons */
.ca-pm-product-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: none;
    justify-content: flex-end;
}

.ca-pm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 150px;
    height: 75px;
    user-select: none;
}

.ca-pm-icon img {
    display: block;
    max-width: 40px;
    height: auto;
    max-height: 75px;
}

.ca-pm-icon-link {
    text-decoration: none;
    display: inline-flex;
}

.ca-pm-icon-link:hover .ca-pm-icon {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

/* Main Content Layout: Gallery + Details Side by Side */
.ca-pm-product-content {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
}

.ca-pm-product-gallery-wrapper {
    flex: 1;
    min-width: 0;
}

.ca-pm-product-details-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
}

.ca-pm-product-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Product Image Gallery */
.ca-pm-product-gallery {
    width: 100%;
}

.ca-pm-gallery-stage {
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
    border: 2px solid #e0e0e0;
}

.ca-pm-gallery-main-image {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.ca-pm-gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-start;
}

.ca-pm-gallery-thumb {
    width: 80px;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ca-pm-gallery-thumb:hover {
    border-color: #0d47a1;
    transform: scale(1.05);
}

.ca-pm-gallery-thumb.active {
    border-color: #0d47a1;
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.3);
}

.ca-pm-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Annotations */
.ca-pm-product-annotations {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-left: 4px solid #0d47a1;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* HTML Content */
.ca-pm-product-html {
    margin-top: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: end;
}

/* High specificity to override any existing table styles */
.ca-pm-product-html table.ca-pm-table {
    width: 100% !important;
    max-width: 500px !important;
    border-collapse: collapse !important;
    margin: 0 !important;
    border-spacing: 0 !important;
    table-layout: auto !important;
    line-height: 1.6 !important;
    padding: 0 !important;
    background: none !important;
}

.ca-pm-product-html table.ca-pm-table th,
.ca-pm-product-html table.ca-pm-table td {
    padding: 12px !important;
    text-align: left !important;
    border: 1px solid #e0e0e0 !important;
    font-size: 14px !important;
    overflow: visible !important;
    word-break: normal !important;
    vertical-align: middle !important;
    color: #000 !important;
    font-weight: normal !important;
    background: #fff !important;
}

.ca-pm-product-html table.ca-pm-table thead {
    background: #0d47a1 !important;
}

.ca-pm-product-html table.ca-pm-table thead th {
    background: #0d47a1 !important;
    color: #fff !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    border: 1px solid #0d47a1 !important;
}

.ca-pm-product-html table.ca-pm-table tbody tr {
    background: #fff !important;
}

.ca-pm-product-html table.ca-pm-table tbody td {
    font-size: 14px !important;
    background: #fff !important;
    font-weight: normal !important;
}

.ca-pm-product-html table.ca-pm-table tbody tr:hover td {
    background: #f5f5f5 !important;
}

/* Reset any potential inherited styles from old ds-product-tb */
.ca-pm-product-html table.ca-pm-table tbody tr:nth-child(odd) td,
.ca-pm-product-html table.ca-pm-table tbody tr:nth-child(even) td {
    background: #fff !important;
}

.ca-pm-product-html table.ca-pm-table tbody tr:hover td {
    background: #f5f5f5 !important;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    /* Mobile: Stack vertically with column direction */
    .ca-pm-product-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .ca-pm-product-gallery-wrapper,
    .ca-pm-product-details-wrapper {
        flex: 1 1 100%;
        width: 100%;
    }
    
    /* Mobile: Left-align details */
    .ca-pm-product-details-wrapper {
        justify-content: flex-start;
    }
    
    .ca-pm-product-details {
        align-items: flex-start;
    }
    
    /* Mobile: Stack title and icons vertically with column direction */
    .ca-pm-product-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .ca-pm-product-header-left,
    .ca-pm-product-header-right {
        flex: 1 1 100%;
        width: 100%;
    }
    
    /* Keep icons right-aligned even on mobile */
    .ca-pm-product-header-right {
        justify-content: flex-end;
    }
    
    .ca-pm-product-icons {
        justify-content: flex-end;
    }
    
    .ca-pm-product-title {
        font-size: 1.5rem;
    }
    
    .ca-pm-product-html table.ca-pm-table {
        font-size: 12px !important;
    }
    
    .ca-pm-product-html table.ca-pm-table th,
    .ca-pm-product-html table.ca-pm-table td {
        padding: 8px 6px !important;
        font-size: 12px !important;
    }
    
    .ca-pm-product-icons {
        gap: 8px;
    }
    
    .ca-pm-icon img {
        max-width: 32px;
    }
}

@media screen and (max-width: 480px) {
    .ca-pm-product-html table.ca-pm-table {
        font-size: 11px !important;
    }
    
    .ca-pm-product-html table.ca-pm-table th,
    .ca-pm-product-html table.ca-pm-table td {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }
    
    .ca-pm-product-annotations {
        font-size: 13px;
        padding: 12px;
    }

    .ca-pm-icon img {
        max-width: 28px;
    }
}