/* Investment Portfolio Styles */
:root {
    --ipm-primary: #5737FB;
    --ipm-white: #FFFFFF;
    --ipm-black: #000000;
    --ipm-dark: #333333;
    --ipm-light-bg: #F5F5F7;
    --ipm-border: rgba(87, 55, 251, 0.2);
    --ipm-shadow: rgba(87, 55, 251, 0.15);
}

.ipm-portfolio-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ipm-companies-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-top: 30px;
}

/* Company Cards */
.ipm-company-card {
    background: var(--ipm-white);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid var(--ipm-border);
}

.ipm-company-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px var(--ipm-shadow);
}

/* Logo */
.ipm-logo-container {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    border-radius: 12px;
    /* Thay đổi từ 50% thành 12px để có góc vuông bo tròn */
    overflow: hidden;
    background: var(--ipm-light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--ipm-border);
}

.ipm-logo {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Giữ tỷ lệ ảnh, không bị méo */
    padding: 12px; /* Giảm padding để logo hiển thị lớn hơn */
}

.ipm-logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ipm-primary);
    color: var(--ipm-white);
    font-size: 24px;
    font-weight: bold;
}

/* Company Info */
.ipm-company-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--ipm-black);
}

.ipm-company-meta {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ipm-industry, .ipm-founded-year {
    background: rgba(87, 55, 251, 0.1);
    color: var(--ipm-primary);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.ipm-founded-year {
    background: rgba(87, 55, 251, 0.05);
}

/* Overlay */
.ipm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(87, 55, 251, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.ipm-company-card:hover .ipm-overlay {
    opacity: 1;
}

.ipm-view-btn {
    background: var(--ipm-white);
    color: var(--ipm-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    transform: translateY(10px);
}

.ipm-company-card:hover .ipm-view-btn {
    transform: translateY(0);
}

.ipm-view-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255,255,255,0.2);
}

/* Popup Styles */
.ipm-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.ipm-popup.active {
    display: block;
}

.ipm-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.ipm-popup-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: var(--ipm-white);
    transform: translateX(100%);
    transition: transform 0.4s ease;
    overflow-y: auto;
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
}

.ipm-popup.active .ipm-popup-content {
    transform: translateX(0);
}

/* Popup Header */
.ipm-popup-header {
    padding: 20px;
    border-bottom: 1px solid var(--ipm-border);
    position: relative;
}

.ipm-close-popup {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: var(--ipm-light-bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ipm-close-popup:hover {
    background: var(--ipm-primary);
    color: var(--ipm-white);
}

/* Popup Body */
.ipm-popup-body {
    padding: 25px;
}

.imp-popup-logo {
    width: 150px;
    height: 150px;
    margin: 0 auto 25px;
    border-radius: 15px;
    overflow: hidden;
    background: var(--ipm-light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--ipm-border);
}

.ipm-popup-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px; /* Giảm từ 15px xuống 12px */
}

.ipm-popup-body h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--ipm-black);
}

/* Details */
.ipm-popup-details {
    background: var(--ipm-light-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.ipm-detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    align-items: center;
}

.ipm-detail-row:last-child {
    margin-bottom: 0;
}

.ipm-label {
    font-weight: 600;
    color: var(--ipm-dark);
    font-size: 14px;
}

.ipm-value {
    font-weight: 500;
    color: var(--ipm-primary);
    background: var(--ipm-white);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid var(--ipm-border);
}

/* Description */
.ipm-popup-description {
    margin-bottom: 30px;
}

.ipm-popup-description h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--ipm-black);
}

.ipm-popup-description p {
    line-height: 1.7;
    color: var(--ipm-dark);
    font-size: 14px;
}

/* Actions */
.ipm-popup-actions {
    text-align: center;
}

.ipm-website-btn {
    display: inline-block;
    background: var(--ipm-primary);
    color: var(--ipm-white);
    text-decoration: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 15px;
    box-shadow: 0 5px 15px var(--ipm-shadow);
}

.ipm-website-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--ipm-shadow);
    color: var(--ipm-white);
    text-decoration: none;
}

/* No Companies */
.ipm-no-companies {
    text-align: center;
    padding: 40px;
    background: var(--ipm-light-bg);
    border-radius: 12px;
    color: var(--ipm-dark);
    font-size: 16px;
}

/* Responsive */
@media (max-width: 900px) {
    .ipm-companies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Điều chỉnh logo cho tablet */
    .ipm-logo-container {
        width: 120px;
        height: 120px;
    }

    .ipm-popup-content {
        width: 100%;
    }

    .ipm-popup-body {
        padding: 20px;
    }
}

@media (max-width: 600px) {
    .ipm-companies-grid {
        grid-template-columns: 1fr;
    }

    .ipm-company-card {
        padding: 20px;
    }

    /* Điều chỉnh logo cho mobile */
    .ipm-logo-container {
        width: 100px;
        height: 100px;
    }

    .ipm-logo-placeholder {
        font-size: 28px;
    }

    .ipm-popup-logo {
        width: 120px;
        height: 120px;
    }
}