/* ================================== */
/* 0. BIẾN CSS & RESET */
/* ================================== */
:root {
    --primary-color: #007bff;       /* Xanh dương (dùng cho tiêu đề, menu, header) */
    --secondary-color: #1abc9c;      /* Xanh ngọc (dùng cho mục đang chọn) */
    --success-color: #28a745;       /* Xanh lá (dùng cho nút Đăng ký) */
    --error-color: #e74c3c;         /* Đỏ (dùng cho lỗi, nút Đăng xuất) */
    --background-color: #f4f7f9;    /* Nền nhẹ */
    --sidebar-bg: #34495e;          /* Nền Sidebar */
    --text-color: #333;
}

body {
    margin: 0;
    font-family: 'Arial', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

.hidden { display: none !important; }

/* ================================== */
/* 1. MÀN HÌNH ĐĂNG NHẬP */
/* ================================== */
.full-screen-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--sidebar-bg) 100%);
    color: white;
    padding: 20px;
}
.app-logo {
    font-size: 2.5em;
    margin-bottom: 30px;
}

.login-form {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 350px;
    max-width: 100%;
}

.login-form h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.login-form input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

.login-form button {
    padding: 12px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

.login-form button:hover {
    background-color: #1e7e34;
    transform: translateY(-2px);
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--text-color);
}
.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}


/* ================================== */
/* 2. BỐ CỤC CHÍNH (MAIN APP) */
/* ================================== */
.main-container {
    display: flex; 
    min-height: 100vh;
}

/* Panel Bên Trái (Sidebar) */
.left-panel {
    width: 260px; 
    flex-shrink: 0; 
    background-color: var(--sidebar-bg);
    color: white;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
}

.user-info {
    padding: 0 20px 20px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border-bottom: 1px solid #4a657c;
}

#functionList {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1; 
}

#functionList li {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid #4a657c;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

#functionList li:hover {
    background-color: #2c3e50;
}

#functionList li.selected {
    background-color: var(--secondary-color); 
    color: #fff;
    font-weight: bold;
}

.logout-btn {
    width: 260px; /* Cố định chiều rộng như sidebar */
    padding: 15px;
    background-color: var(--error-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.logout-btn:hover {
    background-color: #c0392b;
}
/* CSS cho việc canh giữa */
.center-link {
	text-align: center; /* Quan trọng: Canh giữa các phần tử inline bên trong */
	margin-top: 20px;   /* Thêm khoảng cách phía trên */
	margin-bottom: 20px; /* Thêm khoảng cách phía dưới */
}

/* CSS cho nút liên kết */
.change-password-button {
	flex: 1;
	text-align: center;
	/* Đảm bảo nó là inline-block hoặc block để dễ điều khiển */
	display: inline-block; 
	padding: 10px 15px;
	background-color: #ffc107; /* Màu vàng nổi bật */
	color: #333;
	text-decoration: none; 
	border: none;
	border-radius: 4px;
	font-weight: bold;
	cursor: pointer;
	transition: background-color 0.3s ease;
	
}
.change-password-button:hover {
	background-color: #e0a800;
}
/* Panel Bên Phải (Nội dung) */
.right-panel {
    flex-grow: 1; 
    padding: 30px;
    overflow-y: auto; 
    background-color: var(--background-color);
}

.page-title {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 25px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border-left: 5px solid var(--primary-color);
}

/* Thông báo */
.message {
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    border: 1px solid transparent;
}
.message.error { 
    background-color: #f8d7da; 
    color: #721c24; 
    border-color: #f5c6cb;
}
.message.success { 
    background-color: #d4edda; 
    color: #155724; 
    border-color: #c3e6cb;
}

/* Chi tiết tài khoản */
.account-details p {
    margin: 10px 0;
    border-bottom: 1px dashed #eee;
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.account-details strong {
    min-width: 100px;
}

/* Bảng */
#scheduleTable, #resultsTable, #registerTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
#scheduleTable th, #resultsTable th, #registerTable th, #scheduleTable td, #resultsTable td, #registerTable td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
}
#scheduleTable th, #resultsTable th, #registerTable th {
    background-color: var(--primary-color);
    color: white;
}
.schedule-filter input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.schedule-filter {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Nút đăng ký trong bảng */
#scheduleTable button {
    padding: 8px 12px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

/* ================================== */
/* 3. RESPONSIVE (CHO MOBILE) */
/* ================================== */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column; /* Chuyển bố cục chính thành dọc */
    }
    
    .left-panel {
        width: 100%;
        height: auto;
        padding: 0;
        flex-direction: row; /* Thay đổi sidebar thành thanh menu ngang */
        justify-content: space-between;
        align-items: center;
        /* Giữ cố định trên cùng màn hình */
        position: sticky; 
        top: 0;
        z-index: 100;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    .user-info {
        display: none; /* Ẩn thông tin chào mừng để tiết kiệm không gian */
    }
    
    #functionList {
        display: flex; 
        overflow-x: auto; /* Cho phép cuộn ngang menu */
        border-bottom: none; 
        flex-grow: 1;
    }

    #functionList li {
        flex-shrink: 0; /* Ngăn các mục menu co lại */
        white-space: nowrap;
        border-right: 1px solid #4a657c;
        border-bottom: none;
        padding: 12px 15px;
    }

    /* Đảm bảo nút đăng xuất nằm ngay sau menu ngang */
    .logout-btn {
        width: auto;
        position: static; /* Đặt lại thành vị trí bình thường */
        padding: 12px 15px;
        font-size: 0.9em;
        border-radius: 0;
        flex-shrink: 0;
    }
    
    .right-panel {
        padding: 20px 15px;
        padding-top: 10px; /* Giảm padding trên cùng */
    }

    /* Ẩn cột không cần thiết trên mobile */
    .desktop-only {
        display: none !important;
    }

    /* Responsive cho bảng (chuyển thành dạng thẻ/card) */
    #scheduleTable, #resultsTable, #registerTable,
    #scheduleTable thead, #resultsTable thead, #registerTable thead
    #scheduleTable tbody, #resultsTable tbody, #registerTable tbody, 
    #scheduleTable th, #resultsTable th, #registerTable th,
    #scheduleTable td, #resultsTable td, #registerTable td, 
    #scheduleTable tr, #resultsTable tr, #registerTable tr {
        display: block;
    }
    
    #scheduleTable thead tr, #resultsTable thead tr, #registerTable thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    #scheduleTable tr, #resultsTable tr, #registerTable tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
    }
    #scheduleTable td, #resultsTable td, #registerTable td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 45%;
        text-align: right;
    }
    #scheduleTable td::before, #resultsTable td::before, #registerTable td::before {
        content: attr(data-label);
        position: absolute;
        left: 6px;
        width: 40%;
        text-align: left;
        font-weight: bold;
        color: var(--primary-color);
    }
}
.button-container {
    display: flex;
    gap: 10px; /* Khoảng cách giữa các nút */
    padding: 20px;
}

.btn {
    /* Thiết lập chung cho tất cả các nút */
    display: inline-block; /* Quan trọng để áp dụng padding/margin */
    padding: 10px 20px;
    margin: 5px 0;
    text-decoration: none; /* Bỏ gạch chân link */
    color: white;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    text-align: center;
}

/* Định dạng Nút Trang Chủ (Màu xanh dương) */
.primary-btn {
    background-color: #007bff;
    border: 1px solid #007bff;
}

.primary-btn:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Định dạng Nút Fanpage (Màu Facebook) */
.facebook-btn {
    background-color: #1877f2;
    border: 1px solid #1877f2;
}

.facebook-btn:hover {
    background-color: #145dbf;
    border-color: #145dbf;
}

/* CONTAINER quan trọng để căn chỉnh 2 nút ngang hàng */
.action-buttons {
    display: flex;
    gap: 15px; /* Khoảng cách giữa các nút */
    margin-bottom: 10px;
	align-items: stretch;
}
/* Style nút Sao chép (Chức năng JS) */
.copy-btn {
	flex: 1;
    background-color: #28a745; 
}
.copy-btn:hover {
    background-color: #1e7e34;
}

.message-status {
    margin-left: 15px;
    font-size: 0.9em;
    color: #28a745;
    opacity: 0;
    transition: opacity 0.5s;
}

.message-status.show {
    opacity: 1;
}

.floating-buttons-container {
    position: fixed;
    bottom: 20px; /* Cách đáy 20px */
    right: 20px; /* Cách lề phải 20px */
    z-index: 1000; /* Đảm bảo nút nằm trên tất cả các thành phần khác */
    display: flex;
    flex-direction: column; /* Xếp các nút theo chiều dọc */
    gap: 10px; /* Khoảng cách giữa các nút */
	
}
.floating-buttons-container-topright {
    /* 1. Thiết lập vị trí nổi (floating) cố định trên viewport */
    position: fixed; /*absolute; */
    
    /* 2. Đặt vị trí ở góc trên bên phải */
    top: 80px;     /* Khoảng cách 20px từ mép trên */
    right: 20px;   /* Khoảng cách 20px từ mép phải */
    
    /* 3. Đảm bảo nó luôn hiển thị trên các nội dung khác */
    z-index: 1000; 
	flex-direction: column; /* Xếp các nút theo chiều dọc */
    gap: 30px; /* Khoảng cách giữa các nút */
    /* Tùy chọn: Định kiểu để container trông chuyên nghiệp hơn */
	/*
     background-color: rgba(255, 255, 255, 0.9); 
     padding: 10px; 
     border-radius: 8px; 
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); 
	 */
}
/* 2. Định dạng chung cho nút */
.floating-btn {
    /* *** ĐIỀU CHỈNH QUAN TRỌNG *** */
    width: 50px;       /* Chiều rộng cố định */
    height: 50px;      /* Chiều cao bằng chiều rộng */
    padding: 0;        /* Loại bỏ padding */
    border-radius: 50%; /* TẠO HÌNH TRÒN */
    font-size: 20px;   /* Kích thước Icon */
    /* **************************** */

    display: flex;
    align-items: center; /* Căn giữa icon theo chiều dọc */
    justify-content: center; /* Căn giữa icon theo chiều ngang */
    
    text-decoration: none;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
	
	/* Làm mờ 70% */
    opacity: 0.3; 
    
}

.floating-btn i {
    margin-right: 0px;
    font-size: 18px;
}

.floating-btn:hover {
    transform: translateY(-2px); /* Hiệu ứng nhấc lên khi rê chuột */
	opacity: 1; /* Hiển thị rõ ràng khi người dùng tương tác */
}

/* 3. Định dạng màu sắc riêng */
/* Zalo (Màu xanh Zalo) */
.zalo-btn {
    background-color: #008f83; /* Màu Zalo */
}

/* Messenger (Màu xanh Facebook) */
.mess-btn {
    background-color: #0078ff; /* Màu Messenger */
}

/* Gọi điện (Màu đỏ/xanh lá tùy chọn) */
.call-btn {
    background-color: #28a745; /* Mã màu xanh lá cây tiêu chuẩn */
}
.call-btn:hover {
    background-color: #1e7e34; /* Màu đậm hơn khi hover */
}

/* Gọi điện (Màu đỏ/xanh lá tùy chọn) */
.Homepage-btn {
    background-color: #dc3545; /* Màu đỏ */
}
/* Áp dụng trực tiếp vào class của ô bảng */
.cell-with-newlines {
    white-space: pre-wrap; /* Thường là lựa chọn tốt nhất */
}
.modal {
    /* Đảm bảo modal phủ toàn màn hình và luôn nằm trên cùng */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Màu nền đen trong suốt, tạo hiệu ứng mờ */
    background-color: rgba(0, 0, 0, 0.6); 
    /* Đảm bảo nó luôn ở trên (cao hơn các phần tử khác) */
    z-index: 9999; 
    /* Mặc định là ẩn, dùng JS để thay đổi display: block */
    display: none; 
    
    /* Thiết lập cho việc căn giữa nội dung */
    display: flex;
    justify-content: center; /* Căn giữa ngang */
    align-items: center; /* Căn giữa dọc */
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* Đặt ở giữa màn hình */
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Kích thước form */
	
    /* Góc bo tròn nhẹ nhàng */
    border-radius: 8px; 
    /* Khoảng đệm bên trong */
    padding: 30px;
    
    /* Hiệu ứng bóng đổ 3D nhẹ nhàng, rất quan trọng cho sự chuyên nghiệp */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); 
    
    /* Tạo hiệu ứng mượt mà khi modal xuất hiện/biến mất (nếu dùng transition) */
    transform: scale(1); 
    transition: all 0.3s ease-in-out;
}
/* Trường nhập liệu (input, textarea) */
.modal-content input[type="text"], 
.modal-content input[type="email"],
.modal-content input[type="number"] {
    width: 100%; /* Chiếm hết chiều ngang */
    padding: 10px 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc; /* Viền mỏng */
    border-radius: 4px; /* Góc bo tròn nhẹ */
    box-sizing: border-box; /* Quan trọng để padding không làm tăng chiều rộng */
    font-size: 1em;
    transition: border-color 0.3s;
}

/* Hiệu ứng khi focus vào input */
.modal-content input:focus {
    border-color: #007bff; /* Màu xanh nổi bật khi focus */
    outline: none;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}
/* Container chứa các nút (nếu cần) */
.modal-actions {
    margin-top: 20px;
    text-align: right;
}

.modal-content button {
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s, opacity 0.3s;
    margin-left: 10px; /* Khoảng cách giữa các nút */
}

/* Nút chính (Lưu) */
.modal-content button[type="submit"], 
.modal-content .btn-save {
    background-color: #007bff; /* Màu xanh dương chủ đạo */
    color: white;
    border: none;
}

.modal-content button[type="submit"]:hover,
.modal-content .btn-save:hover {
    background-color: #0056b3;
}

/* Nút phụ (Đóng) */
.modal-content .btn-close {
    background-color: #6c757d; /* Màu xám trung tính */
    color: white;
    border: none;
}

.modal-content .btn-close:hover {
    background-color: #5a6268;
}

/* Nút bị vô hiệu hóa */
.modal-content button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
