/* =========================================
   MY PORTFOLIO TABS - FRONTEND STYLES (FINAL V9 - JS CALC FIX)
========================================= */

.my-portfolio-container {
    width: 100%;
    /* Padding bottom đủ lớn để không bị cắt bóng đổ */
    padding: 60px 10px 80px 10px; 
    margin-bottom: 50px;
    position: relative;
    box-sizing: border-box;
    display: block;
    overflow: visible !important;
    
    --mp-title-size: 22px;
    --mp-desc-size: 16px;
    --mp-title-color: #111;
    --mp-hover-color: #2271b1;
}

.my-portfolio-container * { box-sizing: border-box; }

/* --- CARD ITEM --- */
.my-portfolio-card {
    position: relative;
    display: block;
    width: 100%;
    z-index: 1;
    perspective: 1000px;
    background: #fff;
    transition: all 0.3s ease;
    height: auto; 
}

.my-portfolio-card:hover { z-index: 999; }

/* --- KHUNG ẢNH --- */
.mp-image {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 25px;
    background: #f0f0f0;
    box-shadow: 0 15px 35px -10px rgba(0,0,0,0.08);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateZ(0);
    width: 100%;
}

.mp-image-link { display: block; position: relative; width: 100%; height: 100%; cursor: pointer; }

.mp-image img { 
    display: block; 
    width: 100%; 
    height: auto; 
    object-fit: cover; 
    border-radius: 24px; 
    transition: transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); 
}

/* --- NÚT BẤM NỔI --- */
.mp-floating-btn {
    position: absolute; bottom: 25px; right: 25px; z-index: 10;
    background: #ffffff; color: #111;
    padding: 12px 24px 12px 28px; border-radius: 50px;
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
    transition: all 0.4s ease; transform: translateY(0);
}
.mp-btn-icon { font-size: 18px; width: 18px; height: 18px; transition: transform 0.3s ease; }

/* --- HOVER EFFECTS --- */
.my-portfolio-card:hover .mp-image { box-shadow: 0 30px 60px -15px rgba(0,0,0,0.2); transform: translateY(-10px); }
.my-portfolio-card:hover .mp-image img { transform: scale(1.08); }
.my-portfolio-card:hover .mp-floating-btn { background: #111; color: #fff; padding-right: 20px; }
.my-portfolio-card:hover .mp-btn-icon { transform: translateX(5px); }

/* --- TEXT CONTENT --- */
.mp-content { padding: 5px 10px; }

.mp-title { 
    font-size: var(--mp-title-size); 
    color: var(--mp-title-color); 
    font-weight: 800; 
    margin: 0 0 15px 0; 
    line-height: 1.3; 
    transition: color 0.3s ease; 
}
.my-portfolio-card:hover .mp-title { color: var(--mp-hover-color); }

.mp-desc { 
    font-size: var(--mp-desc-size); 
    color: #666; 
    line-height: 1.7; 
    font-weight: 400; 
}
.mp-desc p:last-child { margin-bottom: 0; }

/* =========================================================
   RESPONSIVE & LAYOUT LOGIC
========================================================= */

/* 1. DESKTOP (Min-width 768px) */
@media (min-width: 768px) {
    .my-portfolio-wrapper {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: flex-start;
        gap: 80px; 
        width: 100% !important;
    }
    
    .mp-column {
        flex: 1; 
        display: flex;
        flex-direction: column;
        gap: 80px; 
        width: 50%;
        min-width: 0;
    }
    
    .mp-column-right { margin-top: 120px; }
    
    .my-portfolio-item { width: 100% !important; margin: 0 !important; }
    .swiper-pagination, .mp-nav-btn { display: none !important; }
    
    .my-portfolio-card { background: transparent; box-shadow: none; border-radius: 0; overflow: visible; display: block; }
    .mp-image { margin-bottom: 25px !important; border-radius: 24px !important; }
    .mp-image img { border-radius: 24px !important; }
    .mp-content { display: block; width: 100%; padding: 5px 10px; }
}

/* 2. MOBILE (Max-width 767px) */
@media (max-width: 767px) {
    .my-portfolio-container { 
        padding: 40px 0 80px 0; 
        overflow: visible !important; 
    }
    
    .my-portfolio-wrapper {
        display: flex;
        align-items: flex-start; /* Để align-items flex-start để JS tự set height */
        width: 100%;
        height: auto;
        box-sizing: content-box;
    }

    .my-portfolio-item.swiper-slide { 
        width: 85% !important; 
        height: auto; 
        display: flex;
        flex-direction: column;
        padding: 15px 5px 30px 5px !important; 
        opacity: 1; 
        transition: opacity 0.3s ease; 
        overflow: visible !important;
    }

    /* Card Mobile */
    .my-portfolio-card {
        background: #fff;
        border-radius: 20px;
        overflow: visible; 
        box-shadow: 0 10px 30px rgba(0,0,0,0.08);
        display: flex !important;
        flex-direction: column !important;
        
        /* FIX QUAN TRỌNG: Không set 100% ở đây nữa, để JS set px cứng */
        height: auto; 
    }

    .mp-image {
        margin-bottom: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: none !important;
        flex-shrink: 0 !important; 
        width: 100%;
        overflow: hidden; 
    }
    .mp-image img { border-radius: 20px 20px 0 0 !important; }
    
    .mp-floating-btn { padding: 8px 16px; bottom: 15px; right: 15px; font-size: 11px !important; gap: 6px; }
    .mp-btn-icon { font-size: 14px !important; width: 14px !important; height: 14px !important; }

    /* Nội dung Mobile */
    .mp-content {
        /* Tăng padding bottom để đảm bảo chữ không bị sát mép dưới */
        padding: 25px 20px 40px 20px !important;
        
        flex: 1 1 auto !important; 
        display: flex;
        flex-direction: column;
        overflow: visible !important; 
        height: auto;
    }
    
    .mp-title {
        font-size: 18px !important; 
        margin-bottom: 12px;
        flex-shrink: 0;
        /* Giới hạn dòng title nếu muốn, hoặc bỏ clamp đi để hiện hết */
        display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; 
        height: auto;
    }
    
    .mp-desc { 
        font-size: 15px !important; 
        line-height: 1.6; 
        color: #555;
        flex: 1 1 auto;
        display: block;
    }

    .swiper-pagination { display: none !important; }
    
    /* --- FIX STYLE CHO NÚT NEXT/PREV (GIỮ NGUYÊN FIX CŨ) --- */
    .mp-nav-btn {
        position: absolute; top: 50%; transform: translateY(-50%);
        width: 44px !important; height: 44px !important;
        background-color: #ffffff; border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15); color: #111;
        z-index: 50; cursor: pointer;
        display: flex !important; align-items: center; justify-content: center;
        transition: all 0.2s ease;
        font-size: 0 !important;
        line-height: 0 !important;
    }
    
    .mp-nav-btn:active { transform: translateY(-50%) scale(0.95); }
    
    .mp-nav-btn::after {
        content: '' !important; 
        display: block; width: 10px; height: 10px;
        border-top: 2px solid #222; border-right: 2px solid #222;
        border-bottom: none !important; border-left: none !important;
        background: transparent !important;
        font-family: inherit !important; font-size: 0 !important;
        box-sizing: content-box !important;
    }
    
    .swiper-button-prev { left: 0px !important; }
    .swiper-button-prev::after { transform: rotate(-135deg); margin-left: 4px; }
    .swiper-button-next { right: 0px !important; }
    .swiper-button-next::after { transform: rotate(45deg); margin-left: -4px; }
    .swiper-button-disabled { opacity: 0 !important; pointer-events: none; }
}