/* Thiết lập cơ bản cho mobile */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Bắt đầu từ trên xuống */
    min-height: 100vh;
}

.photobooth-container {
    width: 100%;
    max-width: 600px; /* Giới hạn chiều rộng cho màn hình lớn hơn */
    padding: 10px;
    box-sizing: border-box;
}

/* --- CAMERA LIVE VIEW & FIX LẬT ẢNH --- */
.camera-stage {
    position: relative;
    width: 100%;
    padding-top: 75%; /* Tỷ lệ 4:3 */
    background-color: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#videoElement {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: filter 0.3s; /* Hiệu ứng chuyển đổi filter mượt mà */
}

/* FIX LIVE VIEW: Lật ngang cho camera trước (user-mode) */
#videoElement.user-mode {
    transform: scaleX(-1);
}

/* --- ĐẾM NGƯỢC --- */
.countdown-timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    font-weight: bold;
    color: white;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 20px 40px;
    border-radius: 10px;
    z-index: 20;
    display: none; /* Mặc định ẩn */
}

/* --- KHU VỰC CHỌN VÀ NÚT --- */
.selection-area {
    margin-top: 20px;
    padding: 10px 0;
    border-top: 1px solid #ddd;
}

.selection-area h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.selection-list {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto; /* Cho phép cuộn ngang trên mobile */
    padding-bottom: 10px;
}

.select-btn {
    flex-shrink: 0;
    padding: 8px 15px;
    border: 2px solid #ccc;
    background-color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.select-btn.active {
    border-color: #007bff;
    background-color: #e6f0ff;
    color: #007bff;
}

.controls {
    display: flex;
    justify-content: space-around;
    padding: 20px 0;
}

.main-button {
    background-color: #007bff;
    color: white;
    flex-grow: 1;
    margin-right: 10px;
    padding: 15px 25px;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
}

.secondary-button {
    background-color: #6c757d;
    color: white;
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 50%;
    font-size: 20px;
    flex-shrink: 0;
    border: none;
}

/* --- CSS FILTERS (CHO LIVE VIEW) --- */
#videoElement.filter-grayscale { filter: grayscale(100%); }
#videoElement.filter-sepia { filter: sepia(100%); }
#videoElement.filter-negate { filter: invert(100%); }
#videoElement.filter-contrast { filter: contrast(200%); }
#videoElement.filter-blur { filter: blur(5px); }
#videoElement.filter-vintage { filter: sepia(60%) saturate(150%) brightness(80%); }
#videoElement.filter-saturation { filter: saturate(300%); }

/* --- KHU VỰC KẾT QUẢ --- */
.result-area {
    text-align: center;
    padding: 15px;
    background-color: white;
    border-radius: 15px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#finalImage {
    max-width: 100%;
    height: auto;
    border: 5px solid #ccc;
    border-radius: 10px;
    margin: 15px auto;
}