/* Bố cục chính */
.app-showcase-container {
    width: 100%;
    margin: 60px 0;
    /* Loại bỏ overflow: hidden để không bị cắt xén shadow và phone */
    font-family: inherit;
}

.app-showcase-grid {
    display: grid;
    grid-template-columns: 1fr minmax(360px, 450px) 1fr; /* Tăng không gian cột giữa để chứa đt to hơn */
    gap: 30px;
    align-items: center;
    max-width: 1300px;
    margin: 0 auto;
}

/* Các tuỳ chọn (Tính năng) */
.app-feature-item {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    cursor: pointer;
    opacity: 1; /* Tất cả đều hiển thị rõ 100%, không bị mờ */
    transition: all 0.4s ease;
    position: relative;
}

.app-feature-item:hover,
.app-feature-item.active {
    opacity: 1;
}

/* Format trái/phải (Sửa lại cho Text nằm sát điện thoại, Icon nằm sát ra ngoài như demo thật) */
.app-features-left .app-feature-item {
    flex-direction: row;        /* Icon trái, Text phải */
    text-align: right;          /* Chữ canh lề phải áp vào phone */
}

.app-features-right .app-feature-item {
    flex-direction: row-reverse; /* Icon phải, Text trái */
    text-align: left;           /* Chữ canh lề trái áp vào phone */
}

/* Container chứa text nhường không gian cho đường kẻ */
.app-feature-content {
    flex-grow: 1;
    position: relative;
}

/* Đảm bảo Layer tính năng cao hơn Phone để chấm đỏ đè lên mặt phone được */
.app-features-left, .app-features-right {
    position: relative;
    z-index: 30; 
}

/* Icon */
.app-feature-icon {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 1px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    background-color: transparent;
    transition: all 0.3s;
}

/* Các Animation dùng chung */
@keyframes icon-shake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-8deg) scale(1.05); }
    50% { transform: rotate(8deg) scale(1.05); }
    75% { transform: rotate(-8deg) scale(1.05); }
}

@keyframes icon-breathe {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0.1); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255,255,255,0); }
}

/* Hoạt ảnh nhịp tim (Heartbeat pulse) viền đỏ mờ (Glow) lót ngoài, toả sóng như chấm đỏ */
@keyframes icon-heartbeat {
    0% {
        transform: scale(1);
        box-shadow: 0 0 8px 2px rgba(var(--ass-accent-rgb, 216, 43, 74), 0.8), 0 0 0 0 rgba(var(--ass-accent-rgb, 216, 43, 74), 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 15px 4px rgba(var(--ass-accent-rgb, 216, 43, 74), 0.9), 0 0 0 15px rgba(var(--ass-accent-rgb, 216, 43, 74), 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 8px 2px rgba(var(--ass-accent-rgb, 216, 43, 74), 0.8), 0 0 0 0 rgba(var(--ass-accent-rgb, 216, 43, 74), 0);
    }
}

@keyframes dot-pulse {
    0% { box-shadow: 0 0 0 0 rgba(var(--ass-accent-rgb, 216, 43, 74), 0.6); }
    70% { box-shadow: 0 0 0 14px rgba(var(--ass-accent-rgb, 216, 43, 74), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--ass-accent-rgb, 216, 43, 74), 0); }
}

/* Tương tác di chuột sẽ Lắc nhẹ Icon */
.app-feature-item:hover .app-feature-icon {
    animation: icon-shake 0.4s ease-in-out;
}

/* Trạng thái đường chọn (Active) - Viền trong trắng, viền ngoài đỏ đập nhịp tim */
.app-feature-item.active .app-feature-icon {
    border-color: #ffffff !important; /* Viền trong màu trắng */
    color: #ffffff !important; /* Icon sáng trắng */
    background: transparent;
    animation: icon-heartbeat 1.8s infinite ease-in-out;
}

/* --- Xoá CSS đường line và chấm đỏ cũ ở icon, tái tạo lại ở thẻ Item --- */

/* Đường gạch ngang ở ngay dưới tiêu đề */
.app-feature-item::after {
    content: '';
    position: absolute;
    top: 32px; /* Gạch dưới tiêu đề h4 */
    height: 1px;
    background: currentColor;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: -1;
}

/* Dấu chấm đỏ (với vòng Halo) bám ở đích đến của đường kẻ */
.app-feature-item::before {
    content: '';
    position: absolute;
    top: 32px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--ass-accent-color, #d82b4a); /* Màu nhấn đô hoặc màu tuỳ chọn */
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(var(--ass-accent-rgb, 216, 43, 74), 0.6); /* Bắt đầu để pulse */
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 40; /* Đè hẳn lên viền điện thoại */
}

/* Active Line Vị trí Trái - Bắt đầu từ rìa icon, qua text, đâm thẳng vào phone */
.app-features-left .app-feature-item::after {
    left: 85px; /* Xuất phát từ sau icon */
    right: 100%; /* Ban đầu dài 0 */
}
.app-features-left .app-feature-item.active::after {
    right: -25px; /* Giãn ra tới chạm vào phone */
    opacity: 0.3;
}
.app-features-left .app-feature-item::before {
    right: -35px; /* Chấm đỏ đậu lên mặt glass viền phone */
}

/* Active Line Vị trí Phải */
.app-features-right .app-feature-item::after {
    right: 85px; 
    left: 100%;
}
.app-features-right .app-feature-item.active::after {
    left: -25px;
    opacity: 0.3;
}
.app-features-right .app-feature-item::before {
    left: -35px;
}

.app-feature-item.active::before {
    opacity: 1;
    animation: dot-pulse 1.5s infinite; /* Vòng sáng lan toả báo hiệu nút này đang bật */
}

/* Chữ */
.app-feature-title {
    margin: 5px 0 15px 0; /* Tạo khe chèn đường gạch ngang */
    font-size: 19px; /* To hơn cũ */
    text-transform: uppercase;
    font-weight: 800; /* Dày, khỏe hơn */
    letter-spacing: 0.5px;
    color: #ffffff; /* Trắng sáng */
    text-shadow: 0 1px 3px rgba(0,0,0,0.3); /* Tạo bóng nhẹ chữ nổi lên */
}

.app-feature-desc {
    font-size: 15px; /* To hơn xíu */
    opacity: 0.95; /* Sáng rõ, không bị mờ đục */
    line-height: 1.6;
    color: #f8f8f8; /* Gần như trắng tinh */
}

/* Phần điện thoại trung tâm bằng CSS (Không dùng ảnh image) */
.app-phone-center {
    position: relative;
    display: flex;
    justify-content: center;
    z-index: 10;
}

/* Kiểu 1: Người dùng chèn ảnh mockup bằng shortcode */
.ass-phone-mockup {
    max-width: 100%;
    height: auto;
    position: relative;
    z-index: 2; /* Nổi lên trên */
    pointer-events: none;
}
.app-phone-screen.image-mode {
    position: absolute;
    top: 3%;
    bottom: 3%;
    left: 6%;
    right: 6%;
    z-index: 1; 
    border-radius: 20px;
    overflow: hidden;
    background-color: #f5f5f5;
}

/* Kiểu 2: Thiết bị điện thoại Pure CSS mặc định (iPhone X Edition) */
.app-device-iphone {
    position: relative;
    width: 320px; /* Phóng to đt */
    height: 670px;
    background-color: #1a1a1a; 
    border-radius: 50px; /* Bo tròn góc chuẩn iPhone */
    margin: 30px auto; /* Thêm margin chống bị cắt 2 đầu đỉnh/đáy do shadow */
    box-shadow: 
        inset 0 0 2px 2px rgba(255,255,255,0.05), /* Bóng kính màn */
        0px 0px 0px 12px #1f1f1f, /* Viền nhựa đen */
        0px 0px 0px 14px #333, /* Khung kim loại viền ngoài */
        0px 25px 50px rgba(0,0,0,0.5); /* Đổ bóng phía sau phone */
}

/* Lỗ khuyết trên màn hình (Notch - Tai thỏ) */
.device-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    background-color: #1a1a1a;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 5;
}

/* Vẽ thêm loa ống nghe và camera trước cho Notch */
.device-notch::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 46px;
    height: 6px;
    background-color: #333;
    border-radius: 4px;
}
.device-notch::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 70%;
    width: 8px;
    height: 8px;
    background-color: #2a2a4a;
    border-radius: 50%;
}

/* Nút nguồn và âm lượng bên hông máy (Sát viền ra bên ngoài 15px vì viền dày 14px) */
.device-buttons {
    position: absolute;
    right: -15px; 
    top: 160px;
    width: 3px;
    height: 55px;
    background: #444; 
    border-radius: 0 4px 4px 0;
}
.device-ring {
    position: absolute;
    left: -15px; 
    top: 120px;
    width: 3px;
    height: 35px;
    background: #444;
    border-radius: 4px 0 0 4px;
    box-shadow: 0 55px 0 #444; /* Nút Volume Down */
}
.device-ring::before {
    content:'';
    position: absolute;
    top: -50px; /* Nút gạt rung */
    left: 0;
    width: 3px;
    height: 25px;
    background: #444;
    border-radius: 4px 0 0 4px;
}

/* Màn hình (Khắc phục hoàn toàn lỗi tràn ảnh góc máy) */
.app-phone-screen.css-mode {
    position: absolute;
    top: 6px; 
    bottom: 6px;
    left: 6px;
    right: 6px;
    z-index: 2; /* Nằm dưới Notch */
    border-radius: 45px; /* Bo góc hoàn hảo trùng với khung máy */
    overflow: hidden; /* Cắt đứt các ảnh tràn viền */
    background-color: #fff;
}

/* Nếu màn hình nào có .css-mode thì tấm nền slide cũng cắt sát viền */
.app-screen-slide {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.app-screen-slide.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .app-showcase-grid {
        grid-template-columns: 1fr;
    }
    
    .app-phone-center {
        order: -1;
        margin-bottom: 50px;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .app-features-left .app-feature-item,
    .app-features-right .app-feature-item {
        flex-direction: row;
        text-align: left;
    }
    
    /* Ẩn đường kẻ nối ngang trên màn hình dt quá bé để tránh chọc vào màn hình layout dọc */
    .app-feature-icon::before,
    .app-feature-icon::after {
        display: none !important;
    }
}
