/* ======================================== */
/* MODAL & POPUP (GIAO DIỆN VS CODE STYLE) */
/* ======================================== */

/* 1. Lớp phủ mờ nền (Overlay) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.75); /* Tối hơn cho ngầu */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Hiệu ứng mờ ảo khi hiện ra */
    backdrop-filter: blur(3px); 
    opacity: 1;
    transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* 2. Cái Hộp Modal Chính */
.modal-content, .confirm-modal-content {
    background-color: #252526; /* Màu nền chuẩn VS Code */
    color: #cccccc;
    width: 380px; /* Rộng hơn chút */
    max-width: 90%;
    padding: 25px;
    border-radius: 8px; /* Bo góc mềm mại */
    border: 1px solid #454545; /* Viền mỏng tinh tế */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7); /* Đổ bóng sâu */
    position: relative;
    transform: translateY(0);
    transition: transform 0.2s ease;
}

/* Tiêu đề (Đăng nhập...) */
.modal-content h3, .confirm-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    text-align: center; /* Căn giữa tiêu đề */
    letter-spacing: 0.5px;
}

/* 3. Ô nhập liệu (Form Group) */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #9aa0a6;
    margin-bottom: 6px;
    text-transform: uppercase;
}

/* Input xịn xò */
.modal-input {
    width: 100%;
    padding: 10px 12px;
    background-color: #3c3c3c; /* Nền input tối */
    border: 1px solid transparent; /* Viền ẩn */
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    border-radius: 4px;
    box-sizing: border-box;
    transition: all 0.2s;
}

/* Khi bấm vào Input */
.modal-input:focus {
    outline: none;
    border-color: #007acc; /* Viền xanh VS Code */
    background-color: #444444;
}

/* Input cho số (Cài đặt) */
input[type="number"] {
    font-family: Consolas, monospace;
}

/* --- 4. NÚT BẤM (ACTIONS) --- */

.modal-actions, .confirm-actions {
    display: flex;
    justify-content: space-between; /* Đẩy link sang trái, các nút sang phải */
    align-items: center;
    margin-top: 25px;
    width: 100%;
    gap: 10px;
}

/* Nút bấm nhỏ gọn */
.btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    white-space: nowrap; /* Không xuống dòng */
    min-width: 80px; /* Độ rộng tối thiểu cho đẹp */
    text-align: center;
    transition: all 0.2s;
}

/* Nút Hủy (Màu xám) */
.modal-btn-cancel, .btn-secondary {
    background-color: transparent;
    color: #cccccc;
    border: 1px solid #555;
}

.modal-btn-cancel:hover, .btn-secondary:hover {
    background-color: #3c3c3c;
    color: #ffffff;
    border-color: #777;
}

/* Nút Chính (Đăng nhập/Tạo/Lưu) - Màu Xanh */
.modal-btn-create, .btn-primary {
    background-color: #007acc;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.modal-btn-create:hover, .btn-primary:hover {
    background-color: #0062a3; /* Xanh đậm hơn khi hover */
    transform: translateY(-1px); /* Nổi lên nhẹ */
}

.modal-btn-create:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* Nút Đỏ (Xóa) */
.btn-primary[style*="ff6b6b"] {
    background-color: #d93025 !important;
}
.btn-primary[style*="ff6b6b"]:hover {
    background-color: #b02015 !important;
}

/* Link "Chưa có tài khoản?" */
#switchAuthMode {
    font-size: 12px;
    color: #3794ff;
    text-decoration: none;
    margin-right: auto; /* Đẩy nó sang trái cùng */
}
#switchAuthMode:hover {
    text-decoration: underline;
}

/* --- THÔNG BÁO TRONG MODAL --- */
.auth-message {
    font-size: 13px;
    padding: 10px;
    margin-top: 15px;
    border-radius: 4px;
    text-align: center;
}

.auth-message.hidden {
    display: none;
}

.auth-message.error {
    background-color: rgba(248, 81, 73, 0.1);
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

.auth-message.success {
    background-color: rgba(46, 160, 67, 0.15);
    color: #3fb950;
    border: 1px solid #3fb950;
}

/* ======================================== */
/* MODAL QUẢN LÝ DỰ ÁN (PROJECT MANAGER) */
/* ======================================== */

/* 1. Khung Modal Chính */
.project-modal-box {
    width: 500px !important;      /* Chiều rộng chuẩn */
    max-width: 95vw !important;   /* Không quá màn hình điện thoại */
    height: 450px;                /* Chiều cao cố định */
    max-height: 85vh;             /* Không quá cao so với màn hình */
    display: flex;                /* Dùng Flexbox để chia dọc */
    flex-direction: column;       /* Xếp chồng lên nhau */
    padding: 0 !important;        /* Reset padding để tự căn chỉnh bên trong */
    overflow: hidden;             /* Ẩn phần thừa */
}

/* 2. Phần Đầu (Header) */
.pm-header {
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between; /* Đẩy tiêu đề và nút sang 2 bên */
    align-items: center;
    background-color: #2d2d2d; /* Màu nền tối hơn chút */
    flex-shrink: 0; /* Không bị co lại */
}
.pm-header h3 { margin: 0; font-size: 16px; color: #fff; }

/* 3. Phần Thân (Danh sách - Cuộn) */
.pm-body {
    flex: 1;                /* Chiếm toàn bộ khoảng trống còn lại */
    overflow-y: auto;       /* Cho phép cuộn dọc nếu danh sách dài */
    padding: 10px;
    background-color: #252526;
}

/* 4. Phần Chân (Footer) */
.pm-footer {
    padding: 15px 20px;
    border-top: 1px solid #444;
    display: flex;
    justify-content: space-between; /* Nút đăng xuất trái, đóng phải */
    align-items: center;
    background-color: #2d2d2d;
    flex-shrink: 0; /* Không bị co lại */
}

/* --- Các Item trong danh sách --- */
.project-item {
    background-color: #333;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.project-item:hover {
    background-color: #3c3c3c;
    border-color: #007acc; /* Viền xanh khi di chuột */
    transform: translateX(2px); /* Hiệu ứng đẩy nhẹ */
}

/* Thông tin dự án */
.project-info {
    flex: 1; 
    display: flex; 
    align-items: center; 
    overflow: hidden;
    gap: 10px;
}

.project-name-text {
    font-weight: bold; 
    color: #e0e0e0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ô nhập đổi tên (Inline) */
.project-rename-input {
    width: 100%; 
    background: #1e1e1e; 
    color: white; 
    border: 1px solid #007acc; 
    padding: 4px 8px; 
    border-radius: 2px;
    outline: none;
    font-family: inherit;
    font-size: 13px;
}

/* Các nút thao tác (Sửa/Xóa) */
.project-meta {
    display: flex; 
    align-items: center; 
    gap: 15px;
}

.project-date {
    color: #888; 
    font-size: 11px;
}

.project-actions {
    display: flex; 
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.project-item:hover .project-actions {
    opacity: 1; 
}

.action-btn {
    background: none; 
    border: none; 
    cursor: pointer; 
    font-size: 16px; 
    padding: 2px;
    opacity: 0.7;
    transition: transform 0.1s;
}

.action-btn:hover { opacity: 1; transform: scale(1.2); }
.delete-btn:hover { color: #ff6b6b; }
.edit-btn:hover { color: #fff; }

/* Thông báo trống */
.empty-list-msg, .empty-msg {
    text-align: center;
    color: #888;
    margin-top: 50px;
    font-style: italic;
}

/* Nút Đăng xuất (Viền đỏ) */
.btn-danger-outline {
    background: transparent;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-danger-outline:hover {
    background-color: rgba(255, 107, 107, 0.1);
}
