﻿/* ==================== RESET ==================== */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow-y: auto; /* ✅ Cho phép Safari cuộn toàn trang */
}

/* ==================== OVERLAY ==================== */
.modal-overlay {
    background: rgba(243, 246, 249, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    height: calc(var(--vh, 1vh) * 100);
    min-height: calc(var(--vh, 1vh) * 100);
    overflow-y: auto;
}

/* ==================== POPUP ==================== */
.appointment-popup {
    background: #fff;
    border-radius: 16px;
    max-width: 1200px;
    width: 95%;
    height: auto; /* cho nội dung tự co dãn */
    max-height: 90vh; /* không vượt quá 90% viewport */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin: auto;
    display: flex;
    flex-direction: row; /* desktop */
    flex-wrap: wrap; /* cho tablet */
}

/* ==================== FORM ==================== */
.form-section {
    flex: 1 1 60%;
    padding: 10px 15px;
    min-width: 300px;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: 90vh;
    -webkit-overflow-scrolling: touch;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem; /* 👈 nhỏ gọn hơn text input */
    color: #0077b6; /* 👈 xanh nước biển đậm */
    margin-bottom: 4px;
}

/* ==================== NGĂN ZOOM TRÊN IOS ==================== */
input,
select,
textarea,
button {
    font-size: 16px !important; /* ✅ iOS yêu cầu >=16px để không zoom */
    -webkit-text-size-adjust: 100%;
}

/* ==================== INPUTS ==================== */
.form-control {
    display: block;
    width: 100%;
    padding: 5px 12px;
    font-size: 16px !important;
    border: 1px solid #ced4da;
    border-radius: 0.75rem;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

input.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 4px rgba(0, 123, 255, 0.3);
    outline: none;
}

/* ==================== IMAGE ==================== */
.image-section {
    flex: 1 1 40%;
    background: url('../lib/image/AnhBV.png') center center no-repeat;
    background-size: cover;
    min-height: 400px;
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* ==================== HEADER ==================== */
.header-title {
    font-size: 22px;
    font-weight: bold;
    color: #0077a3;
    text-align: center;
    text-transform: uppercase;
}

/* ==================== BUTTON ==================== */
.btn {
    display: inline-block;
    font-weight: 500;
    color: #fff;
    background-color: #4ec7a7;
    border: 1px solid #007bff;
    padding: 0.5rem 0.75rem;
    font-size: 16px;
    line-height: 1.5;
    border-radius: 0.65rem;
    transition: all 0.15s ease-in-out;
    margin-top: 1rem;
    width: 100%;
    cursor: pointer;
}

    .btn:hover {
        transform: translateY(-2px);
        background-color: #0069d9;
        border-color: #0062cc;
    }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .appointment-popup {
        flex-direction: column;
        max-width: 95%;
        height: auto;
    }

    .image-section {
        order: -1;
        flex: 1 1 100%;
        width: 100%;
        min-height: 180px;
        border-bottom: 4px solid #f0f0f0;
    }

    .form-section {
        padding: 15px;
        max-height: none;
        overflow-y: visible;
    }

    .header-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 18px;
    }

    .form-control, .btn {
        font-size: 16px !important;
        padding: 0.4rem 0.6rem;
    }
}

/* ==================== GHI CHÚ LỖI (INLINE NOTE) ==================== */
.form-group {
    position: relative;
}

/* Hộp ghi chú lỗi */
.inline-note {
    position: absolute;
    bottom: -22px; /* canh sát dưới input */
    left: 4px; /* lệch nhẹ cho cân với padding của input */
    width: calc(100% - 8px);
    background: #ffffff; /* nền trắng nhẹ, đồng bộ form */
    border: 1px solid #ffbfbf; /* viền hồng nhạt */
    color: #b30000; /* chữ đỏ trầm */
    font-size: 0.78rem;
    border-radius: 6px;
    padding: 4px 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-3px);
    animation: fadeIn 0.25s ease-in-out forwards;
}

label.required::after {
    content: " *";
    color: red;
    font-weight: 600;
}
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #0077a3;
    margin: 7px 0 7px 0;
    text-transform: uppercase;
    border-left: 4px solid #00a8e8;
    padding-left: 8px;
}

/* ==== Chọn khung giờ nhỏ gọn giống form gốc ==== */
.time-select {
    display: flex;
    justify-content: space-between;
}

.time-option {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 12px;
    text-align: center;
    padding: 0px 10px;
    font-weight: 600;
    font-size: 12px;
    background-color: #fff;
    cursor: pointer;
    transition: 0.2s;
    color: #333;
}

    .time-option small {
        font-weight: normal;
        color: #666;
    }

    .time-option.active {
        background: linear-gradient(90deg, #6675f7, #7b62f9);
        color: #fff;
        border-color: #6675f7;
    }

        .time-option.active small {
            color: #f0f0f0;
        }

    .time-option:hover {
        border-color: #7b62f9;
    }

input[type="date"], input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    height: 38px;
    box-sizing: border-box;
}


/* Hiệu ứng fade-in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hiệu ứng fade-out */
.inline-note.fade-out {
    animation: fadeOut 0.4s ease-in-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-4px);
    }
}

/* ==================== INPUT BỊ LỖI ==================== */
.is-invalid {
    border-color: #ff4d4d !important;
    box-shadow: 0 0 4px rgba(255, 77, 77, 0.4);
}


/* ==================== SAFARI FIX ==================== */
@supports (-webkit-touch-callout: none) {
    .modal-overlay {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
}

/* ==================== DESKTOP OPTIMIZATION ==================== */
@media (min-width: 1200px) {
    .appointment-popup {
        height: calc(var(--vh, 1vh) * 93);
    }

    .form-section {
        padding: 10px 15px;
        font-size: 1rem;
    }
}

@media (max-width: 1199px) and (min-width: 992px) {
    .appointment-popup {
        height: calc(var(--vh, 1vh) * 88);
    }

    .form-section {
        padding: 10px 15px;
    }
}

@media (max-width: 992px) {
    .appointment-popup {
        flex-direction: column; /* tablet/mobile */
        max-height: none;
    }
}

/* ==================== CĂN LỀ PHẢI CHO INPUT DATE TRÊN MOBILE ==================== */
@media (max-width: 768px) {
    input[type="date"].form-control {
        padding-right: 0.5rem !important; /* giảm đệm phải */
        box-sizing: border-box;
    }

    /* Thu nhỏ icon lịch để không tràn */
    input[type="date"]::-webkit-calendar-picker-indicator {
        width: 18px;
        height: 18px;
        margin-right: 4px;
    }

    .image-section {
        order: -1;
        width: 100%;
        min-height: 185px; /* Có thể chỉnh 220–320 tuỳ ảnh */
        border-radius: 0;
        border-bottom: 4px solid #f0f0f0;
        /* Ảnh mobile */
        background: url('../lib/image/anh_mobile.jpg') no-repeat center right; /* 👈 ưu tiên hiển thị bên phải */
        background-size: cover; /* 👈 full vùng hiển thị, không méo */
        background-color: #fff;
        /* Giúp Safari và iOS không cắt chiều cao */
        height: auto;
        -webkit-background-size: cover;
    }

    



}

