:root {
    /* Màu sắc chung của trang */
    --primary-color: #025B50;
    --primary-hover-color: #faaf40;
    --secondary-color: #6c757d;
    --secondary-hover-color: #5a6268;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --card-bg-color: #ffffff;
    --border-color: #dee2e6;
    --error-color: #dc3545;
    --success-color: #28a745;

    /* Màu sắc và thuộc tính cho hiệu ứng ánh sáng chạy quanh border */
    --glow-color: #faaf40; /* Màu xanh sáng */
    --glow-secondary-color: #025B50; /* Màu xanh đậm hơn */
    --glow-width: 30px; /* Độ rộng của vệt sáng */
    --glow-speed: 2s; /* Tốc độ xoay */
    --glow-blur: 15px; /* Độ mờ để tạo hiệu ứng phát sáng */
}

body {
    /* font-family: 'Josefin Sans', sans-serif; Sử dụng font Josefin Sans */
    margin: 0;
    padding: 20px;
    text-align: center;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex; /* Dùng flexbox để căn chỉnh footer */
    flex-direction: column;
    min-height: 100vh; /* Đảm bảo body chiếm toàn bộ chiều cao màn hình */
}

/* Đảm bảo nội dung chính đẩy footer xuống cuối trang */
.container {
    background-color: var(--card-bg-color);
    margin: 50px auto;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;

    position: relative;
    z-index: 1;
    overflow: hidden; /* Quan trọng để cắt bớt hiệu ứng */
    border: none; /* Bỏ border mặc định để hiệu ứng là border */

    flex-grow: 1; /* Cho phép container giãn nở để đẩy footer xuống */
}

/* Pseudo-element cho hiệu ứng ánh sáng chạy quanh border */
.container::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    width: calc(100% + 40px); /* Rộng hơn container 40px */
    height: calc(100% + 40px); /* Cao hơn container 40px */
    border-radius: 17px; /* Hơi lớn hơn border-radius của container */
    
    /* Tạo background bằng conic-gradient để vệt sáng xoay tròn */
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        transparent 40%, /* Khoảng trong suốt ban đầu */
        var(--glow-color) 50%, /* Bắt đầu vệt sáng */
        var(--glow-secondary-color) 60%, /* Kết thúc vệt sáng */
        transparent 70%,
        transparent 100%
    );
    
    /* Áp dụng animation xoay */
    animation: rotateBorderGlow var(--glow-speed) linear infinite;
    
    z-index: -1; /* Đặt dưới container */
    filter: blur(var(--glow-blur)); /* Làm mờ để tạo hiệu ứng phát sáng */
    opacity: 0.9; /* Điều chỉnh độ mờ */
    pointer-events: none; /* Đảm bảo không chặn sự kiện click vào container */
}

/* Keyframes cho hiệu ứng xoay tròn của ánh sáng */
@keyframes rotateBorderGlow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Thêm một lớp nền mỏng cho nội dung container để không bị trong suốt hoàn toàn */
.container::after {
    content: '';
    position: absolute;
    inset: 2px; /* Dịch vào 2px so với viền của container */
    background-color: var(--card-bg-color); /* Màu nền của container */
    border-radius: 10px; /* Hơi nhỏ hơn container để ánh sáng đi vòng quanh */
    z-index: 0; /* Nằm trên ::before nhưng dưới nội dung thật của container */
    pointer-events: none; /* Không chặn sự kiện */
}

/* Thiết lập font cho toàn bộ body và các thành phần văn bản */
body, h1, p, input, button, #result-area, .error-message, .loading-indicator, .container-footer {
    font-family: 'Josefin Sans', sans-serif;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 2.2em;
    font-weight: 700;
    position: relative; /* Quan trọng: cần position để z-index có tác dụng */
    z-index: 2; /* Đảm bảo nằm trên lớp ::after */
}

p {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: var(--secondary-color);
    position: relative; /* Quan trọng: cần position để z-index có tác dụng */
    z-index: 2; /* Đảm bảo nằm trên lớp ::after */
}

img {
    position: relative; /* Cần position để z-index có tác dụng */
    z-index: 2; /* Đảm bảo logo nằm trên lớp ::after */
    margin-bottom: 0px; /* Khoảng cách dưới logo */
}

.input-group {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 25px;
    flex-wrap: wrap;
    position: relative; /* Cần position để z-index có tác dụng */
    z-index: 2;
}

input {
    flex-grow: 1;
    padding: 15px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1em;
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    max-width: 400px;
    margin-bottom: 15px;
    z-index: 2;
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.button-group {
    display: flex;
    justify-content: center;
    align-content: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    position: relative; /* Cần position để z-index có tác dụng */
    z-index: 2;
}

button {
    padding: 15px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.2);
    z-index: 2;
}

button:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#result-area {
    margin-top: 40px;
    width: 100%;
    min-height: 80px;
    background-color: var(--bg-color); /* Nền cho khu vực hiển thị PDF */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    font-size: 1.1em;
    transition: min-height 0.3s ease, padding 0.3s ease;
    position: relative; /* Cần position để z-index có tác dụng */
    z-index: 2;
}

#result-area embed {
    max-width: 100%;
    width: 100%;
    height: 600px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: block;
}

.error-message {
    color: var(--error-color);
    margin-top: 15px;
    font-weight: 500;
    font-size: 1.1em;
    position: relative; /* Cần position để z-index có tác dụng */
    z-index: 2;
}

.loading-indicator {
    font-style: italic;
    color: var(--secondary-color);
    position: relative; /* Cần position để z-index có tác dụng */
    z-index: 2;
}

/* CSS cho Footer */
.container-footer {
    /* width: 100%; */
    margin-top: auto; /* Đẩy footer xuống cuối trang */
    padding: 20px;
    background-color: #025B50; /* Màu nền tối cho footer */
    color: #f8f9fa; /* Màu chữ sáng */
    font-size: 0.9em;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    position: relative; /* Đảm bảo footer không bị chồng lên hiệu ứng nào */
    z-index: 1; /* Hoặc 0, tùy theo lớp nào khác */
}

.container-footer h4 {
    margin: 0;
    padding: 0;
    font-weight: 400;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        margin: 20px auto;
        padding: 25px;
    }
    h1 {
        font-size: 1.8em;
    }
    p {
        font-size: 1em;
    }
    input {
        width: 90%;
        margin-right: 0;
    }
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    button {
        width: 90%;
        padding: 12px 20px;
    }
    #result-area {
        padding: 15px;
    }
    #result-area embed {
        height: 450px;
    }
    .container::before {
        top: -15px;
        left: -15px;
        width: calc(100% + 30px);
        height: calc(100% + 30px);
    }
    .container-footer {
        padding: 15px;
        font-size: 0.8em;
    }
}